Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunchen committed Oct 21, 2024
1 parent 735551e commit 9f33a90
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
37 changes: 37 additions & 0 deletions crates/moon/tests/test_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,43 @@ fn test_moon_fmt_002() {
);
}

#[test]
fn test_moon_fmt_extra_args() {
let dir = TestDir::new("moon_fmt.in");
check(
&get_stdout(&dir, ["fmt", "--dry-run"]),
expect![[r#"
moonfmt ./lib/hello.mbt -w -o ./target/wasm-gc/release/format/lib/hello.mbt
moonfmt ./lib/hello_wbtest.mbt -w -o ./target/wasm-gc/release/format/lib/hello_wbtest.mbt
moonfmt ./main/main.mbt -w -o ./target/wasm-gc/release/format/main/main.mbt
"#]],
);
check(
&get_stdout(&dir, ["fmt", "--dry-run", "--", "a", "b"]),
expect![[r#"
moonfmt ./lib/hello.mbt -w -o ./target/wasm-gc/release/format/lib/hello.mbt a b
moonfmt ./lib/hello_wbtest.mbt -w -o ./target/wasm-gc/release/format/lib/hello_wbtest.mbt a b
moonfmt ./main/main.mbt -w -o ./target/wasm-gc/release/format/main/main.mbt a b
"#]],
);
check(
&get_stdout(&dir, ["fmt", "--check", "--dry-run"]),
expect![[r#"
moon tool format-and-diff --old ./lib/hello.mbt --new ./target/wasm-gc/release/format/lib/hello.mbt
moon tool format-and-diff --old ./lib/hello_wbtest.mbt --new ./target/wasm-gc/release/format/lib/hello_wbtest.mbt
moon tool format-and-diff --old ./main/main.mbt --new ./target/wasm-gc/release/format/main/main.mbt
"#]],
);
check(
&get_stdout(&dir, ["fmt", "--check", "--dry-run", "--", "c", "d"]),
expect![[r#"
moon tool format-and-diff --old ./lib/hello.mbt --new ./target/wasm-gc/release/format/lib/hello.mbt c d
moon tool format-and-diff --old ./lib/hello_wbtest.mbt --new ./target/wasm-gc/release/format/lib/hello_wbtest.mbt c d
moon tool format-and-diff --old ./main/main.mbt --new ./target/wasm-gc/release/format/main/main.mbt c d
"#]],
);
}

#[test]
fn test_export_memory_name() {
let dir = TestDir::new("export_memory.in");
Expand Down
6 changes: 5 additions & 1 deletion docs/manual-zh/src/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ Remove the target directory

Format source code

**Usage:** `moon fmt [OPTIONS]`
**Usage:** `moon fmt [OPTIONS] [ARGS]...`

###### **Arguments:**

* `<ARGS>`

###### **Options:**

Expand Down
6 changes: 5 additions & 1 deletion docs/manual/src/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ Remove the target directory

Format source code

**Usage:** `moon fmt [OPTIONS]`
**Usage:** `moon fmt [OPTIONS] [ARGS]...`

###### **Arguments:**

* `<ARGS>`

###### **Options:**

Expand Down

0 comments on commit 9f33a90

Please sign in to comment.