Skip to content

Commit 21798e6

Browse files
committed
A test of WasmMemoryObject::Buffer().
1 parent 092e665 commit 21798e6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

graal-nodejs/test/graal/unit/wasm_memory.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,11 @@ EXPORT_TO_JS(CheckBackingStore) {
9797
args.GetReturnValue().Set(true);
9898
}
9999

100+
// WasmMemoryObject::Buffer
101+
102+
EXPORT_TO_JS(Buffer) {
103+
Local<WasmMemoryObject> memory = args[0].As<WasmMemoryObject>();
104+
args.GetReturnValue().Set(memory->Buffer());
105+
}
106+
100107
#undef SUITE

graal-nodejs/test/graal/unit/wasm_memory.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ if (typeof WebAssembly !== 'undefined') {
117117
}));
118118
assert.strictEqual(calls, 6);
119119
}).timeout(5000);
120+
121+
it('Buffer() should return the underlying ArrayBuffer', function() {
122+
let memory = new WebAssembly.Memory({ initial: 1 });
123+
assert.strictEqual(module.WasmMemory_Buffer(memory), memory.buffer);
124+
});
120125
});
121126
});
122127
}

0 commit comments

Comments
 (0)