Extends the Wasm ESM Integration for importing WebAssembly modules in either the source phase or instance phase to support importing static JS string constants from the special import name `wasm:js/string-constants`. PR-URL: https://github.com/nodejs/node/pull/62198 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
9 lines
442 B
JavaScript
9 lines
442 B
JavaScript
// Test fixture for js-string builtins support
|
|
import { strictEqual } from 'node:assert';
|
|
import * as wasmExports from './js-string-builtins.wasm';
|
|
|
|
strictEqual(wasmExports.getLength('hello'), 5);
|
|
strictEqual(wasmExports.concatStrings('hello', ' world'), 'hello world');
|
|
strictEqual(wasmExports.compareStrings('test', 'test'), 1);
|
|
strictEqual(wasmExports.compareStrings('test', 'different'), 0);
|
|
strictEqual(wasmExports.getHello(), 'hello');
|