Skip to content

Commit 2d0242a

Browse files
Trottrvagg
authored andcommitted
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: #26065 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent dd60cd6 commit 2d0242a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/parallel/test-assert-deep.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -659,16 +659,22 @@ assertDeepAndStrictEqual(-0, -0);
659659

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

662-
assert.throws(() => assert.deepEqual(new Date(), new Date(2000, 3, 14)),
662+
assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
663663
AssertionError,
664664
'deepEqual(new Date(), new Date(2000, 3, 14))');
665665

666666
assert.throws(
667-
() => assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)),
667+
() => { assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); },
668668
AssertionError,
669669
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
670670
);
671671

672+
assert.throws(
673+
() => { assert.notDeepEqual('a'.repeat(1024), 'a'.repeat(1024)); },
674+
AssertionError,
675+
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
676+
);
677+
672678
assert.notDeepEqual(new Date(), new Date(2000, 3, 14));
673679

674680
assertDeepAndStrictEqual(/a/, /a/);

0 commit comments

Comments
 (0)