diff options
author | estrada9166 <estrada9166@hotmail.com> | 2019-06-21 16:55:38 -0500 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-07-02 00:40:01 +0200 |
commit | 6e9d79564234919b656a92da3e0ac3bc8a49bc2c (patch) | |
tree | eb805dcc429b4b31195b0d95df3968c09b349f99 | |
parent | 26b048effb23eb479fe0e10087860bb7f9862f2a (diff) | |
download | android-node-v8-6e9d79564234919b656a92da3e0ac3bc8a49bc2c.tar.gz android-node-v8-6e9d79564234919b656a92da3e0ac3bc8a49bc2c.tar.bz2 android-node-v8-6e9d79564234919b656a92da3e0ac3bc8a49bc2c.zip |
test: add tests to assert.ok and improve coverage
Refs: https://coverage.nodejs.org/coverage-1a4f27ae21698d0c/lib/assert.js.html#L364
PR-URL: https://github.com/nodejs/node/pull/28355
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
-rw-r--r-- | test/parallel/test-assert.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index cf80cf598d..32b2bca641 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -44,6 +44,19 @@ assert.ok(a.AssertionError.prototype instanceof Error, assert.throws(() => a(false), a.AssertionError, 'ok(false)'); assert.throws(() => a.ok(false), a.AssertionError, 'ok(false)'); +// Throw message if the message is instanceof Error. +{ + let threw = false; + try { + assert.ok(false, new Error('ok(false)')); + } catch (e) { + threw = true; + assert.ok(e instanceof Error); + } + assert.ok(threw, 'Error: ok(false)'); +} + + a(true); a('test', 'ok(\'test\')'); a.ok(true); |