Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 702051 Details for
Bug 911188
Review Request: nodejs-should - A test framework agnostic BDD-style assertions for Node.js
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
Difference between Node's eql and should's eql
eql.diff (text/plain), 3.14 KB, created by
Jamie Nguyen
on 2013-02-24 16:13:43 UTC
(
hide
)
Description:
Difference between Node's eql and should's eql
Filename:
MIME Type:
Creator:
Jamie Nguyen
Created:
2013-02-24 16:13:43 UTC
Size:
3.14 KB
patch
obsolete
>--- eql.js >+++ eql.js >@@ -17,44 +17,34 @@ > } else if (actual instanceof Date && expected instanceof Date) { > return actual.getTime() === expected.getTime(); > >- // 7.3 If the expected value is a RegExp object, the actual value is >- // equivalent if it is also a RegExp object with the same source and >- // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). >- } else if (actual instanceof RegExp && expected instanceof RegExp) { >- return actual.source === expected.source && >- actual.global === expected.global && >- actual.multiline === expected.multiline && >- actual.lastIndex === expected.lastIndex && >- actual.ignoreCase === expected.ignoreCase; >- >- // 7.4. Other pairs that do not both pass typeof value == 'object', >+ // 7.3. Other pairs that do not both pass typeof value == "object", > // equivalence is determined by ==. > } else if (typeof actual != 'object' && typeof expected != 'object') { >- return actual == expected; >+ return actual === expected; > >- // 7.5 For all other Object pairs, including Array objects, equivalence is >+ // 7.4. For all other Object pairs, including Array objects, equivalence is > // determined by having the same number of owned properties (as verified > // with Object.prototype.hasOwnProperty.call), the same set of keys > // (although not necessarily the same order), equivalent values for every >- // corresponding key, and an identical 'prototype' property. Note: this >+ // corresponding key, and an identical "prototype" property. Note: this > // accounts for both named and indexed properties on Arrays. > } else { > return objEquiv(actual, expected); > } > } > >-function isUndefinedOrNull(value) { >+function isUndefinedOrNull (value) { > return value === null || value === undefined; > } > >-function isArguments(object) { >+function isArguments (object) { > return Object.prototype.toString.call(object) == '[object Arguments]'; > } > >-function objEquiv(a, b) { >+function objEquiv (a, b) { > if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) > return false; >- // an identical 'prototype' property. >+ // an identical "prototype" property. > if (a.prototype !== b.prototype) return false; > //~~~I've managed to break Object.keys through screwy arguments passing. > // Converting to array solves the problem. >@@ -66,15 +56,14 @@ > b = pSlice.call(b); > return _deepEqual(a, b); > } >- try { >+ try{ > var ka = Object.keys(a), >- kb = Object.keys(b), >- key, i; >+ kb = Object.keys(b), >+ key, i; > } catch (e) {//happens when one is a string literal and the other isn't > return false; > } >- // having the same number of owned properties (keys incorporates >- // hasOwnProperty) >+ // having the same number of owned properties (keys incorporates hasOwnProperty) > if (ka.length != kb.length) > return false; > //the same set of keys (although not necessarily the same order), >@@ -89,7 +78,8 @@ > //~~~possibly expensive deep test > for (i = ka.length - 1; i >= 0; i--) { > key = ka[i]; >- if (!_deepEqual(a[key], b[key])) return false; >+ if (!_deepEqual(a[key], b[key] )) >+ return false; > } > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 911188
: 702051