Skip to content

Commit

Permalink
Add semicolons to WIT. (#185)
Browse files Browse the repository at this point in the history
This commit adds semicolons to the WIT produced by `cargo component new` as
well as to the tests.
  • Loading branch information
peterhuene authored Nov 8, 2023
1 parent caa7db6 commit f79f9c1
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ This will create a `wit/world.wit` file describing the world that the
component will target:

```wit
package my-org:my-component
package my-org:my-component;
/// An example world for the component to target.
world example {
export hello-world: func() -> string
export hello-world: func() -> string;
}
```

Expand Down
6 changes: 3 additions & 3 deletions crates/wit/tests/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async fn validate_the_version_exists() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
project.file("foo.wit", "package foo:bar\n")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand Down Expand Up @@ -97,7 +97,7 @@ async fn checks_for_duplicate_dependencies() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
project.file("foo.wit", "package foo:bar\n")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand Down Expand Up @@ -133,7 +133,7 @@ async fn does_not_modify_manifest_for_dry_run() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
project.file("foo.wit", "package foo:bar\n")?;
project.file("foo.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand Down
6 changes: 3 additions & 3 deletions crates/wit/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ fn it_builds() -> Result<()> {
let project = Project::new("foo")?;
project.file(
"bar.wit",
r#"package foo:bar
r#"package foo:bar;
interface bar {}
world bar-world {}
"#,
)?;
project.file(
"baz.wit",
r#"package foo:bar
r#"package foo:bar;
interface baz {}
world baz-world {}
"#,
Expand Down Expand Up @@ -71,7 +71,7 @@ world baz-world {}
#[test]
fn it_adds_a_producers_field() -> Result<()> {
let project = Project::new("foo")?;
project.file("producers.wit", "package test:producers")?;
project.file("producers.wit", "package test:producers;")?;

project
.wit("build")
Expand Down
6 changes: 3 additions & 3 deletions crates/wit/tests/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn it_publishes_a_wit_package() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
project.file("baz.wit", "package baz:qux\n")?;
project.file("baz.wit", "package baz:qux;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand All @@ -58,7 +58,7 @@ async fn it_does_a_dry_run_publish() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "foo", "")?;
project.file("baz.wit", "package baz:qux\n")?;
project.file("baz.wit", "package baz:qux;\n")?;
project
.wit("publish --init --dry-run")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand Down Expand Up @@ -95,7 +95,7 @@ async fn it_publishes_with_registry_metadata() -> Result<()> {
let repository = "https://example.com/repo";

let project = Project::with_root(&root, "foo", "")?;
project.file("baz.wit", "package baz:qux\n")?;
project.file("baz.wit", "package baz:qux;\n")?;

project.update_manifest(|mut doc| {
doc["authors"] = value(Array::from_iter(authors));
Expand Down
22 changes: 11 additions & 11 deletions crates/wit/tests/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn update_without_changes_is_a_noop() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "bar", "")?;
project.file("bar.wit", "package foo:bar\n")?;
project.file("bar.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand All @@ -43,7 +43,7 @@ async fn update_without_changes_is_a_noop() -> Result<()> {
.success();

let project = Project::with_root(&root, "baz", "")?;
project.file("baz.wit", "package foo:baz\n")?;
project.file("baz.wit", "package foo:baz;\n")?;
project
.wit("add foo:bar")
.assert()
Expand Down Expand Up @@ -72,7 +72,7 @@ async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "bar", "")?;
project.file("bar.wit", "package foo:bar\n")?;
project.file("bar.wit", "package foo:bar;\n")?;
project
.wit("publish --init")
.env("WIT_PUBLISH_KEY", test_signing_key())
Expand All @@ -81,7 +81,7 @@ async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> {
.success();

let project = Project::with_root(&root, "baz", "")?;
project.file("baz.wit", "package foo:baz\n")?;
project.file("baz.wit", "package foo:baz;\n")?;
project
.wit("add foo:bar")
.assert()
Expand Down Expand Up @@ -122,7 +122,7 @@ async fn update_with_compatible_changes() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "bar", "")?;
project.file("bar.wit", "package foo:bar\n")?;
project.file("bar.wit", "package foo:bar;\n")?;
project.file(
"wit.toml",
"version = \"1.0.0\"\n[dependencies]\n[registries]\n",
Expand All @@ -136,7 +136,7 @@ async fn update_with_compatible_changes() -> Result<()> {
.success();

let project = Project::with_root(&root, "baz", "")?;
project.file("baz.wit", "package foo:baz\n")?;
project.file("baz.wit", "package foo:baz;\n")?;
project
.wit("add foo:bar")
.assert()
Expand Down Expand Up @@ -180,7 +180,7 @@ async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "bar", "")?;
project.file("bar.wit", "package foo:bar\n")?;
project.file("bar.wit", "package foo:bar;\n")?;
project.file(
"wit.toml",
"version = \"1.0.0\"\n[dependencies]\n[registries]\n",
Expand All @@ -194,7 +194,7 @@ async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> {
.success();

let project = Project::with_root(&root, "baz", "")?;
project.file("baz.wit", "package foo:baz\n")?;
project.file("baz.wit", "package foo:baz;\n")?;
project
.wit("add foo:bar")
.assert()
Expand Down Expand Up @@ -238,7 +238,7 @@ async fn update_with_changed_dependencies() -> Result<()> {
config.write_to_file(&root.join("warg-config.json"))?;

let project = Project::with_root(&root, "bar", "")?;
project.file("bar.wit", "package foo:bar\n")?;
project.file("bar.wit", "package foo:bar;\n")?;
project.file(
"wit.toml",
"version = \"1.0.0\"\n[dependencies]\n[registries]\n",
Expand All @@ -252,7 +252,7 @@ async fn update_with_changed_dependencies() -> Result<()> {
.success();

let project = Project::with_root(&root, "baz", "")?;
project.file("baz.wit", "package foo:baz\n")?;
project.file("baz.wit", "package foo:baz;\n")?;
project.file(
"wit.toml",
"version = \"1.0.0\"\n[dependencies]\n[registries]\n",
Expand All @@ -266,7 +266,7 @@ async fn update_with_changed_dependencies() -> Result<()> {
.success();

let project = Project::with_root(&root, "qux", "")?;
project.file("qux.wit", "package foo:qux\n")?;
project.file("qux.wit", "package foo:qux;\n")?;
project
.wit("add foo:bar")
.assert()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,11 @@ impl Guest for Component {
fs::write(
&path,
format!(
r#"package {ns}:{pkg}
r#"package {ns}:{pkg};
/// An example world for the component to target.
world example {{
export hello-world: func() -> string
export hello-world: func() -> string;
}}
"#,
ns = escape_wit(&name.namespace),
Expand Down
Loading

0 comments on commit f79f9c1

Please sign in to comment.