test262-automation dbc101606b Import test changes from JavaScriptCore (#1698)
* [javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha 8a25978f29 on Tue Aug 28 2018 18:16:05 GMT+0000 (Coordinated Universal Time)

* [javascriptcore-test262-automation] Updated curation log with latest revision sha's from export and changed files.
    sourceRevisionAtLastExport: 8a25978f29 targetRevisionAtLastExport: 70dc33467
2018-08-31 14:46:07 -04:00

61 lines
1.9 KiB
JavaScript

import * as assert from '../assert.js';
import Builder from '../Builder.js';
assert.isFunction(WebAssembly.compile);
assert.isFunction(WebAssembly.__proto__.compile);
assert.eq(WebAssembly.compile.length, 1);
async function testPromiseAPI() {
{
// Can't declare more than one memory.
const builder = (new Builder())
.Type().End()
.Import().Memory("imp", "memory", {initial: 20}).End()
.Function().End()
.Memory().InitialMaxPages(1, 1).End()
.Export().End()
.Code()
.End();
try {
await WebAssembly.compile(builder.WebAssembly().get());
} catch(e) {
assert.truthy(e instanceof WebAssembly.CompileError);
assert.truthy(e.message === "WebAssembly.Module doesn't parse at byte 34: there can at most be one Memory section for now");
}
}
{
try {
await WebAssembly.compile();
} catch(e) {
assert.truthy(e instanceof TypeError);
assert.eq(e.message, "first argument must be an ArrayBufferView or an ArrayBuffer (evaluating 'WebAssembly.compile()')");
}
}
{
try {
await WebAssembly.compile(20);
} catch(e) {
assert.truthy(e instanceof TypeError);
assert.eq(e.message, "first argument must be an ArrayBufferView or an ArrayBuffer (evaluating 'WebAssembly.compile(20)')");
}
}
{
const builder = (new Builder())
.Type().End()
.Import().Memory("imp", "memory", {initial: 20}).End()
.Function().End()
.Export().End()
.Code()
.End();
let module = await WebAssembly.compile(builder.WebAssembly().get());
assert.truthy(module instanceof WebAssembly.Module);
}
}
assert.asyncTest(testPromiseAPI());