test: complete console.assert() coverage

There is one condition in the `console.assert()` code that is not
tested currently. Add a test to confirm that `console.assert(false)`
does not include a `:` in its output.

PR-URL: https://github.com/nodejs/node/pull/26827
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Rich Trott 2019-03-20 10:08:28 -07:00
parent 91be64b9d3
commit 6e9551e1b1

View File

@ -193,6 +193,9 @@ console.assert(false, '%s should', 'console.assert', 'not throw');
assert.strictEqual(errStrings[errStrings.length - 1], assert.strictEqual(errStrings[errStrings.length - 1],
'Assertion failed: console.assert should not throw\n'); 'Assertion failed: console.assert should not throw\n');
console.assert(false);
assert.strictEqual(errStrings[errStrings.length - 1], 'Assertion failed\n');
console.assert(true, 'this should not throw'); console.assert(true, 'this should not throw');
console.assert(true); console.assert(true);