Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@v1.1.0
with:
version: v1.205.0
version: v1.210.0

- name: Set up Go
uses: actions/setup-go@v5.0.1
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Set up wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@v1.1.0
with:
version: v1.205.0
version: v1.210.0

- name: Set up Go
uses: actions/setup-go@v5.0.1
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Set up wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@v1.1.0
with:
version: v1.205.0
version: v1.210.0

- name: Set up Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1.1.0
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
wit_files = $(sort $(shell find testdata -name '*.wit' ! -name '*.golden.*'))

.PHONY: json
json: $(wit_files)

.PHONY: $(wit_files)
$(wit_files):
wasm-tools component wit -j --all-features $@ > $@.json
81 changes: 77 additions & 4 deletions testdata/escape/escaped-names.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"name": "world",
"imports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand All @@ -22,7 +26,8 @@
"error": 0,
"export": 4,
"enum": 5,
"record": 7
"record": 7,
"variant": 8
},
"functions": {
"func": {
Expand All @@ -36,7 +41,7 @@
],
"results": [
{
"type": 8
"type": 9
}
]
}
Expand Down Expand Up @@ -193,6 +198,74 @@
"interface": 0
}
},
{
"name": "variant",
"kind": {
"variant": {
"cases": [
{
"name": "enum",
"type": 7
},
{
"name": "export",
"type": 7
},
{
"name": "flags",
"type": 7
},
{
"name": "func",
"type": 7
},
{
"name": "import",
"type": 7
},
{
"name": "include",
"type": 7
},
{
"name": "interface",
"type": 7
},
{
"name": "package",
"type": 7
},
{
"name": "record",
"type": 7
},
{
"name": "resource",
"type": 7
},
{
"name": "static",
"type": 7
},
{
"name": "type",
"type": 7
},
{
"name": "variant",
"type": 7
},
{
"name": "world",
"type": 7
}
]
}
},
"owner": {
"interface": 0
}
},
{
"name": null,
"kind": {
Expand Down
16 changes: 16 additions & 0 deletions testdata/escape/escaped-names.wit.json.golden.wit
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ interface %interface {
%enum: %enum,
%result: result<string, error>,
}
variant %variant {
%enum(%record),
%export(%record),
%flags(%record),
%func(%record),
%import(%record),
%include(%record),
%interface(%record),
%package(%record),
%record(%record),
%resource(%record),
%static(%record),
%type(%record),
%variant(%record),
%world(%record),
}
%func: func(rec: %record) -> result<%export, error>;
}

Expand Down
4 changes: 3 additions & 1 deletion testdata/example/aqua.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"imports": {},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
4 changes: 3 additions & 1 deletion testdata/example/exported-list.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"imports": {},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
4 changes: 3 additions & 1 deletion testdata/example/exported-resource.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"imports": {},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
4 changes: 3 additions & 1 deletion testdata/example/flat-variant.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"name": "imports",
"imports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"exports": {},
Expand Down
8 changes: 6 additions & 2 deletions testdata/example/non-flat-params.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"name": "imports",
"imports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
4 changes: 3 additions & 1 deletion testdata/example/post-return.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"imports": {},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
8 changes: 6 additions & 2 deletions testdata/example/resource-in-world.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"name": "imports",
"imports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
}
},
"package": 0
Expand Down
39 changes: 33 additions & 6 deletions testdata/example/use-of-export.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
"imports": {},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
},
"interface-1": {
"interface": 1
"interface": {
"id": 1
}
}
},
"package": 0
Expand All @@ -20,13 +24,27 @@
"types": {
"res": 0
},
"functions": {},
"functions": {
"[method]res.do": {
"name": "[method]res.do",
"kind": {
"method": 0
},
"params": [
{
"name": "self",
"type": 1
}
],
"results": []
}
},
"package": 0
},
{
"name": "f",
"types": {
"res": 1
"res": 2
},
"functions": {
"report": {
Expand All @@ -35,7 +53,7 @@
"params": [
{
"name": "r",
"type": 2
"type": 3
}
],
"results": []
Expand All @@ -52,6 +70,15 @@
"interface": 0
}
},
{
"name": null,
"kind": {
"handle": {
"borrow": 0
}
},
"owner": null
},
{
"name": "res",
"kind": {
Expand All @@ -65,7 +92,7 @@
"name": null,
"kind": {
"handle": {
"own": 1
"own": 2
}
},
"owner": null
Expand Down
4 changes: 3 additions & 1 deletion testdata/example/use-of-export.wit.json.golden.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package example:uses;

interface a {
resource res;
resource res {
do: func();
}
}

interface f {
Expand Down
20 changes: 15 additions & 5 deletions testdata/example/use-of-import-or-export.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,31 @@
"name": "default",
"imports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
},
"interface-1": {
"interface": 1
"interface": {
"id": 1
}
}
},
"exports": {
"interface-0": {
"interface": 0
"interface": {
"id": 0
}
},
"interface-1": {
"interface": 1
"interface": {
"id": 1
}
},
"interface-2": {
"interface": 2
"interface": {
"id": 2
}
}
},
"package": 0
Expand Down
Loading