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 <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed May 1, 2021
1 parent 5064822 commit 2896219
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 @@ -3058,3 +3058,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 2896219

Please sign in to comment.