Skip to content

Commit

Permalink
test: add coverage for breakLength one-column array
Browse files Browse the repository at this point in the history
Add coverage for breakLength option resulting in a single-column array
display.

Refs: https://coverage.nodejs.org/coverage-0b6d3070a176d437/lib/internal/util/inspect.js.html#L1277

PR-URL: #36657
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and danielleadams committed Jan 12, 2021
1 parent 954a369 commit 9f7fbcc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -3059,3 +3059,22 @@ assert.strictEqual(
Object.setPrototypeOf(generatorPrototype, originalProtoOfProto);
assert.strictEqual(getProtoOfProto(), originalProtoOfProto);
}

{
// Test for when breakLength results in a single column.
const obj = Array(9).fill('fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf');
assert.strictEqual(
util.inspect(obj, { breakLength: 256 }),
'[\n' +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf',\n" +
" 'fhqwhgadshgnsdhjsdbkhsdabkfabkveybvf'\n" +
']'
);
}

0 comments on commit 9f7fbcc

Please sign in to comment.