test: improve error emssage reporting in testNapiRun.js

PR-URL: https://github.com/nodejs/node/pull/16821
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
pull/16779/merge
Paul Ashfield 2017-11-06 15:32:35 +00:00 committed by Rich Trott
parent 15fa9fca0c
commit 3ee524b14c
1 changed files with 5 additions and 2 deletions

View File

@ -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/);