Skip to content

Commit

Permalink
test: improve error emssage reporting in testNapiRun.js
Browse files Browse the repository at this point in the history
Backport-PR-URL: #19447
PR-URL: #16821
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
Paul Ashfield authored and MylesBorins committed Apr 16, 2018
1 parent 55fabd7 commit 2476ab9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/addons-napi/test_general/testNapiRun.js
Expand Up @@ -7,6 +7,9 @@ const assert = require('assert');
// eslint-disable-next-line no-unused-vars
const addon = require(`./build/${common.buildType}/test_general`);

assert.strictEqual(addon.testNapiRun('(41.92 + 0.08);'), 42,
'napi_run_script() works correctly');
const testCase = '(41.92 + 0.08);';
const expected = 42;
const actual = addon.testNapiRun(testCase);

assert.strictEqual(actual, expected);
assert.throws(() => addon.testNapiRun({ abc: 'def' }), /string was expected/);

0 comments on commit 2476ab9

Please sign in to comment.