Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
test: fixed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
boingoing committed Aug 5, 2017
1 parent 745709f commit 0bac21f
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 37 deletions.
124 changes: 88 additions & 36 deletions test/parallel/test-util-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,48 +123,100 @@ assert.strictEqual(util.format('%o', 42), '42');
assert.strictEqual(util.format('%o', 'foo'), '\'foo\'');
assert.strictEqual(
util.format('%o', obj),
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }');
common.engineSpecificMessage({
v8:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }',
chakracore:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [prototype]: func { [constructor]: [Circular] },\n' +
' [name]: \'func\',\n' +
' [length]: 0 } }'
}));
assert.strictEqual(
util.format('%o', nestedObj),
'{ foo: \'bar\',\n' +
' foobar: \n' +
' { foo: \'bar\',\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } } }');
common.engineSpecificMessage({
v8:
'{ foo: \'bar\',\n' +
' foobar: \n' +
' { foo: \'bar\',\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } } }',
chakracore:
'{ foo: \'bar\',\n' +
' foobar: \n' +
' { foo: \'bar\',\n' +
' func: \n' +
' { [Function: func]\n' +
' [prototype]: func { [constructor]: [Circular] },\n' +
' [name]: \'func\',\n' +
' [length]: 0 } } }'
}));
assert.strictEqual(
util.format('%o %o', obj, obj),
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }' +
' { foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }');
common.engineSpecificMessage({
v8:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }' +
' { foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } }',
chakracore:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [prototype]: func { [constructor]: [Circular] },\n' +
' [name]: \'func\',\n' +
' [length]: 0 } }' +
' { foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [prototype]: func { [constructor]: [Circular] },\n' +
' [name]: \'func\',\n' +
' [length]: 0 } }'
}));
assert.strictEqual(
util.format('%o %o', obj),
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } } %o');
common.engineSpecificMessage({
v8:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [length]: 0,\n' +
' [name]: \'func\',\n' +
' [prototype]: func { [constructor]: [Circular] } } } %o',
chakracore:
'{ foo: \'bar\',\n' +
' foobar: 1,\n' +
' func: \n' +
' { [Function: func]\n' +
' [prototype]: func { [constructor]: [Circular] },\n' +
' [name]: \'func\',\n' +
' [length]: 0 } } %o'
}));

assert.strictEqual(util.format('%O'), '%O');
assert.strictEqual(util.format('%O', 42), '42');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-vm-syntax-error-stderr.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ p.stderr.on('end', common.mustCall(() => {
v8: /Invalid left-hand side expression in prefix operation/,
chakracore: /SyntaxError: Expected ';'/
}).test(output);
});
}));

0 comments on commit 0bac21f

Please sign in to comment.