Skip to content

Commit

Permalink
test: increase coverage for assertion_error.js
Browse files Browse the repository at this point in the history
Add a test for long strings and assert.notDeepEqual() to cover code that
truncates output when it is longer than 1024 characters.

PR-URL: #26065
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
  • Loading branch information
Trott authored and rvagg committed Feb 28, 2019
1 parent dd60cd6 commit 2d0242a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,16 +659,22 @@ assertDeepAndStrictEqual(-0, -0);

assert.deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));

assert.throws(() => assert.deepEqual(new Date(), new Date(2000, 3, 14)),
assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
AssertionError,
'deepEqual(new Date(), new Date(2000, 3, 14))');

assert.throws(
() => assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)),
() => { assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); },
AssertionError,
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
);

assert.throws(
() => { assert.notDeepEqual('a'.repeat(1024), 'a'.repeat(1024)); },
AssertionError,
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
);

assert.notDeepEqual(new Date(), new Date(2000, 3, 14));

assertDeepAndStrictEqual(/a/, /a/);
Expand Down

0 comments on commit 2d0242a

Please sign in to comment.