| 1 |
;; Functions |
| 2 |
|
| 3 |
(module (func) (export "a" (func 0))) |
| 4 |
(module (func) (export "a" (func 0)) (export "b" (func 0))) |
| 5 |
(module (func) (func) (export "a" (func 0)) (export "b" (func 1))) |
| 6 |
|
| 7 |
(module (func (export "a"))) |
| 8 |
(module (func (export "a") (export "b") (export "c"))) |
| 9 |
(module (func (export "a") (export "b") (param i32))) |
| 10 |
(module (func) (export "a" (func 0))) |
| 11 |
(module (func $a (export "a"))) |
| 12 |
(module (func $a) (export "a" (func $a))) |
| 13 |
(module (export "a" (func 0)) (func)) |
| 14 |
(module (export "a" (func $a)) (func $a)) |
| 15 |
|
| 16 |
(module $Func |
| 17 |
(export "e" (func $f)) |
| 18 |
(func $f (param $n i32) (result i32) |
| 19 |
(return (i32.add (local.get $n) (i32.const 1))) |
| 20 |
) |
| 21 |
) |
| 22 |
(assert_return (invoke "e" (i32.const 42)) (i32.const 43)) |
| 23 |
(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43)) |
| 24 |
(module) |
| 25 |
(module $Other1) |
| 26 |
(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43)) |
| 27 |
|
| 28 |
(assert_invalid |
| 29 |
(module (func) (export "a" (func 1))) |
| 30 |
"unknown function" |
| 31 |
) |
| 32 |
(assert_invalid |
| 33 |
(module (func) (export "a" (func 0)) (export "a" (func 0))) |
| 34 |
"duplicate export name" |
| 35 |
) |
| 36 |
(assert_invalid |
| 37 |
(module (func) (func) (export "a" (func 0)) (export "a" (func 1))) |
| 38 |
"duplicate export name" |
| 39 |
) |
| 40 |
(assert_invalid |
| 41 |
(module (func) (global i32 (i32.const 0)) (export "a" (func 0)) (export "a" (global 0))) |
| 42 |
"duplicate export name" |
| 43 |
) |
| 44 |
(assert_invalid |
| 45 |
(module (func) (table 0 funcref) (export "a" (func 0)) (export "a" (table 0))) |
| 46 |
"duplicate export name" |
| 47 |
) |
| 48 |
(assert_invalid |
| 49 |
(module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0))) |
| 50 |
"duplicate export name" |
| 51 |
) |
| 52 |
|
| 53 |
|
| 54 |
;; Globals |
| 55 |
|
| 56 |
(module (global i32 (i32.const 0)) (export "a" (global 0))) |
| 57 |
(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 0))) |
| 58 |
(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 1))) |
| 59 |
|
| 60 |
(module (global (export "a") i32 (i32.const 0))) |
| 61 |
(module (global i32 (i32.const 0)) (export "a" (global 0))) |
| 62 |
(module (global $a (export "a") i32 (i32.const 0))) |
| 63 |
(module (global $a i32 (i32.const 0)) (export "a" (global $a))) |
| 64 |
(module (export "a" (global 0)) (global i32 (i32.const 0))) |
| 65 |
(module (export "a" (global $a)) (global $a i32 (i32.const 0))) |
| 66 |
|
| 67 |
(module $Global |
| 68 |
(export "e" (global $g)) |
| 69 |
(global $g i32 (i32.const 42)) |
| 70 |
) |
| 71 |
(assert_return (get "e") (i32.const 42)) |
| 72 |
(assert_return (get $Global "e") (i32.const 42)) |
| 73 |
(module) |
| 74 |
(module $Other2) |
| 75 |
(assert_return (get $Global "e") (i32.const 42)) |
| 76 |
|
| 77 |
(assert_invalid |
| 78 |
(module (global i32 (i32.const 0)) (export "a" (global 1))) |
| 79 |
"unknown global" |
| 80 |
) |
| 81 |
(assert_invalid |
| 82 |
(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 0))) |
| 83 |
"duplicate export name" |
| 84 |
) |
| 85 |
(assert_invalid |
| 86 |
(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 1))) |
| 87 |
"duplicate export name" |
| 88 |
) |
| 89 |
(assert_invalid |
| 90 |
(module (global i32 (i32.const 0)) (func) (export "a" (global 0)) (export "a" (func 0))) |
| 91 |
"duplicate export name" |
| 92 |
) |
| 93 |
(assert_invalid |
| 94 |
(module (global i32 (i32.const 0)) (table 0 funcref) (export "a" (global 0)) (export "a" (table 0))) |
| 95 |
"duplicate export name" |
| 96 |
) |
| 97 |
(assert_invalid |
| 98 |
(module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0))) |
| 99 |
"duplicate export name" |
| 100 |
) |
| 101 |
|
| 102 |
|
| 103 |
;; Tables |
| 104 |
|
| 105 |
(module (table 0 funcref) (export "a" (table 0))) |
| 106 |
(module (table 0 funcref) (export "a" (table 0)) (export "b" (table 0))) |
| 107 |
;; No multiple tables yet. |
| 108 |
;; (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "b" (table 1))) |
| 109 |
|
| 110 |
(module (table (export "a") 0 funcref)) |
| 111 |
(module (table (export "a") 0 1 funcref)) |
| 112 |
(module (table 0 funcref) (export "a" (table 0))) |
| 113 |
(module (table 0 1 funcref) (export "a" (table 0))) |
| 114 |
(module (table $a (export "a") 0 funcref)) |
| 115 |
(module (table $a (export "a") 0 1 funcref)) |
| 116 |
(module (table $a 0 funcref) (export "a" (table $a))) |
| 117 |
(module (table $a 0 1 funcref) (export "a" (table $a))) |
| 118 |
(module (export "a" (table 0)) (table 0 funcref)) |
| 119 |
(module (export "a" (table 0)) (table 0 1 funcref)) |
| 120 |
(module (export "a" (table $a)) (table $a 0 funcref)) |
| 121 |
(module (export "a" (table $a)) (table $a 0 1 funcref)) |
| 122 |
|
| 123 |
(; TODO: access table ;) |
| 124 |
|
| 125 |
(assert_invalid |
| 126 |
(module (table 0 funcref) (export "a" (table 1))) |
| 127 |
"unknown table" |
| 128 |
) |
| 129 |
(assert_invalid |
| 130 |
(module (table 0 funcref) (export "a" (table 0)) (export "a" (table 0))) |
| 131 |
"duplicate export name" |
| 132 |
) |
| 133 |
;; No multiple tables yet. |
| 134 |
;; (assert_invalid |
| 135 |
;; (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "a" (table 1))) |
| 136 |
;; "duplicate export name" |
| 137 |
;; ) |
| 138 |
(assert_invalid |
| 139 |
(module (table 0 funcref) (func) (export "a" (table 0)) (export "a" (func 0))) |
| 140 |
"duplicate export name" |
| 141 |
) |
| 142 |
(assert_invalid |
| 143 |
(module (table 0 funcref) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0))) |
| 144 |
"duplicate export name" |
| 145 |
) |
| 146 |
(assert_invalid |
| 147 |
(module (table 0 funcref) (memory 0) (export "a" (table 0)) (export "a" (memory 0))) |
| 148 |
"duplicate export name" |
| 149 |
) |
| 150 |
|
| 151 |
|
| 152 |
;; Memories |
| 153 |
|
| 154 |
(module (memory 0) (export "a" (memory 0))) |
| 155 |
(module (memory 0) (export "a" (memory 0)) (export "b" (memory 0))) |
| 156 |
;; No multiple memories yet. |
| 157 |
;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1))) |
| 158 |
|
| 159 |
(module (memory (export "a") 0)) |
| 160 |
(module (memory (export "a") 0 1)) |
| 161 |
(module (memory 0) (export "a" (memory 0))) |
| 162 |
(module (memory 0 1) (export "a" (memory 0))) |
| 163 |
(module (memory $a (export "a") 0)) |
| 164 |
(module (memory $a (export "a") 0 1)) |
| 165 |
(module (memory $a 0) (export "a" (memory $a))) |
| 166 |
(module (memory $a 0 1) (export "a" (memory $a))) |
| 167 |
(module (export "a" (memory 0)) (memory 0)) |
| 168 |
(module (export "a" (memory 0)) (memory 0 1)) |
| 169 |
(module (export "a" (memory $a)) (memory $a 0)) |
| 170 |
(module (export "a" (memory $a)) (memory $a 0 1)) |
| 171 |
|
| 172 |
(; TODO: access memory ;) |
| 173 |
|
| 174 |
(assert_invalid |
| 175 |
(module (memory 0) (export "a" (memory 1))) |
| 176 |
"unknown memory" |
| 177 |
) |
| 178 |
(assert_invalid |
| 179 |
(module (memory 0) (export "a" (memory 0)) (export "a" (memory 0))) |
| 180 |
"duplicate export name" |
| 181 |
) |
| 182 |
;; No multiple memories yet. |
| 183 |
;; (assert_invalid |
| 184 |
;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1))) |
| 185 |
;; "duplicate export name" |
| 186 |
;; ) |
| 187 |
(assert_invalid |
| 188 |
(module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0))) |
| 189 |
"duplicate export name" |
| 190 |
) |
| 191 |
(assert_invalid |
| 192 |
(module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0))) |
| 193 |
"duplicate export name" |
| 194 |
) |
| 195 |
(assert_invalid |
| 196 |
(module (memory 0) (table 0 funcref) (export "a" (memory 0)) (export "a" (table 0))) |
| 197 |
"duplicate export name" |
| 198 |
) |