Debian Codegraph @

tests/cli/importize.wit

raw
1 // RUN[simple]: component wit --importize-world simple %
2 // RUN[simple-rename]: component wit --importize-world simple-rename --importize-out-world-name test-rename %
3 // RUN[simple-component]: component embed --dummy --world simple % | \
4 // component wit --importize
5 // RUN[with-deps]: component wit --importize-world with-deps %
6 // RUN[simple-toplevel]: component wit --importize-world simple-toplevel %
7 // RUN[toplevel-deps]: component wit --importize-world toplevel-deps %
8 // FAIL[fail1]: component wit --importize-world fail1 %
9 // RUN[trim-imports]: component wit --importize-world trim-imports %
10 // RUN[tricky-import]: component wit --importize-world tricky-import %
11
12 package importize:importize;
13
14 interface t {
15 resource r;
16 }
17 interface bar {
18 use t.{r};
19 record foo {
20 x: string
21 }
22 importize: func(name: r);
23 }
24
25 interface qux {
26 use bar.{foo};
27 blah: func(boo: foo);
28 }
29
30 interface something-else-dep {
31 type t = u32;
32 }
33
34 world simple {
35 export t;
36 }
37
38 world simple-rename {
39 export t;
40 }
41
42 world with-deps {
43 export qux;
44 }
45
46 world simple-toplevel {
47 export foo: func();
48 export something: interface {
49 foo: func();
50 }
51 }
52
53 world toplevel-deps {
54 type s = u32;
55 export bar: func() -> s;
56 export something-else: interface {
57 use something-else-dep.{t};
58 bar: func() -> t;
59 }
60 }
61
62 world fail1 {
63 type foo = u32;
64 export foo: func() -> foo;
65 }
66
67 interface a {}
68 interface b {}
69
70 world trim-imports {
71 import a;
72 import foo: func();
73 import bar: interface {}
74 type t = u32;
75 export b;
76 }
77
78 interface with-dep {
79 type t = u32;
80 }
81
82 world tricky-import {
83 use with-dep.{t};
84 export f: func() -> t;
85 }