Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Trott committed Aug 17, 2016
commit e72e3e2e6ea4ed7f2681290b870194340830ba06
5 changes: 5 additions & 0 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,9 @@ testBlockTypeError(assert.doesNotThrow, undefined);
assert.throws(() => { throw 'error'; }, (err) => err === 'error');
assert.throws(() => { throw new Error(); }, (err) => err instanceof Error);

// Long values should be truncated for display.
assert.throws(() => {
assert.strictEqual('A'.repeat(1000), '');
}, new RegExp(`'${'A'.repeat(127)} === ''`));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you include some $ and ^ checking in here?


console.log('All OK');