Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b6ed24

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: confirm that assert truncates long values
`assert` has code to truncate values that take more than 128 characters to display. Add a test for this functionality, as the code is not currently exercised in the existing tests. PR-URL: #8134 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5bc3119 commit 4b6ed24
Copy full SHA for 4b6ed24

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-assert.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,9 @@ testBlockTypeError(assert.doesNotThrow, undefined);
528528
assert.throws(() => { throw 'error'; }, (err) => err === 'error');
529529
assert.throws(() => { throw new Error(); }, (err) => err instanceof Error);
530530

531+
// Long values should be truncated for display.
532+
assert.throws(() => {
533+
assert.strictEqual('A'.repeat(1000), '');
534+
}, new RegExp(`^AssertionError: '${'A'.repeat(127)} === ''$`));
535+
531536
console.log('All OK');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.