diff options
author | cjihrig <cjihrig@gmail.com> | 2018-05-12 22:15:06 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-05-14 23:43:25 -0400 |
commit | 810af50ba2ab20e006a9e480b911c763f001ce8e (patch) | |
tree | 8d1150ca8205296e4fb21dcff048690f38451007 /test/parallel/test-assert.js | |
parent | ee2a7703e78a410fff8051dd842ef1352f73af31 (diff) | |
download | android-node-v8-810af50ba2ab20e006a9e480b911c763f001ce8e.tar.gz android-node-v8-810af50ba2ab20e006a9e480b911c763f001ce8e.tar.bz2 android-node-v8-810af50ba2ab20e006a9e480b911c763f001ce8e.zip |
assert: support symbols as assertion messages
Currently, assertion messages are implicitly converted to strings,
which causes symbols to throw. This commit adds an explicit
string conversion.
PR-URL: https://github.com/nodejs/node/pull/20693
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-assert.js')
-rw-r--r-- | test/parallel/test-assert.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index bf9d6c6eb4..51c9e677b1 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -640,6 +640,16 @@ common.expectsError( } ); +common.expectsError( + () => assert(false, Symbol('foo')), + { + code: 'ERR_ASSERTION', + type: assert.AssertionError, + generatedMessage: false, + message: 'Symbol(foo)' + } +); + { // Test caching. const fs = process.binding('fs'); |