Skip to content

Commit

Permalink
Support semicolons in WIT
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcharles committed Oct 3, 2023
1 parent 3b02858 commit 4c73a34
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 94 deletions.
82 changes: 59 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ wasmtime-wasi = { workspace = true }
wasi-common = { workspace = true }
walrus = "0.20.1"
swc_core = { version = "0.83.0", features = ["common_sourcemap", "ecma_ast", "ecma_parser"] }
wit-parser = "0.8.0"
wit-parser = "0.11.3"
convert_case = "0.4.0"

[dev-dependencies]
Expand Down
10 changes: 10 additions & 0 deletions crates/cli/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ fn test_exported_functions_without_flag() {
);
}

#[test]
fn test_exported_function_without_semicolons() {
let mut runner = Runner::new_with_exports(
"exported-fn-no-semicolon.js",
"exported-fn-no-semicolon.wit",
"exported-fn",
);
run_fn(&mut runner, "foo", &[]);
}

#[test]
fn test_producers_section_present() {
let runner = Runner::new("readme.js");
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/sample-scripts/exported-default-arrow-fn.wit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package local:test
package local:test;

world exported-arrow {
export default: func()
export default: func();
}
4 changes: 2 additions & 2 deletions crates/cli/tests/sample-scripts/exported-default-fn.wit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package local:test
package local:test;

world exported-default {
export default: func()
export default: func();
}
3 changes: 3 additions & 0 deletions crates/cli/tests/sample-scripts/exported-fn-no-semicolon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function foo() {
console.log("Hello from bar!");
}
5 changes: 5 additions & 0 deletions crates/cli/tests/sample-scripts/exported-fn-no-semicolon.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package local:test

world exported-fn {
export foo: func()
}
8 changes: 4 additions & 4 deletions crates/cli/tests/sample-scripts/exported-fn.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package local:test
package local:test;

world exported-fn {
export foo: func()
export bar: func()
export foo-bar: func()
export foo: func();
export bar: func();
export foo-bar: func();
}
4 changes: 2 additions & 2 deletions crates/cli/tests/sample-scripts/exported-promise-fn.wit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package local:test
package local:test;

world exported-promise-fn {
export foo: func()
export foo: func();
}
Loading

0 comments on commit 4c73a34

Please sign in to comment.