@@ -5,6 +5,29 @@ function addxy(x, y) {
5
5
return x + y
6
6
}
7
7
8
+ test ( ( ) => {
9
+ assert_implements ( WebAssembly . Function , "WebAssembly.Function is not implemented" ) ;
10
+ assert_function_name ( WebAssembly . Function , "Function" , "WebAssembly.Function" ) ;
11
+ } , "name" ) ;
12
+
13
+ test ( ( ) => {
14
+ assert_implements ( WebAssembly . Function , "WebAssembly.Function is not implemented" ) ;
15
+ assert_function_length ( WebAssembly . Function , 2 , "WebAssembly.Function" ) ;
16
+ } , "length" ) ;
17
+
18
+ test ( ( ) => {
19
+ assert_implements ( WebAssembly . Function , "WebAssembly.Function is not implemented" ) ;
20
+ assert_throws_js ( TypeError , ( ) => new WebAssembly . Function ( ) ) ;
21
+ const argument = { parameters : [ ] , results : [ ] } ;
22
+ assert_throws_js ( TypeError , ( ) => new WebAssembly . Function ( argument ) ) ;
23
+ } , "Too few arguments" ) ;
24
+
25
+ test ( ( ) => {
26
+ assert_implements ( WebAssembly . Function , "WebAssembly.Function is not implemented" ) ;
27
+ const arguments = [ { parameters : [ "i32" , "i32" ] , results : [ "i32" ] } , addxy ] ;
28
+ assert_throws_js ( TypeError , ( ) => WebAssembly . Function ( ...arguments ) ) ;
29
+ } , "Calling" ) ;
30
+
8
31
test ( ( ) => {
9
32
assert_implements ( WebAssembly . Function , "WebAssembly.Function is not implemented" ) ;
10
33
var fun = new WebAssembly . Function ( { parameters : [ "i32" , "i32" ] , results : [ "i32" ] } , addxy ) ;
0 commit comments