diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-10-03 03:41:38 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-19 13:34:40 +0100 |
commit | 0f78dcc86d9af8f742f76505c5a104c6dff17ca9 (patch) | |
tree | b7dd0eb43fc0dfa1ce73b8e753ebfd30b34a9d12 /test/parallel | |
parent | 5e4d99ae6e3b32b8c30404f77c33fa9cfc5ca22d (diff) | |
download | android-node-v8-0f78dcc86d9af8f742f76505c5a104c6dff17ca9.tar.gz android-node-v8-0f78dcc86d9af8f742f76505c5a104c6dff17ca9.tar.bz2 android-node-v8-0f78dcc86d9af8f742f76505c5a104c6dff17ca9.zip |
util: escape C1 control characters and switch to hex format
C1 control characters will from now on also be escaped to prevent
altering the terminal behavior.
Fixes: https://github.com/nodejs/node/issues/29450
PR-URL: https://github.com/nodejs/node/pull/29826
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'test/parallel')
-rw-r--r-- | test/parallel/test-fs-whatwg-url.js | 6 | ||||
-rw-r--r-- | test/parallel/test-util-inspect.js | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/test/parallel/test-fs-whatwg-url.js b/test/parallel/test-fs-whatwg-url.js index c5f4d81dfb..377f6d010c 100644 --- a/test/parallel/test-fs-whatwg-url.js +++ b/test/parallel/test-fs-whatwg-url.js @@ -63,7 +63,7 @@ if (common.isWindows) { code: 'ERR_INVALID_ARG_VALUE', type: TypeError, message: 'The argument \'path\' must be a string or Uint8Array without ' + - 'null bytes. Received \'c:\\\\tmp\\\\\\u0000test\'' + "null bytes. Received 'c:\\\\tmp\\\\\\x00test'" } ); } else { @@ -96,8 +96,8 @@ if (common.isWindows) { { code: 'ERR_INVALID_ARG_VALUE', type: TypeError, - message: 'The argument \'path\' must be a string or Uint8Array without ' + - 'null bytes. Received \'/tmp/\\u0000test\'' + message: "The argument 'path' must be a string or Uint8Array without " + + "null bytes. Received '/tmp/\\x00test'" } ); } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index e7804eec2f..b48bb56736 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -91,10 +91,11 @@ assert.strictEqual( new Date('2010-02-14T12:48:40+01:00').toISOString() ); assert.strictEqual(util.inspect(new Date('')), (new Date('')).toString()); -assert.strictEqual(util.inspect('\n\u0001'), "'\\n\\u0001'"); +assert.strictEqual(util.inspect('\n\x01'), "'\\n\\x01'"); assert.strictEqual( - util.inspect(`${Array(75).fill(1)}'\n\u001d\n\u0003`), - `"${Array(75).fill(1)}'\\n" +\n '\\u001d\\n' +\n '\\u0003'` + util.inspect(`${Array(75).fill(1)}'\n\x1d\n\x03\x85\x7f\x7e\x9f\xa0`), + // eslint-disable-next-line no-irregular-whitespace + `"${Array(75).fill(1)}'\\n" +\n '\\x1D\\n' +\n '\\x03\\x85\\x7F~\\x9F '` ); assert.strictEqual(util.inspect([]), '[]'); assert.strictEqual(util.inspect(Object.create([])), 'Array {}'); |