Remove the ability to run tests via webkit-patch
[WebKit-https.git] / JSTests / wasm / js-api / validate.js
1 import * as assert from '../assert.js';
2 import Builder from '../Builder.js';
3
4 assert.isFunction(WebAssembly.validate);
5 assert.truthy(WebAssembly.hasOwnProperty('validate'));
6 assert.eq(WebAssembly.validate.length, 1);
7
8 {
9     const builder = (new Builder())
10         .Type().End()
11         .Import().Memory("imp", "memory", {initial: 20}).End()
12         .Function().End()
13         .Memory().InitialMaxPages(1, 1).End()
14         .Export().End()
15         .Code()
16         .End();
17
18     assert.truthy(!WebAssembly.validate(builder.WebAssembly().get()));
19 }
20
21 {
22     const builder = (new Builder())
23         .Type().End()
24         .Import().Memory("imp", "memory", {initial: 20}).End()
25         .Function().End()
26         .Export().End()
27         .Code()
28         .End();
29
30     assert.truthy(WebAssembly.validate(builder.WebAssembly().get()));
31 }
32
33 {
34     const builder = (new Builder());
35     builder.setChecked(false);
36
37     builder.Type().End()
38         .Import().Memory("imp", "memory", {initial: 20}).End()
39         .Unknown("test").End()
40         .Import().Memory("imp", "memory", {initial: 20}).End()
41         .Function().End()
42         .Export().End()
43         .Code()
44         .End();
45
46     assert.falsy(WebAssembly.validate(builder.WebAssembly().get()));
47 }