test: check control characters replacing

Add test that creates an error with a control character in the message.

PR-URL: https://github.com/nodejs/node/pull/24182
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Alessandro Gatti authored and Shelley Vohr committed 2019-01-12 10:12:30 -08:00
1 parent 07b7db2f81
commit 454ede2d90
1 file changed
+8
+8
View File
@@ -835,6 +835,14 @@ common.expectsError(
);
{
assert.throws(() => {
assert.ok((() => Boolean('' === false))());
}, {
message: 'The expression evaluated to a falsy value:\n\n' +
" assert.ok((() => Boolean('\\u0001' === false))())\n"
});
const errFn = () => {
const err = new TypeError('Wrong value');
err.code = 404;