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>
This commit is contained in:
parent
fe58bef7e2
commit
8e68dc53b3
@ -653,16 +653,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/);
|
||||
|
Loading…
x
Reference in New Issue
Block a user