diff options
| author | astrale-sharp <ash4567@outlook.fr> | 2023-08-21 15:17:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-21 15:17:16 +0200 |
| commit | 99ddbafc095695d278fba81d835e88ac23e9b990 (patch) | |
| tree | 6cfeff9b6ad6d5e31a6ffdbb9c2dbf32f6a963a6 /tests | |
| parent | 4b29bf6ff601970ff378d95f7f12db3bd64f95cf (diff) | |
Wasm plugin system (#1555)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compiler/plugin.typ | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/typ/compiler/plugin.typ b/tests/typ/compiler/plugin.typ new file mode 100644 index 00000000..aafbdaa1 --- /dev/null +++ b/tests/typ/compiler/plugin.typ @@ -0,0 +1,35 @@ +// Test WebAssembly plugins. +// Ref: false + +--- +#let p = plugin("/files/hello.wasm") +#test(p.hello(), bytes("Hello from wasm!!!")) +#test(p.double_it(bytes("hey!")), bytes("hey!.hey!")) +#test( + p.shuffle(bytes("value1"), bytes("value2"), bytes("value3")), + bytes("value3-value1-value2"), +) + +--- +#let p = plugin("/files/hello.wasm") + +// Error: 2-20 plugin function takes 0 arguments, but 1 was given +#p.hello(bytes("")) + +--- +#let p = plugin("/files/hello.wasm") + +// Error: 10-14 unexpected argument +#p.hello(true) + +--- +#let p = plugin("/files/hello.wasm") + +// Error: 2-17 plugin errored with: This is an `Err` +#p.returns_err() + +--- +#let p = plugin("/files/hello.wasm") + +// Error: 2-16 plugin panicked: wasm `unreachable` instruction executed +#p.will_panic() |
