@@ -93,7 +93,7 @@ assert.strictEqual(
93
93
Object . assign ( new String ( 'hello' ) , { [ Symbol ( 'foo' ) ] : 123 } ) ,
94
94
{ showHidden : true }
95
95
) ,
96
- ' { [String: \ 'hello\ '] [length]: 5, [Symbol(foo)]: 123 }'
96
+ " { [String: 'hello'] [length]: 5, [Symbol(foo)]: 123 }"
97
97
) ;
98
98
99
99
assert . strictEqual ( util . inspect ( ( new JSStream ( ) ) . _externalStream ) ,
@@ -265,7 +265,7 @@ assert.strictEqual(
265
265
name : { value : 'Tim' , enumerable : true } ,
266
266
hidden : { value : 'secret' }
267
267
} ) ) ,
268
- ' { name: \ 'Tim\ ' }'
268
+ " { name: 'Tim' }"
269
269
) ;
270
270
271
271
// Dynamic properties.
@@ -308,7 +308,7 @@ assert.strictEqual(
308
308
}
309
309
) ;
310
310
assert . strictEqual ( util . inspect ( value ) ,
311
- ' [ 1, 2, 3, growingLength: [Getter], \ '-1\ ': -1 ]' ) ;
311
+ " [ 1, 2, 3, growingLength: [Getter], '-1': -1 ]" ) ;
312
312
}
313
313
314
314
// Array with inherited number properties.
@@ -422,24 +422,24 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
422
422
// Test for sparse array.
423
423
{
424
424
const a = [ 'foo' , 'bar' , 'baz' ] ;
425
- assert . strictEqual ( util . inspect ( a ) , '[ \ 'foo\ ', \ 'bar\ ', \ 'baz\ ' ]' ) ;
425
+ assert . strictEqual ( util . inspect ( a ) , "[ 'foo', 'bar', 'baz' ]" ) ;
426
426
delete a [ 1 ] ;
427
- assert . strictEqual ( util . inspect ( a ) , '[ \ 'foo\ ', <1 empty item>, \ 'baz\ ' ]' ) ;
427
+ assert . strictEqual ( util . inspect ( a ) , "[ 'foo', <1 empty item>, 'baz' ]" ) ;
428
428
assert . strictEqual (
429
429
util . inspect ( a , true ) ,
430
- '[ \ 'foo\ ', <1 empty item>, \ 'baz\ ', [length]: 3 ]'
430
+ "[ 'foo', <1 empty item>, 'baz', [length]: 3 ]"
431
431
) ;
432
432
assert . strictEqual ( util . inspect ( new Array ( 5 ) ) , '[ <5 empty items> ]' ) ;
433
433
a [ 3 ] = 'bar' ;
434
434
a [ 100 ] = 'qux' ;
435
435
assert . strictEqual (
436
436
util . inspect ( a , { breakLength : Infinity } ) ,
437
- '[ \ 'foo\ ', <1 empty item>, \ 'baz\ ', \ 'bar\ ', <96 empty items>, \ 'qux\ ' ]'
437
+ "[ 'foo', <1 empty item>, 'baz', 'bar', <96 empty items>, 'qux' ]"
438
438
) ;
439
439
delete a [ 3 ] ;
440
440
assert . strictEqual (
441
441
util . inspect ( a , { maxArrayLength : 4 } ) ,
442
- '[ \ 'foo\ ', <1 empty item>, \ 'baz\ ', <97 empty items>, ... 1 more item ]'
442
+ "[ 'foo', <1 empty item>, 'baz', <97 empty items>, ... 1 more item ]"
443
443
) ;
444
444
}
445
445
@@ -630,13 +630,13 @@ util.inspect([{ inspect: () => 123 }]);
630
630
631
631
assert . strictEqual (
632
632
util . inspect ( w ) ,
633
- '{ \ '\\\\\ ': 1, \ '\\\\\\\\\ ': 2, \ '\\\\\\\\\\\\\ ': 3, ' +
634
- '\' \\\\\\\\\\\\\\\\\ ': 4, \ '\\n\ ': 5, \ '\\r\ ': 6 }'
633
+ "{ '\\\\': 1, '\\\\\\\\': 2, '\\\\\\\\\\\\': 3, " +
634
+ "'\ \\\\\\\\\\\\\\\': 4, '\\n': 5, '\\r': 6 }"
635
635
) ;
636
636
assert . strictEqual (
637
637
util . inspect ( y ) ,
638
- '[ \'a\ ', \'b\ ', \'c\ ', \ '\\\\\\\\\ ': \'d\ ', ' +
639
- '\'\\n\ ': \'e\ ', \ '\\r\ ': \'f\ ' ]'
638
+ "[ 'a ', 'b ', 'c ', '\\\\\\\\': 'd ', " +
639
+ "'\\n ': 'e ', '\\r': 'f ' ]"
640
640
) ;
641
641
}
642
642
@@ -758,7 +758,7 @@ util.inspect({ hasOwnProperty: null });
758
758
// A custom [util.inspect.custom]() should be able to return other Objects.
759
759
subject [ util . inspect . custom ] = ( ) => ( { foo : 'bar' } ) ;
760
760
761
- assert . strictEqual ( util . inspect ( subject ) , ' { foo: \ 'bar\ ' }' ) ;
761
+ assert . strictEqual ( util . inspect ( subject ) , " { foo: 'bar' }" ) ;
762
762
763
763
subject [ util . inspect . custom ] = ( depth , opts ) => {
764
764
assert . strictEqual ( opts . customInspectOptions , true ) ;
@@ -828,7 +828,7 @@ util.inspect({ hasOwnProperty: null });
828
828
}
829
829
830
830
// Test boxed primitives output the correct values.
831
- assert . strictEqual ( util . inspect ( new String ( 'test' ) ) , ' [String: \ 'test\']' ) ;
831
+ assert . strictEqual ( util . inspect ( new String ( 'test' ) ) , " [String: 'test']" ) ;
832
832
assert . strictEqual (
833
833
util . inspect ( Object ( Symbol ( 'test' ) ) ) ,
834
834
'[Symbol: Symbol(test)]'
@@ -844,15 +844,15 @@ assert.strictEqual(util.inspect(new Number(13.37)), '[Number: 13.37]');
844
844
{
845
845
const str = new String ( 'baz' ) ;
846
846
str . foo = 'bar' ;
847
- assert . strictEqual ( util . inspect ( str ) , ' { [String: \ 'baz\ '] foo: \ 'bar\ ' }' ) ;
847
+ assert . strictEqual ( util . inspect ( str ) , " { [String: 'baz'] foo: 'bar' }" ) ;
848
848
849
849
const bool = new Boolean ( true ) ;
850
850
bool . foo = 'bar' ;
851
- assert . strictEqual ( util . inspect ( bool ) , ' { [Boolean: true] foo: \ 'bar\ ' }' ) ;
851
+ assert . strictEqual ( util . inspect ( bool ) , " { [Boolean: true] foo: 'bar' }" ) ;
852
852
853
853
const num = new Number ( 13.37 ) ;
854
854
num . foo = 'bar' ;
855
- assert . strictEqual ( util . inspect ( num ) , ' { [Number: 13.37] foo: \ 'bar\ ' }' ) ;
855
+ assert . strictEqual ( util . inspect ( num ) , " { [Number: 13.37] foo: 'bar' }" ) ;
856
856
}
857
857
858
858
// Test es6 Symbol.
@@ -881,7 +881,7 @@ if (typeof Symbol !== 'undefined') {
881
881
assert . strictEqual ( util . inspect ( subject ) , '{ [Symbol(symbol)]: 42 }' ) ;
882
882
assert . strictEqual (
883
883
util . inspect ( subject , options ) ,
884
- ' { [Symbol(symbol)]: 42, [Symbol()]: \ 'non-enum\ ' }'
884
+ " { [Symbol(symbol)]: 42, [Symbol()]: 'non-enum' }"
885
885
) ;
886
886
887
887
subject = [ 1 , 2 , 3 ] ;
@@ -899,7 +899,7 @@ if (typeof Symbol !== 'undefined') {
899
899
set . bar = 42 ;
900
900
assert . strictEqual (
901
901
util . inspect ( set , true ) ,
902
- ' Set { \ 'foo\ ', [size]: 1, bar: 42 }'
902
+ " Set { 'foo', [size]: 1, bar: 42 }"
903
903
) ;
904
904
}
905
905
@@ -914,11 +914,11 @@ if (typeof Symbol !== 'undefined') {
914
914
{
915
915
assert . strictEqual ( util . inspect ( new Map ( ) ) , 'Map {}' ) ;
916
916
assert . strictEqual ( util . inspect ( new Map ( [ [ 1 , 'a' ] , [ 2 , 'b' ] , [ 3 , 'c' ] ] ) ) ,
917
- ' Map { 1 => \'a\ ', 2 => \'b\ ', 3 => \'c\ ' }' ) ;
917
+ " Map { 1 => 'a ', 2 => 'b ', 3 => 'c ' }" ) ;
918
918
const map = new Map ( [ [ 'foo' , null ] ] ) ;
919
919
map . bar = 42 ;
920
920
assert . strictEqual ( util . inspect ( map , true ) ,
921
- ' Map { \ 'foo\ ' => null, [size]: 1, bar: 42 }' ) ;
921
+ " Map { 'foo' => null, [size]: 1, bar: 42 }" ) ;
922
922
}
923
923
924
924
// Test circular Map.
@@ -949,7 +949,7 @@ if (typeof Symbol !== 'undefined') {
949
949
const promiseWithProperty = Promise . resolve ( 'foo' ) ;
950
950
promiseWithProperty . bar = 42 ;
951
951
assert . strictEqual ( util . inspect ( promiseWithProperty ) ,
952
- ' Promise { \ 'foo\ ', bar: 42 }' ) ;
952
+ " Promise { 'foo', bar: 42 }" ) ;
953
953
}
954
954
955
955
// Make sure it doesn't choke on polyfills. Unlike Set/Map, there is no standard
@@ -965,14 +965,14 @@ if (typeof Symbol !== 'undefined') {
965
965
// Test Map iterators.
966
966
{
967
967
const map = new Map ( [ [ 'foo' , 'bar' ] ] ) ;
968
- assert . strictEqual ( util . inspect ( map . keys ( ) ) , ' [Map Iterator] { \ 'foo\ ' }' ) ;
969
- assert . strictEqual ( util . inspect ( map . values ( ) ) , ' [Map Iterator] { \ 'bar\ ' }' ) ;
968
+ assert . strictEqual ( util . inspect ( map . keys ( ) ) , " [Map Iterator] { 'foo' }" ) ;
969
+ assert . strictEqual ( util . inspect ( map . values ( ) ) , " [Map Iterator] { 'bar' }" ) ;
970
970
assert . strictEqual ( util . inspect ( map . entries ( ) ) ,
971
- ' [Map Iterator] { [ \ 'foo\ ', \ 'bar\ ' ] }' ) ;
971
+ " [Map Iterator] { [ 'foo', 'bar' ] }" ) ;
972
972
// Make sure the iterator doesn't get consumed.
973
973
const keys = map . keys ( ) ;
974
- assert . strictEqual ( util . inspect ( keys ) , ' [Map Iterator] { \ 'foo\ ' }' ) ;
975
- assert . strictEqual ( util . inspect ( keys ) , ' [Map Iterator] { \ 'foo\ ' }' ) ;
974
+ assert . strictEqual ( util . inspect ( keys ) , " [Map Iterator] { 'foo' }" ) ;
975
+ assert . strictEqual ( util . inspect ( keys ) , " [Map Iterator] { 'foo' }" ) ;
976
976
keys . extra = true ;
977
977
assert . strictEqual (
978
978
util . inspect ( keys , { maxArrayLength : 0 } ) ,
@@ -1047,7 +1047,7 @@ if (typeof Symbol !== 'undefined') {
1047
1047
assert . strictEqual ( util . inspect ( new SetSubclass ( [ 1 , 2 , 3 ] ) ) ,
1048
1048
'SetSubclass [Set] { 1, 2, 3 }' ) ;
1049
1049
assert . strictEqual ( util . inspect ( new MapSubclass ( [ [ 'foo' , 42 ] ] ) ) ,
1050
- ' MapSubclass [Map] { \ 'foo\ ' => 42 }' ) ;
1050
+ " MapSubclass [Map] { 'foo' => 42 }" ) ;
1051
1051
assert . strictEqual ( util . inspect ( new PromiseSubclass ( ( ) => { } ) ) ,
1052
1052
'PromiseSubclass [Promise] { <pending> }' ) ;
1053
1053
assert . strictEqual (
@@ -1100,7 +1100,7 @@ if (typeof Symbol !== 'undefined') {
1100
1100
{
1101
1101
const x = [ ] ;
1102
1102
x [ '' ] = 1 ;
1103
- assert . strictEqual ( util . inspect ( x ) , '[ \'\ ': 1 ]' ) ;
1103
+ assert . strictEqual ( util . inspect ( x ) , "[ ' ': 1 ]" ) ;
1104
1104
}
1105
1105
1106
1106
// The following maxArrayLength tests were introduced after v6.0.0 was released.
@@ -1146,10 +1146,10 @@ if (typeof Symbol !== 'undefined') {
1146
1146
const breakpoint = oneLine . length - 5 ;
1147
1147
const twoLines = util . inspect ( obj , { breakLength : breakpoint } ) ;
1148
1148
1149
- assert . strictEqual ( oneLine , ' { foo: \ 'abc\ ', bar: \ 'xyz\ ' }' ) ;
1149
+ assert . strictEqual ( oneLine , " { foo: 'abc', bar: 'xyz' }" ) ;
1150
1150
assert . strictEqual ( oneLine ,
1151
1151
util . inspect ( obj , { breakLength : breakpoint + 1 } ) ) ;
1152
- assert . strictEqual ( twoLines , ' { foo: \ 'abc\ ',\n bar: \ 'xyz\ ' }' ) ;
1152
+ assert . strictEqual ( twoLines , " { foo: 'abc',\n bar: 'xyz' }" ) ;
1153
1153
}
1154
1154
1155
1155
// util.inspect.defaultOptions tests.
@@ -1217,7 +1217,7 @@ util.inspect(process);
1217
1217
{
1218
1218
// @@toStringTag
1219
1219
assert . strictEqual ( util . inspect ( { [ Symbol . toStringTag ] : 'a' } ) ,
1220
- ' Object [a] { [Symbol(Symbol.toStringTag)]: \'a\ ' }' ) ;
1220
+ " Object [a] { [Symbol(Symbol.toStringTag)]: 'a ' }" ) ;
1221
1221
1222
1222
class Foo {
1223
1223
constructor ( ) {
@@ -1233,17 +1233,17 @@ util.inspect(process);
1233
1233
Object . create ( null , { [ Symbol . toStringTag ] : { value : 'foo' } } ) ) ,
1234
1234
'[foo] {}' ) ;
1235
1235
1236
- assert . strictEqual ( util . inspect ( new Foo ( ) ) , ' Foo [bar] { foo: \ 'bar\ ' }' ) ;
1236
+ assert . strictEqual ( util . inspect ( new Foo ( ) ) , " Foo [bar] { foo: 'bar' }" ) ;
1237
1237
1238
1238
assert . strictEqual (
1239
1239
util . inspect ( new ( class extends Foo { } ) ( ) ) ,
1240
- ' Foo [bar] { foo: \ 'bar\ ' }' ) ;
1240
+ " Foo [bar] { foo: 'bar' }" ) ;
1241
1241
1242
1242
assert . strictEqual (
1243
1243
util . inspect ( Object . create ( Object . create ( Foo . prototype ) , {
1244
1244
foo : { value : 'bar' , enumerable : true }
1245
1245
} ) ) ,
1246
- ' Foo [bar] { foo: \ 'bar\ ' }' ) ;
1246
+ " Foo [bar] { foo: 'bar' }" ) ;
1247
1247
1248
1248
class ThrowingClass {
1249
1249
get [ Symbol . toStringTag ] ( ) {
@@ -1295,69 +1295,69 @@ util.inspect(process);
1295
1295
' 2,' ,
1296
1296
' [' ,
1297
1297
' [' ,
1298
- ' \ 'Lorem ipsum dolor\\nsit amet,\\tconsectetur \ ' +' ,
1299
- ' \ 'adipiscing elit, sed do eiusmod tempor \ ' +' ,
1300
- ' \ 'incididunt ut labore et dolore magna \ ' +' ,
1301
- ' \ 'aliqua.\',' ,
1302
- ' \ 'test\',' ,
1303
- ' \ 'foo\'' ,
1298
+ " 'Lorem ipsum dolor\\nsit amet,\\tconsectetur ' +" ,
1299
+ " 'adipiscing elit, sed do eiusmod tempor ' +" ,
1300
+ " 'incididunt ut labore et dolore magna ' +" ,
1301
+ " 'aliqua.'," ,
1302
+ " 'test'," ,
1303
+ " 'foo'" ,
1304
1304
' ]' ,
1305
1305
' ],' ,
1306
1306
' 4' ,
1307
1307
' ],' ,
1308
1308
' b: Map {' ,
1309
- ' \ 'za\ ' => 1,' ,
1310
- ' \ 'zb\ ' => \ 'test\'' ,
1309
+ " 'za' => 1," ,
1310
+ " 'zb' => 'test'" ,
1311
1311
' }' ,
1312
1312
'}'
1313
1313
] . join ( '\n' ) ;
1314
1314
assert . strictEqual ( out , expect ) ;
1315
1315
1316
1316
out = util . inspect ( o . a [ 2 ] [ 0 ] [ 0 ] , { compact : false , breakLength : 30 } ) ;
1317
1317
expect = [
1318
- '\' Lorem ipsum dolor\\nsit \ ' +' ,
1319
- ' \ 'amet,\\tconsectetur \ ' +' ,
1320
- ' \ 'adipiscing elit, sed do \ ' +' ,
1321
- ' \ 'eiusmod tempor incididunt \ ' +' ,
1322
- ' \ 'ut labore et dolore magna \ ' +' ,
1323
- ' \ 'aliqua.\''
1318
+ "' Lorem ipsum dolor\\nsit ' +" ,
1319
+ " 'amet,\\tconsectetur ' +" ,
1320
+ " 'adipiscing elit, sed do ' +" ,
1321
+ " 'eiusmod tempor incididunt ' +" ,
1322
+ " 'ut labore et dolore magna ' +" ,
1323
+ " 'aliqua.'"
1324
1324
] . join ( '\n' ) ;
1325
1325
assert . strictEqual ( out , expect ) ;
1326
1326
1327
1327
out = util . inspect (
1328
1328
'12345678901234567890123456789012345678901234567890' ,
1329
1329
{ compact : false , breakLength : 3 } ) ;
1330
- expect = '\' 12345678901234567890123456789012345678901234567890\'' ;
1330
+ expect = "' 12345678901234567890123456789012345678901234567890'" ;
1331
1331
assert . strictEqual ( out , expect ) ;
1332
1332
1333
1333
out = util . inspect (
1334
1334
'12 45 78 01 34 67 90 23 56 89 123456789012345678901234567890' ,
1335
1335
{ compact : false , breakLength : 3 } ) ;
1336
1336
expect = [
1337
- '\' 12 45 78 01 34 \ ' +' ,
1338
- ' \ '67 90 23 56 89 \ ' +' ,
1339
- ' \ '123456789012345678901234567890\''
1337
+ "' 12 45 78 01 34 ' +" ,
1338
+ " '67 90 23 56 89 ' +" ,
1339
+ " '123456789012345678901234567890'"
1340
1340
] . join ( '\n' ) ;
1341
1341
assert . strictEqual ( out , expect ) ;
1342
1342
1343
1343
out = util . inspect (
1344
1344
'12 45 78 01 34 67 90 23 56 89 1234567890123 0' ,
1345
1345
{ compact : false , breakLength : 3 } ) ;
1346
1346
expect = [
1347
- '\' 12 45 78 01 34 \ ' +' ,
1348
- ' \ '67 90 23 56 89 \ ' +' ,
1349
- ' \ '1234567890123 0\''
1347
+ "' 12 45 78 01 34 ' +" ,
1348
+ " '67 90 23 56 89 ' +" ,
1349
+ " '1234567890123 0'"
1350
1350
] . join ( '\n' ) ;
1351
1351
assert . strictEqual ( out , expect ) ;
1352
1352
1353
1353
out = util . inspect (
1354
1354
'12 45 78 01 34 67 90 23 56 89 12345678901234567 0' ,
1355
1355
{ compact : false , breakLength : 3 } ) ;
1356
1356
expect = [
1357
- '\' 12 45 78 01 34 \ ' +' ,
1358
- ' \ '67 90 23 56 89 \ ' +' ,
1359
- ' \ '12345678901234567 \ ' +' ,
1360
- ' \'0\''
1357
+ "' 12 45 78 01 34 ' +" ,
1358
+ " '67 90 23 56 89 ' +" ,
1359
+ " '12345678901234567 ' +" ,
1360
+ " '0'"
1361
1361
] . join ( '\n' ) ;
1362
1362
assert . strictEqual ( out , expect ) ;
1363
1363
@@ -1396,7 +1396,7 @@ util.inspect(process);
1396
1396
1397
1397
o [ util . inspect . custom ] = ( ) => ( { a : '12 45 78 01 34 67 90 23' } ) ;
1398
1398
out = util . inspect ( o , { compact : false , breakLength : 3 } ) ;
1399
- expect = ' {\n a: \ '12 45 78 01 34 \ ' +\n \ '67 90 23\ '\n}' ;
1399
+ expect = " {\n a: '12 45 78 01 34 ' +\n '67 90 23'\n}" ;
1400
1400
assert . strictEqual ( out , expect ) ;
1401
1401
}
1402
1402
0 commit comments