github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/v2/testdata/exports.wast (about) 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 (module 29 (type (;0;) (func (result i32))) 30 (func (;0;) (type 0) (result i32) i32.const 42) 31 (export "a" (func 0)) 32 (export "b" (func 0)) 33 (export "c" (func 0))) 34 (assert_return (invoke "a") (i32.const 42)) 35 (assert_return (invoke "b") (i32.const 42)) 36 (assert_return (invoke "c") (i32.const 42)) 37 38 (assert_invalid 39 (module (export "a" (func 0))) 40 "unknown function" 41 ) 42 (assert_invalid 43 (module (func) (export "a" (func 1))) 44 "unknown function" 45 ) 46 (assert_invalid 47 (module (import "spectest" "print_i32" (func (param i32))) (export "a" (func 1))) 48 "unknown function" 49 ) 50 (assert_invalid 51 (module (func) (export "a" (func 0)) (export "a" (func 0))) 52 "duplicate export name" 53 ) 54 (assert_invalid 55 (module (func) (func) (export "a" (func 0)) (export "a" (func 1))) 56 "duplicate export name" 57 ) 58 (assert_invalid 59 (module (func) (global i32 (i32.const 0)) (export "a" (func 0)) (export "a" (global 0))) 60 "duplicate export name" 61 ) 62 (assert_invalid 63 (module (func) (table 0 funcref) (export "a" (func 0)) (export "a" (table 0))) 64 "duplicate export name" 65 ) 66 (assert_invalid 67 (module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0))) 68 "duplicate export name" 69 ) 70 71 72 ;; Globals 73 74 (module (global i32 (i32.const 0)) (export "a" (global 0))) 75 (module (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 0))) 76 (module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 1))) 77 78 (module (global (export "a") i32 (i32.const 0))) 79 (module (global i32 (i32.const 0)) (export "a" (global 0))) 80 (module (global $a (export "a") i32 (i32.const 0))) 81 (module (global $a i32 (i32.const 0)) (export "a" (global $a))) 82 (module (export "a" (global 0)) (global i32 (i32.const 0))) 83 (module (export "a" (global $a)) (global $a i32 (i32.const 0))) 84 85 (module $Global 86 (export "e" (global $g)) 87 (global $g i32 (i32.const 42)) 88 ) 89 (assert_return (get "e") (i32.const 42)) 90 (assert_return (get $Global "e") (i32.const 42)) 91 (module) 92 (module $Other2) 93 (assert_return (get $Global "e") (i32.const 42)) 94 95 (assert_invalid 96 (module (export "a" (global 0))) 97 "unknown global" 98 ) 99 (assert_invalid 100 (module (global i32 (i32.const 0)) (export "a" (global 1))) 101 "unknown global" 102 ) 103 (assert_invalid 104 (module (import "spectest" "global_i32" (global i32)) (export "a" (global 1))) 105 "unknown global" 106 ) 107 (assert_invalid 108 (module (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 0))) 109 "duplicate export name" 110 ) 111 (assert_invalid 112 (module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 1))) 113 "duplicate export name" 114 ) 115 (assert_invalid 116 (module (global i32 (i32.const 0)) (func) (export "a" (global 0)) (export "a" (func 0))) 117 "duplicate export name" 118 ) 119 (assert_invalid 120 (module (global i32 (i32.const 0)) (table 0 funcref) (export "a" (global 0)) (export "a" (table 0))) 121 "duplicate export name" 122 ) 123 (assert_invalid 124 (module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0))) 125 "duplicate export name" 126 ) 127 128 129 ;; Tables 130 131 (module (table 0 funcref) (export "a" (table 0))) 132 (module (table 0 funcref) (export "a" (table 0)) (export "b" (table 0))) 133 (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "b" (table 1))) 134 135 (module (table (export "a") 0 funcref)) 136 (module (table (export "a") 0 1 funcref)) 137 (module (table 0 funcref) (export "a" (table 0))) 138 (module (table 0 1 funcref) (export "a" (table 0))) 139 (module (table $a (export "a") 0 funcref)) 140 (module (table $a (export "a") 0 1 funcref)) 141 (module (table $a 0 funcref) (export "a" (table $a))) 142 (module (table $a 0 1 funcref) (export "a" (table $a))) 143 (module (export "a" (table 0)) (table 0 funcref)) 144 (module (export "a" (table 0)) (table 0 1 funcref)) 145 (module (export "a" (table $a)) (table $a 0 funcref)) 146 (module (export "a" (table $a)) (table $a 0 1 funcref)) 147 148 (; TODO: access table ;) 149 150 (assert_invalid 151 (module (export "a" (table 0))) 152 "unknown table" 153 ) 154 (assert_invalid 155 (module (table 0 funcref) (export "a" (table 1))) 156 "unknown table" 157 ) 158 (assert_invalid 159 (module (import "spectest" "table" (table 10 20 funcref)) (export "a" (table 1))) 160 "unknown table" 161 ) 162 (assert_invalid 163 (module (table 0 funcref) (export "a" (table 0)) (export "a" (table 0))) 164 "duplicate export name" 165 ) 166 (assert_invalid 167 (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "a" (table 1))) 168 "duplicate export name" 169 ) 170 (assert_invalid 171 (module (table 0 funcref) (func) (export "a" (table 0)) (export "a" (func 0))) 172 "duplicate export name" 173 ) 174 (assert_invalid 175 (module (table 0 funcref) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0))) 176 "duplicate export name" 177 ) 178 (assert_invalid 179 (module (table 0 funcref) (memory 0) (export "a" (table 0)) (export "a" (memory 0))) 180 "duplicate export name" 181 ) 182 183 184 ;; Memories 185 186 (module (memory 0) (export "a" (memory 0))) 187 (module (memory 0) (export "a" (memory 0)) (export "b" (memory 0))) 188 ;; No multiple memories yet. 189 ;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1))) 190 191 (module (memory (export "a") 0)) 192 (module (memory (export "a") 0 1)) 193 (module (memory 0) (export "a" (memory 0))) 194 (module (memory 0 1) (export "a" (memory 0))) 195 (module (memory $a (export "a") 0)) 196 (module (memory $a (export "a") 0 1)) 197 (module (memory $a 0) (export "a" (memory $a))) 198 (module (memory $a 0 1) (export "a" (memory $a))) 199 (module (export "a" (memory 0)) (memory 0)) 200 (module (export "a" (memory 0)) (memory 0 1)) 201 (module (export "a" (memory $a)) (memory $a 0)) 202 (module (export "a" (memory $a)) (memory $a 0 1)) 203 204 (; TODO: access memory ;) 205 206 (assert_invalid 207 (module (export "a" (memory 0))) 208 "unknown memory" 209 ) 210 (assert_invalid 211 (module (memory 0) (export "a" (memory 1))) 212 "unknown memory" 213 ) 214 (assert_invalid 215 (module (import "spectest" "memory" (memory 1 2)) (export "a" (memory 1))) 216 "unknown memory" 217 ) 218 (assert_invalid 219 (module (memory 0) (export "a" (memory 0)) (export "a" (memory 0))) 220 "duplicate export name" 221 ) 222 ;; No multiple memories yet. 223 ;; (assert_invalid 224 ;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1))) 225 ;; "duplicate export name" 226 ;; ) 227 (assert_invalid 228 (module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0))) 229 "duplicate export name" 230 ) 231 (assert_invalid 232 (module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0))) 233 "duplicate export name" 234 ) 235 (assert_invalid 236 (module (memory 0) (table 0 funcref) (export "a" (memory 0)) (export "a" (table 0))) 237 "duplicate export name" 238 )