Antoine du Hamel
e72761fe5e
test: ensure assertions are reached on more tests
...
PR-URL: https://github.com/nodejs/node/pull/60485
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-11-06 09:47:01 +01:00
Ruben Bridgewater
7c9fbc15bc
assert,util: fail promise comparison in deep equal checks
...
It is impossible to look into the content of a promise and its
state. This aligns the comparison with WeakMaps and WeakSets.
Only reference equal promises will pass the check in the future.
Fixes https://github.com/nodejs/node/issues/55198
PR-URL: https://github.com/nodejs/node/pull/59448
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2025-08-19 10:22:35 +00:00
Ruben Bridgewater
11222f1a27
assert,util: handle invalid dates as equal in deep comparison
...
Invalid dates are now handled as equal in all deep comparisons.
PR-URL: https://github.com/nodejs/node/pull/57627
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2025-06-21 04:00:23 +00:00
Ruben Bridgewater
733e0fc2c4
assert,util: fix constructor lookup in deep equal comparison
...
The latest performance optimization did not take into account that
an object may have a property called constructor. This is addressed
in this PR by adding a new fast path and using fallbacks.
PR-URL: https://github.com/nodejs/node/pull/57876
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-04-19 11:10:40 +00:00
Ruben Bridgewater
e739559e46
assert,util: improve deep object comparison performance
...
This improves the performance for almost all objects when comparing
them deeply.
PR-URL: https://github.com/nodejs/node/pull/57648
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Bryan English <bryan@bryanenglish.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-04-05 08:53:31 +00:00
Ruben Bridgewater
4abad0763e
Revert "assert,util: revert recursive breaking change"
...
This reverts commit 575784b4cf .
PR-URL: https://github.com/nodejs/node/pull/57622
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2025-04-02 23:37:44 +00:00
Ruben Bridgewater
f1b0812754
assert: improve partialDeepStrictEqual
...
This significantly improves the assert.partialDeepStrictEqual
implementation by reusing the already existing algorithm.
It is significantly faster and handles edge cases like symbols
identical as the deepStrictEqual algorithm. This is crucial to
remove the experimental status from the implementation.
PR-URL: https://github.com/nodejs/node/pull/57370
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2025-03-12 18:26:13 +00:00
Giovanni Bucci
10cce655ca
assert: fix the string length check for printing the simple diff
...
PR-URL: https://github.com/nodejs/node/pull/55474
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-11-02 15:12:12 +00:00
Giovanni Bucci and Pietro Marchini
4d6d7d644b
assert: make assertion_error use Myers diff algorithm
...
Fixes: https://github.com/nodejs/node/issues/51733
Co-Authored-By: Pietro Marchini <pietro.marchini94@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54862
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-10-17 16:02:54 +00:00
Xuguang Mei
ac49b20c75
assert: fix deepEqual always return true on URL
...
PR-URL: https://github.com/nodejs/node/pull/50853
Fixes: https://github.com/nodejs/node/issues/50836
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-10-13 14:01:47 +00:00
James M Snell
9cbef482df
test: update multiple assert tests to use node:test
...
PR-URL: https://github.com/nodejs/node/pull/54585
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-08-29 11:40:53 -07:00
Cristian Barlutiu
764b13d75c
assert,util: change WeakMap and WeakSet comparison handling
...
PR-URL: https://github.com/nodejs/node/pull/53495
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2024-06-28 07:28:55 +00:00
Daniel Lemire and Chris Harvey
ee5c6b6604
assert,util: correct comparison when both contain same reference
...
Co-authored-by: Chris Harvey <1362083+chharvey@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/53431
Refs: https://github.com/nodejs/node/issues/53423
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-17 13:30:24 +00:00
Zhenwei Jin
c8a4f70265
assert: add deep equal check for more Error type
...
PR-URL: https://github.com/nodejs/node/pull/51805
Fixes: https://github.com/nodejs/node/issues/51793
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-05-12 19:46:13 +00:00
Filip Skokan
0afe731d35
assert,crypto: make KeyObject and CryptoKey testable for equality
...
PR-URL: https://github.com/nodejs/node/pull/50897
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-12-17 12:55:38 +00:00
Ruben Bridgewater
575784b4cf
assert,util: revert recursive breaking change
...
This commit is there to be reverted after merging. It makes it easy
to backport the overall PR and allows easy forward fixing.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-02-20 15:47:08 +01:00
Ruben Bridgewater
449e9f4489
assert,util: improve deep equal comparison performance
...
This is mainly a performance improvement for a lot of simple cases.
Diverging elements are detected earlier and equal entries are
partially also detected faster.
A small correctness patch is also included where recursions now
stop as soon as either side has a circular structure. Before, both
sides had to have a circular structure at the specific comparison
which could have caused more checks that likely fail at a later
point.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-02-20 15:47:06 +01:00
Jordan Harband
757c104147
tools: add prefer-proto rule
...
fixup: add support for `Object.create(null)`
fixup: extend to any 1-argument Object.create call
fixup: add tests
PR-URL: https://github.com/nodejs/node/pull/46083
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-01-10 05:38:36 +00:00
Rich Trott
dcc368f4be
tools,lib,test: enable ESLint no-regex-spaces rule
...
PR-URL: https://github.com/nodejs/node/pull/41463
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-01-13 17:12:05 -08:00
Rich Trott
9bfe60fc20
tools: enable ESLint no-sparse-arrays rule
...
PR-URL: https://github.com/nodejs/node/pull/41463
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-01-13 17:11:13 -08:00
Ruben Bridgewater
dab8ab2837
assert,util: compare RegExp.lastIndex while using deep equal checks
...
Compare the `lastIndex` property of regular expressions next to the
flags and source property.
Fixes: https://github.com/nodejs/node/issues/28766
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41020
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-12-02 08:01:40 +00:00
Tobias Nießen
dd52c05046
test: avoid deep comparisons with literals
...
Comparing any value to any non-RegExp literal or undefined using
strictEqual (or notStrictEqual) passes if and only if deepStrictEqual
(or notDeepStrictEqual, respectively) passes.
Unnecessarily using deep comparisons adds confusion.
This patch adds an ESLint rule that forbids the use of deepStrictEqual
and notDeepStrictEqual when the expected value (i.e., the second
argument) is a non-RegExp literal or undefined.
For reference, an ESTree literal is defined as follows.
extend interface Literal <: Expression {
type: "Literal";
value: string | boolean | null | number | RegExp | bigint;
}
The value `undefined` is an `Identifier` with `name: 'undefined'`.
PR-URL: https://github.com/nodejs/node/pull/40634
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com >
2021-11-02 10:11:49 +00:00
Rich Trott
330f25ef82
test: prepare for consistent comma-dangle lint rule
...
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.
PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
2021-04-01 23:14:29 -07:00
Ruben Bridgewater
5ff2e582cd
assert,util: fix commutativity edge case
...
Verify that both objects property keys are enumerable.
Fixes: https://github.com/nodejs/node/issues/37710
PR-URL: https://github.com/nodejs/node/pull/37711
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-13 13:44:06 +01:00
Ruben Bridgewater
9de08f773e
lib: update TODO comments
...
This removes one TODO comment and adds another that indicates that
readline is currently not able to trigger specific escape sequences.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/33361
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2020-05-20 17:05:06 +02:00
Ruben Bridgewater
489e77c119
util: add (typed) array length to the default output
...
Align the inspect output with the one used in the Chrome dev tools.
A recent survey outlined that most users prefer to see the number
of set and map entries. This should count as well for array sizes.
The size is only added to regular arrays in case the constructor is
not the default constructor.
Typed arrays always indicate their size.
PR-URL: https://github.com/nodejs/node/pull/31027
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2019-12-25 11:19:43 +01:00
Ruben Bridgewater
ab59989861
util: add Set and map size to inspect output
...
This adds the size of a set and map to the output. This aligns the
output with the one from Chromium.
PR-URL: https://github.com/nodejs/node/pull/30225
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-15 14:58:58 +01:00
Jordan Harband
916cc82b45
test: assert: fix deepStrictEqual comparing a real array and fake array
...
PR-URL: https://github.com/nodejs/node/pull/30743
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-12-11 16:32:43 -06:00
Ruben Bridgewater
5360dd151d
assert: handle (deep) equal(NaN, NaN) as being identical
...
This aligns the `equal` and `deepEqual()` implementations with the
strict versions by accepting `NaN` as being identical in case both
sides are NaN.
Refs: https://github.com/nodejs/node/issues/30350#issuecomment-552191641
PR-URL: https://github.com/nodejs/node/pull/30766
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:43:51 +01:00
Ruben Bridgewater
b5f2942fb5
test: run more assert tests
...
This makes sure the assertion does not depend on the argument order.
It also removes comments that do not apply anymore and verifies the
behavior for the loose and strict implementation.
PR-URL: https://github.com/nodejs/node/pull/30764
Refs: https://github.com/nodejs/node/pull/30743
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:40:53 +01:00
Ruben Bridgewater
b4d48c0516
assert,util: stricter type comparison using deep equal comparisons
...
This veryfies that both input arguments are always of the identical
type. It was possible to miss a few cases before. This change applies
to all deep equal assert functions (e.g., `assert.deepStrictEqual()`)
and to `util.isDeepStrictEqual()`.
PR-URL: https://github.com/nodejs/node/pull/30764
Refs: https://github.com/nodejs/node/pull/30743
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-12-07 00:40:53 +01:00
Jordan Harband
e079f6c93e
test: assert: add failing deepEqual test for faked boxed primitives
...
PR-URL: https://github.com/nodejs/node/pull/29029
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-09 10:29:56 -05:00
Ruben Bridgewater
81496567e7
assert: print more lines in the error diff
...
So far consequitive identical lines were collapsed if there were at
least three. Now they are only collapsed from five identical lines on.
This also simplifies the implementation a tiny bit by abstracting some
logic.
PR-URL: https://github.com/nodejs/node/pull/28058
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-12 19:50:03 -07:00
Ruben Bridgewater
e4ec4f2656
assert: fix error diff
...
In some edge cases an identical line could be printed twice. This is
now fixed by changing the algorithm a bit. It will now verify how
many lines were identical before the current one.
PR-URL: https://github.com/nodejs/node/pull/28058
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-12 19:49:59 -07:00
Ruben Bridgewater
3aff26428b
assert: loose deep equal should not compare symbol properties
...
This is the way it's currently documented and that seems appropriate
for loose equal assertions. The change was not intentional.
Fixes: https://github.com/nodejs/node/issues/27652
PR-URL: https://github.com/nodejs/node/pull/27653
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-05-13 16:17:00 -07:00
Ruben Bridgewater
0cd602879c
assert: refine assertion message
...
This makes sure that the error message is more appropriate than
before by checking closer what operator is used and which is not.
It also increases the total number of lines printed to the user.
PR-URL: https://github.com/nodejs/node/pull/27525
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-05-05 14:44:19 -07:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
...
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
1ed3c54ecb
errors: update error name
...
This updates all Node.js errors by removing the `code` being part
of the `name` property. Instead, the name is just changed once on
instantiation, the stack is accessed to create the stack as expected
and then the `name` property is set back to it's original form.
PR-URL: https://github.com/nodejs/node/pull/26738
Fixes: https://github.com/nodejs/node/issues/26669
Fixes: https://github.com/nodejs/node/issues/20253
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-23 02:55:54 +01:00
Ruben Bridgewater
f8763bb077
benchmark,doc,lib,test: capitalize comments
...
PR-URL: https://github.com/nodejs/node/pull/26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-10 00:44:40 +01:00
Rich Trott
8e68dc53b3
test: increase coverage for assertion_error.js
...
Add a test for long strings and assert.notDeepEqual() to cover code that
truncates output when it is longer than 1024 characters.
PR-URL: https://github.com/nodejs/node/pull/26065
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2019-02-14 19:28:38 -08:00
Ruben Bridgewater
7493db21b6
assert: adjust loose assertions
...
This changes the loose deep equal comparison by using the same logic
as done in the strict deep equal comparison besides comparing
primitives loosely, not comparing symbol properties and not comparing
the prototype.
`assert.deepEqual` is still commenly used and this is likely the
biggest pitfall.
Most changes are only minor and won't have a big impact besides
likely fixing user expectations.
PR-URL: https://github.com/nodejs/node/pull/25008
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2019-01-27 03:34:25 +01:00
Anto Aravinth
81b25eac21
util: add null prototype support for date
...
PR-URL: https://github.com/nodejs/node/pull/25144
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-10 03:24:31 +01:00
Ruben Bridgewater
bd13afb04a
util: make inspect aware of RegExp subclasses and null prototype
...
This adds support for inspect to distinguish regular expression
subclasses and ones with null prototype from "normal" regular
expressions.
PR-URL: https://github.com/nodejs/node/pull/25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-27 22:30:31 +01:00
Rich Trott
b0a334be8d
test: remove unnecessary eslint-disable comments
...
PR-URL: https://github.com/nodejs/node/pull/25119
Refs: https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-12-21 10:38:43 -08:00
Ruben Bridgewater
3b2698e41f
assert: inspect getters
...
While asserting two objects the descriptor is not taken into account.
Therefore getters will be triggered as such. This makes sure they
are also highlighted in the error message instead of potentially
looking identical while the return value of the getter is actually
different.
PR-URL: https://github.com/nodejs/node/pull/25004
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-12-18 12:34:08 +01:00
Ruben Bridgewater
9fb4fa8ded
assert,util: harden comparison
...
The former algorithm used checks which were unsafe. Most of these
have been replaced with alternatives that can not be manipulated or
fooled that easily.
PR-URL: https://github.com/nodejs/node/pull/24831
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-12-10 14:32:17 -08:00
Ruben Bridgewater
2f11fe3663
test: improve comparison coverage to 100%
...
PR-URL: https://github.com/nodejs/node/pull/24749
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-12-03 13:03:45 +01:00
Ruben Bridgewater
4dd56a39f1
assert,util: fix sparse array comparison
...
Comparing sparse arrays did not work properly. That is fixed and
tests were added to verify that everything works as expected.
This had an impact on `util.isDeepStrictEqual()` and
`assert.deepStrictEqual()` and their counterpart
`assert.notDeepStrictEqual()`.
PR-URL: https://github.com/nodejs/node/pull/24749
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-12-03 13:03:44 +01:00
Ruben Bridgewater
2eff120f6d
assert: fix loose deepEqual map comparison
...
Loose map comparison had an logic error. It will now be properly
compared.
PR-URL: https://github.com/nodejs/node/pull/24749
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-12-03 13:03:43 +01:00
Ruben Bridgewater
15b0247363
test: increase assert test coverage
...
PR-URL: https://github.com/nodejs/node/pull/24745
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-12-03 08:17:03 +01:00