ladybird/Tests/LibWeb/Text/input/Wasm/WebAssembly-grow.html
Shannon Booth 9dc2b0bba3 LibWeb: Add a basic test for [EnforceRange]
This is a basic test - but does cover the two bugs in the previous
two commits.
2024-03-30 21:21:23 +01:00

19 lines
563 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
const memory = new WebAssembly.Memory({
initial: 10,
maximum: 100,
});
println(`Made memory ${memory} with buffer ${memory.buffer} (byteLength ${memory.buffer.byteLength})`);
memory.grow(5);
println(`After growing buffer (byteLength ${memory.buffer.byteLength})`);
try {
memory.grow(4294967296); // 1 over max value.
} catch (e) {
println(`Got error: '${e}'`);
}
});
</script>