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 <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
Trott authored and targos committed Feb 15, 2019
1 parent b0220f8 commit af87164
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 af87164

Please sign in to comment.