Debian Codegraph @

tests/cli/component-model/naming.wast

raw
1 ;; RUN: wast --assert default --snapshot tests/snapshots %
2
3 (component
4 (func (import "a"))
5 (component)
6 (instance (instantiate 0 (with "NotKebab-Case" (func 0))))
7 )
8
9 (assert_invalid
10 (component
11 (import "f" (func))
12 (instance (export "1" (func 0)))
13 )
14 "`1` is not in kebab case"
15 )
16
17 (assert_invalid
18 (component
19 (instance)
20 (alias export 0 "Xml" (func))
21 )
22 "instance 0 has no export named `Xml`"
23 )
24
25 (assert_invalid
26 (component
27 (type (flags "a-1-c"))
28 )
29 "flag name `a-1-c` is not in kebab case"
30 )
31
32 (assert_invalid
33 (component
34 (type (enum "NevEr"))
35 )
36 "enum tag name `NevEr` is not in kebab case"
37 )
38
39 (assert_invalid
40 (component
41 (type (record (field "GoNnA" string)))
42 )
43 "record field name `GoNnA` is not in kebab case"
44 )
45
46 (assert_invalid
47 (component
48 (type (variant (case "GIVe" string)))
49 )
50 "variant case name `GIVe` is not in kebab case"
51 )
52
53
54 (assert_invalid
55 (component
56 (type (func (param "yOu" string)))
57 )
58 "function parameter name `yOu` is not in kebab case"
59 )
60
61 (assert_invalid
62 (component
63 (type (component (export "NevEr" (func))))
64 )
65 "`NevEr` is not in kebab case"
66 )
67
68 (assert_invalid
69 (component
70 (type (component (import "GonnA" (func))))
71 )
72 "`GonnA` is not in kebab case"
73 )
74
75 (assert_invalid
76 (component
77 (type (instance (export "lET" (func))))
78 )
79 "`lET` is not in kebab case"
80 )
81
82 (assert_invalid
83 (component
84 (instance (export "YoU"))
85 )
86 "`YoU` is not in kebab case"
87 )
88
89 (assert_invalid
90 (component
91 (instance (import "DOWn"))
92 )
93 "`DOWn` is not in kebab case"
94 )
95
96 (assert_invalid
97 (component
98 (instance (import "A:b/c"))
99 )
100 "character `A` is not lowercase in package name/namespace"
101 )
102 (assert_invalid
103 (component
104 (instance (import "a:B/c"))
105 )
106 "character `B` is not lowercase in package name/namespace"
107 )
108 (component
109 (instance (import "a:b/c"))
110 (instance (import "a1:b1/c"))
111 )
112
113 (component
114 (import "a" (type $a (sub resource)))
115 (import "[constructor]a" (func (result (own $a))))
116 )
117
118 (assert_invalid
119 (component
120 (import "a" (type $a (sub resource)))
121 (import "[method]a.a" (func (param "self" (borrow $a))))
122 )
123 "import name `[method]a.a` conflicts with previous name `a`")
124
125 (assert_invalid
126 (component
127 (import "a" (type $a (sub resource)))
128 (import "[static]a.a" (func))
129 )
130 "import name `[static]a.a` conflicts with previous name `a`")