Skip to content

Commit

Permalink
internal: enable native backend for windows (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash authored Oct 12, 2024
1 parent ca50f51 commit b6a9d1f
Showing 1 changed file with 66 additions and 86 deletions.
152 changes: 66 additions & 86 deletions crates/moon/tests/test_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5383,17 +5383,15 @@ fn test_many_targets_auto_update_001() {
}
"#]],
);
#[cfg(unix)]
{
check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"

check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"
test {
inspect!("native")
}
"#]],
);
}
);
}

#[test]
Expand Down Expand Up @@ -5425,30 +5423,27 @@ fn test_many_targets_auto_update_002() {
"#]],
);

#[cfg(unix)]
{
check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"
check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"
test {
inspect!("native")
}
"#]],
);
);

let _ = get_stdout(
&dir,
["test", "--target", "native", "-u", "--no-parallelize"],
);
check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"
let _ = get_stdout(
&dir,
["test", "--target", "native", "-u", "--no-parallelize"],
);
check(
read(dir.join("lib").join("x.native.mbt")),
expect![[r#"
test {
inspect!("native", content="native")
}
"#]],
);
}
);
}

#[test]
Expand Down Expand Up @@ -5577,20 +5572,18 @@ fn test_many_targets_expect_failed() {
"#]],
);

#[cfg(unix)]
{
check(
get_err_stdout(
&dir,
[
"test",
"--target",
"js,wasm,native",
"--sort-input",
"--serial",
],
),
expect![[r#"
check(
get_err_stdout(
&dir,
[
"test",
"--target",
"js,wasm,native",
"--sort-input",
"--serial",
],
),
expect![[r#"
test username/hello/lib/x.wasm.mbt::0 failed
expect test failed at $ROOT/lib/x.wasm.mbt:2:3-2:32
Diff:
Expand All @@ -5616,8 +5609,7 @@ fn test_many_targets_expect_failed() {
Total tests: 1, passed: 0, failed: 1. [native]
"#]],
);
}
);
}

#[test]
Expand Down Expand Up @@ -5705,19 +5697,16 @@ fn test_moon_run_single_mbt_file() {
"#]],
);

#[cfg(unix)]
{
let output = get_stdout(
&dir.join("a").join("b"),
["run", "single.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
let output = get_stdout(
&dir.join("a").join("b"),
["run", "single.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
I am OK
"#]],
);
}
);
}

#[test]
Expand Down Expand Up @@ -5824,31 +5813,28 @@ fn test_moon_run_single_mbt_file_inside_a_pkg() {
"#]],
);

#[cfg(unix)]
{
let output = get_stdout(
&dir.join("lib").join("main_in_lib"),
["run", "../../main/main.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
let output = get_stdout(
&dir.join("lib").join("main_in_lib"),
["run", "../../main/main.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
Hello, world!!!
root main
"#]],
);
let output = get_stdout(
&dir.join("lib").join("main_in_lib"),
["run", "main.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
);
let output = get_stdout(
&dir.join("lib").join("main_in_lib"),
["run", "main.mbt", "--target", "native"],
);
check(
&output,
expect![[r#"
Hello, world!!!
main in lib
"#]],
);
}
);
}

#[test]
Expand All @@ -5857,32 +5843,26 @@ fn moon_test_parallelize_should_success() {

let output = get_stdout(&dir, ["test"]);
assert!(output.contains("Total tests: 14, passed: 14, failed: 0."));
#[cfg(unix)]
{
let output = get_stdout(&dir, ["test", "--target", "native"]);
assert!(output.contains("Total tests: 14, passed: 14, failed: 0."));
}

let output = get_stdout(&dir, ["test", "--target", "native"]);
assert!(output.contains("Total tests: 14, passed: 14, failed: 0."));

let dir = TestDir::new("test_filter.in");

let output = get_err_stdout(&dir, ["test"]);
assert!(output.contains("Total tests: 13, passed: 11, failed: 2."));
#[cfg(unix)]
{
let output = get_err_stdout(&dir, ["test", "--target", "native"]);
assert!(output.contains("Total tests: 13, passed: 11, failed: 2."));
}

let output = get_err_stdout(&dir, ["test", "--target", "native"]);
assert!(output.contains("Total tests: 13, passed: 11, failed: 2."));

let output = get_stdout(&dir, ["test", "-u", "--no-parallelize"]);
assert!(output.contains("Total tests: 13, passed: 13, failed: 0."));
#[cfg(unix)]
{
let output = get_stdout(
&dir,
["test", "-u", "--no-parallelize", "--target", "native"],
);
assert!(output.contains("Total tests: 13, passed: 13, failed: 0."));
}

let output = get_stdout(
&dir,
["test", "-u", "--no-parallelize", "--target", "native"],
);
assert!(output.contains("Total tests: 13, passed: 13, failed: 0."));
}

#[test]
Expand Down

0 comments on commit b6a9d1f

Please sign in to comment.