-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathnaming.wast
More file actions
158 lines (135 loc) · 3.19 KB
/
naming.wast
File metadata and controls
158 lines (135 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
;; RUN: wast --assert default --snapshot tests/snapshots %
(component definition
(func (import "a"))
(component)
(instance (instantiate 0 (with "NotKebab-Case" (func 0))))
)
(assert_invalid
(component
(import "f" (func))
(instance (export "1" (func 0)))
)
"`1` is not in kebab case"
)
(assert_invalid
(component
(instance)
(alias export 0 "Xml" (func))
)
"instance 0 has no export named `Xml`"
)
(component definition
(type (flags "a-1-c"))
)
(assert_invalid
(component
(type (enum "NevEr"))
)
"enum tag name `NevEr` is not in kebab case"
)
(assert_invalid
(component
(type (record (field "GoNnA" string)))
)
"record field name `GoNnA` is not in kebab case"
)
(assert_invalid
(component
(type (variant (case "GIVe" string)))
)
"variant case name `GIVe` is not in kebab case"
)
(assert_invalid
(component
(type (func (param "yOu" string)))
)
"function parameter name `yOu` is not in kebab case"
)
(assert_invalid
(component
(type (component (export "NevEr" (func))))
)
"`NevEr` is not in kebab case"
)
(assert_invalid
(component
(type (component (import "GonnA" (func))))
)
"`GonnA` is not in kebab case"
)
(assert_invalid
(component
(type (instance (export "lET" (func))))
)
"`lET` is not in kebab case"
)
(assert_invalid
(component
(instance (export "YoU"))
)
"`YoU` is not in kebab case"
)
(assert_invalid
(component
(instance (import "DOWn"))
)
"`DOWn` is not in kebab case"
)
(assert_invalid
(component
(instance (import "A:b/c"))
)
"character `A` is not lowercase in package name/namespace"
)
(assert_invalid
(component
(instance (import "a:B/c"))
)
"character `B` is not lowercase in package name/namespace"
)
(component
(instance (import "a:b/c"))
(instance (import "a1:b1/c"))
)
(component definition
(import "a" (type $a (sub resource)))
(import "[constructor]a" (func (result (own $a))))
)
(assert_invalid
(component
(import "a" (type $a (sub resource)))
(import "[method]a.a" (func (param "self" (borrow $a))))
)
"import name `[method]a.a` conflicts with previous name `a`")
(assert_invalid
(component
(import "a" (type $a (sub resource)))
(import "[static]a.a" (func))
)
"import name `[static]a.a` conflicts with previous name `a`")
;; [implements=<...>] strong-uniqueness tests
;; Valid: two [implements=<...>] with different labels are strongly-unique
(component definition
(import "[implements=<a:b/c>]one" (instance))
(import "[implements=<a:b/c>]two" (instance))
)
;; Valid: [implements=<...>] and a bare interface name are strongly-unique
;; (different name kinds: plainname vs interfacename)
(component definition
(import "a:b/c" (instance))
(import "[implements=<a:b/c>]alt" (instance))
)
;; Invalid: two [implements=<...>] with the same label conflict
(assert_invalid
(component
(import "[implements=<a:b/c>]name" (instance))
(import "[implements=<x:y/z>]name" (instance))
)
"conflicts with previous name")
;; Invalid: [implements=<...>] label conflicts with a bare plain name
(assert_invalid
(component
(import "name" (func))
(import "[implements=<a:b/c>]name" (instance))
)
"conflicts with previous name")