Debian Codegraph @

tests/cli/component-model/export.wast

raw
1 ;; RUN: wast --assert default --snapshot tests/snapshots % -f cm-values
2
3 (assert_invalid
4 (component (export "" (instance 0)))
5 "index out of bounds")
6
7 (assert_invalid
8 (component (export "" (component 0)))
9 "index out of bounds")
10
11 (assert_invalid
12 (component (export "" (core module 0)))
13 "index out of bounds")
14
15 (assert_invalid
16 (component (export "" (func 0)))
17 "index out of bounds")
18
19 (assert_invalid
20 (component (export "" (value 0)))
21 "index out of bounds")
22
23 (component
24 (import "a" (instance $i))
25 (import "b" (core module $m))
26 (import "c" (component $c))
27 (import "d" (value $v string))
28 (import "e" (func $f))
29
30 (export "f" (instance $i))
31 (export "g" (core module $m))
32 (export "h" (component $c))
33 (export "i" (value $v))
34 (export "j" (func $f))
35 )
36
37 (assert_invalid
38 (component
39 (import "a" (value $v string))
40 (export "b" (value $v))
41 (export "c" (value $v))
42 )
43 "cannot be used more than once")
44
45
46 (component
47 (import "a" (func))
48 (export (interface "wasi:http/[email protected]") (func 0))
49 )
50
51 ;; import/exports can overlap on ids
52 (component
53 (import (interface "wasi:http/[email protected]") (func))
54 (export (interface "wasi:http/[email protected]") (func 0))
55 )
56
57 ;; cannot export some types of strings
58 (assert_invalid
59 (component (type (component (export "integrity=<sha256-a>" (func)))))
60 "not a valid export name")
61 (assert_invalid
62 (component (type (component (export "url=<x>" (func)))))
63 "not a valid export name")
64 (assert_invalid
65 (component (type (component (export "relative-url=<x>" (func)))))
66 "not a valid extern name")
67 (assert_invalid
68 (component (type (component (export "locked-dep=<a:b>" (func)))))
69 "not a valid export name")
70 (assert_invalid
71 (component (type (component (export "unlocked-dep=<a:b>" (func)))))
72 "not a valid export name")