summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-08-19 02:50:57 -0300
committerRuben Bridgewater <ruben@bridgewater.de>2017-09-15 23:37:22 -0300
commitb0d3bec95ccbf06f54a1373c20c78699f0712e2d (patch)
tree8d980b193ae1a02803ebb7941367a5f1c7a96316 /doc
parentca2c73cae09649b4f6d74dd0419d632ee44d7e41 (diff)
downloadnode-new-b0d3bec95ccbf06f54a1373c20c78699f0712e2d.tar.gz
assert: use Same-value equality in deepStrictEqual
PR-URL: https://github.com/nodejs/node/pull/15398 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/assert.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md
index b53e221416..ca7f048f9e 100644
--- a/doc/api/assert.md
+++ b/doc/api/assert.md
@@ -142,6 +142,7 @@ Generally identical to `assert.deepEqual()` with a few exceptions:
the [Strict Equality Comparison][] too.
3. [Type tags][Object.prototype.toString()] of objects should be the same.
4. [Object wrappers][] are compared both as objects and unwrapped values.
+5. `0` and `-0` are not considered equal.
```js
const assert = require('assert');
@@ -179,6 +180,11 @@ assert.deepStrictEqual(new Number(1), new Number(2));
// Fails because the wrapped number is unwrapped and compared as well.
assert.deepStrictEqual(new String('foo'), Object('foo'));
// OK because the object and the string are identical when unwrapped.
+
+assert.deepStrictEqual(-0, -0);
+// OK
+assert.deepStrictEqual(0, -0);
+// AssertionError: 0 deepStrictEqual -0
```
If the values are not equal, an `AssertionError` is thrown with a `message`
@@ -439,6 +445,9 @@ parameter is an instance of an `Error` then it will be thrown instead of the
added: v1.2.0
changes:
- version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
+ description: -0 and +0 are not considered equal anymore.
+ - version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15036
description: NaN is now compared using the [SameValueZero][] comparison.
- version: REPLACEME