Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support semicolons in WIT #482

Merged
merged 1 commit into from
Oct 4, 2023
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
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