Skip to content

Commit d086240

Browse files
authored
tests: Update tests in wit-component (#190)
This commit applies the new instance formatting to the `component.wat` files in wit-component
1 parent a963df9 commit d086240

File tree

6 files changed

+144
-47
lines changed

6 files changed

+144
-47
lines changed

Cargo.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wit-component/tests/components/exports/component.wat

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,20 @@
6565
(func (;5;) (canon.lift (type 3) (func 2)))
6666
(alias export (instance 0) "bar#a" (func (;6;)))
6767
(func (;7;) (canon.lift (type 5) (func 6)))
68-
(instance (;1;) (export "a" (func 7)))
68+
(instance (;1;)
69+
(export "a" (func 7))
70+
)
6971
(alias export (instance 0) "foo#a" (func (;8;)))
7072
(alias export (instance 0) "foo#b" (func (;9;)))
7173
(alias export (instance 0) "foo#c" (func (;10;)))
7274
(func (;11;) (canon.lift (type 0) (func 8)))
7375
(func (;12;) (canon.lift (type 7) utf8 (into (instance 0)) (func 9)))
7476
(func (;13;) (canon.lift (type 8) utf8 (into (instance 0)) (func 10)))
75-
(instance (;2;) (export "a" (func 11)) (export "b" (func 12)) (export "c" (func 13)))
77+
(instance (;2;)
78+
(export "a" (func 11))
79+
(export "b" (func 12))
80+
(export "c" (func 13))
81+
)
7682
(export "a" (func 3))
7783
(export "b" (func 4))
7884
(export "c" (func 5))

crates/wit-component/tests/components/import-conflict/component.wat

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,33 @@
7878
(alias export (instance 3) "1" (func (;1;)))
7979
(alias export (instance 2) "a" (func (;2;)))
8080
(func (;3;) (canon.lower (func 2)))
81-
(instance (;4;) core (export "a" (func 0)))
82-
(instance (;5;) core (export "baz" (func 1)))
83-
(instance (;6;) core (export "a" (func 3)))
84-
(instance (;7;) (instantiate (module 0) (with "bar" (instance 4)) (with "baz" (instance 5)) (with "foo" (instance 6))))
81+
(instance (;4;) core
82+
(export "a" (func 0))
83+
)
84+
(instance (;5;) core
85+
(export "baz" (func 1))
86+
)
87+
(instance (;6;) core
88+
(export "a" (func 3))
89+
)
90+
(instance (;7;) (instantiate (module 0)
91+
(with "bar" (instance 4))
92+
(with "baz" (instance 5))
93+
(with "foo" (instance 6))
94+
)
95+
)
8596
(alias export (instance 3) "$imports" (table (;0;)))
8697
(alias export (instance 0) "a" (func (;4;)))
8798
(alias export (instance 1) "baz" (func (;5;)))
8899
(func (;6;) (canon.lower utf8 (into (instance 7)) (func 4)))
89100
(func (;7;) (canon.lower (into (instance 7)) (func 5)))
90-
(instance (;8;) core (export "$imports" (table 0)) (export "0" (func 6)) (export "1" (func 7)))
91-
(instance (;9;) (instantiate (module 2) (with "" (instance 8))))
101+
(instance (;8;) core
102+
(export "$imports" (table 0))
103+
(export "0" (func 6))
104+
(export "1" (func 7))
105+
)
106+
(instance (;9;) (instantiate (module 2)
107+
(with "" (instance 8))
108+
)
109+
)
92110
)

crates/wit-component/tests/components/import-export/component.wat

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,34 @@
6060
)
6161
(instance (;1;) (instantiate (module 1)))
6262
(alias export (instance 1) "0" (func (;0;)))
63-
(instance (;2;) core (export "a" (func 0)))
64-
(instance (;3;) (instantiate (module 0) (with "foo" (instance 2))))
63+
(instance (;2;) core
64+
(export "a" (func 0))
65+
)
66+
(instance (;3;) (instantiate (module 0)
67+
(with "foo" (instance 2))
68+
)
69+
)
6570
(alias export (instance 1) "$imports" (table (;0;)))
6671
(alias export (instance 0) "a" (func (;1;)))
6772
(func (;2;) (canon.lower utf8 (into (instance 3)) (func 1)))
68-
(instance (;4;) core (export "$imports" (table 0)) (export "0" (func 2)))
69-
(instance (;5;) (instantiate (module 2) (with "" (instance 4))))
73+
(instance (;4;) core
74+
(export "$imports" (table 0))
75+
(export "0" (func 2))
76+
)
77+
(instance (;5;) (instantiate (module 2)
78+
(with "" (instance 4))
79+
)
80+
)
7081
(alias export (instance 3) "a" (func (;3;)))
7182
(func (;4;) (canon.lift (type 3) utf8 (into (instance 3)) (func 3)))
7283
(alias export (instance 3) "bar#a" (func (;5;)))
7384
(alias export (instance 3) "bar#b" (func (;6;)))
7485
(func (;7;) (canon.lift (type 4) (func 5)))
7586
(func (;8;) (canon.lift (type 0) utf8 (into (instance 3)) (func 6)))
76-
(instance (;6;) (export "a" (func 7)) (export "b" (func 8)))
87+
(instance (;6;)
88+
(export "a" (func 7))
89+
(export "b" (func 8))
90+
)
7791
(export "a" (func 4))
7892
(export "bar" (instance 6))
7993
)

