xref: /third_party/node/test/js-native-api/test_general/testNapiRun.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/js-native-api/test_general/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci// `addon` is referenced through the eval expression in testFile
71cb0ef41Sopenharmony_ciconst addon = require(`./build/${common.buildType}/test_general`);
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst testCase = '(41.92 + 0.08);';
101cb0ef41Sopenharmony_ciconst expected = 42;
111cb0ef41Sopenharmony_ciconst actual = addon.testNapiRun(testCase);
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciassert.strictEqual(actual, expected);
141cb0ef41Sopenharmony_ciassert.throws(() => addon.testNapiRun({ abc: 'def' }), /string was expected/);
15

Indexes created Thu Nov 07 10:32:03 CST 2024