crates/wit-component/tests/components/imports/component.wat

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,38 @@
111111
(func (;11;) (canon.lower (func 5)))
112112
(func (;12;) (canon.lower (func 6)))
113113
(func (;13;) (canon.lower (func 7)))
114-
(instance (;4;) core (export "bar1" (func 0)) (export "bar2" (func 8)))
115-
(instance (;5;) core (export "baz1" (func 2)) (export "baz2" (func 9)) (export "baz3" (func 10)))
116-
(instance (;6;) core (export "foo1" (func 11)) (export "foo2" (func 12)) (export "foo3" (func 13)))
117-
(instance (;7;) (instantiate (module 0) (with "bar" (instance 4)) (with "baz" (instance 5)) (with "foo" (instance 6))))
114+
(instance (;4;) core
115+
(export "bar1" (func 0))
116+
(export "bar2" (func 8))
117+
)
118+
(instance (;5;) core
119+
(export "baz1" (func 2))
120+
(export "baz2" (func 9))
121+
(export "baz3" (func 10))
122+
)
123+
(instance (;6;) core
124+
(export "foo1" (func 11))
125+
(export "foo2" (func 12))
126+
(export "foo3" (func 13))
127+
)
128+
(instance (;7;) (instantiate (module 0)
129+
(with "bar" (instance 4))
130+
(with "baz" (instance 5))
131+
(with "foo" (instance 6))
132+
)
133+
)
118134
(alias export (instance 3) "$imports" (table (;0;)))
119135
(alias export (instance 0) "bar1" (func (;14;)))
120136
(alias export (instance 1) "baz1" (func (;15;)))
121137
(func (;16;) (canon.lower utf8 (into (instance 7)) (func 14)))
122138
(func (;17;) (canon.lower utf8 (into (instance 7)) (func 15)))
123-
(instance (;8;) core (export "$imports" (table 0)) (export "0" (func 16)) (export "1" (func 17)))
124-
(instance (;9;) (instantiate (module 2) (with "" (instance 8))))
139+
(instance (;8;) core
140+
(export "$imports" (table 0))
141+
(export "0" (func 16))
142+
(export "1" (func 17))
143+
)
144+
(instance (;9;) (instantiate (module 2)
145+
(with "" (instance 8))
146+
)
147+
)
125148
)

crates/wit-component/tests/components/lower-options/component.wat

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,28 @@
226226
(func (;18;) (canon.lower (func 5)))
227227
(func (;19;) (canon.lower (func 9)))
228228
(func (;20;) (canon.lower (func 13)))
229-
(instance (;2;) core (export "a" (func 16)) (export "b" (func 1)) (export "c" (func 2)) (export "d" (func 3)) (export "e" (func 17)) (export "f" (func 18)) (export "g" (func 6)) (export "h" (func 7)) (export "i" (func 8)) (export "j" (func 19)) (export "k" (func 10)) (export "l" (func 11)) (export "m" (func 12)) (export "n" (func 20)) (export "o" (func 14)) (export "p" (func 15)))
230-
(instance (;3;) (instantiate (module 0) (with "foo" (instance 2))))
229+
(instance (;2;) core
230+
(export "a" (func 16))
231+
(export "b" (func 1))
232+
(export "c" (func 2))
233+
(export "d" (func 3))
234+
(export "e" (func 17))
235+
(export "f" (func 18))
236+
(export "g" (func 6))
237+
(export "h" (func 7))
238+
(export "i" (func 8))
239+
(export "j" (func 19))
240+
(export "k" (func 10))
241+
(export "l" (func 11))
242+
(export "m" (func 12))
243+
(export "n" (func 20))
244+
(export "o" (func 14))
245+
(export "p" (func 15))
246+
)
247+
(instance (;3;) (instantiate (module 0)
248+
(with "foo" (instance 2))
249+
)
250+
)
231251
(alias export (instance 1) "$imports" (table (;0;)))
232252
(alias export (instance 0) "b" (func (;21;)))
233253
(alias export (instance 0) "c" (func (;22;)))
@@ -251,6 +271,22 @@
251271
(func (;40;) (canon.lower (into (instance 3)) (func 29)))
252272
(func (;41;) (canon.lower utf8 (into (instance 3)) (func 30)))
253273
(func (;42;) (canon.lower (into (instance 3)) (func 31)))
254-
(instance (;4;) core (export "$imports" (table 0)) (export "0" (func 32)) (export "1" (func 33)) (export "2" (func 34)) (export "3" (func 35)) (export "4" (func 36)) (export "5" (func 37)) (export "6" (func 38)) (export "7" (func 39)) (export "8" (func 40)) (export "9" (func 41)) (export "10" (func 42)))
255-
(instance (;5;) (instantiate (module 2) (with "" (instance 4))))
274+
(instance (;4;) core
275+
(export "$imports" (table 0))
276+
(export "0" (func 32))
277+
(export "1" (func 33))
278+
(export "2" (func 34))
279+
(export "3" (func 35))
280+
(export "4" (func 36))
281+
(export "5" (func 37))
282+
(export "6" (func 38))
283+
(export "7" (func 39))
284+
(export "8" (func 40))
285+
(export "9" (func 41))
286+
(export "10" (func 42))
287+
)
288+
(instance (;5;) (instantiate (module 2)
289+
(with "" (instance 4))
290+
)
291+
)
256292
)

0 commit comments

Comments
 (0)