From 2477f81c20b478574bce4b54cbd0bf4861a0fe62 Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Mon, 23 Sep 2024 15:25:56 +0800 Subject: [PATCH] add conditional compile test case for native backend --- crates/moon/tests/test_cases/cond_comp.in/moon.test | 9 +++++++-- .../tests/test_cases/cond_comp.in/src/lib/moon.pkg.json | 2 ++ .../test_cases/cond_comp.in/src/lib/native_and_wasm.mbt | 4 ++++ .../test_cases/cond_comp.in/src/lib/native_only.mbt | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 crates/moon/tests/test_cases/cond_comp.in/src/lib/native_and_wasm.mbt create mode 100644 crates/moon/tests/test_cases/cond_comp.in/src/lib/native_only.mbt diff --git a/crates/moon/tests/test_cases/cond_comp.in/moon.test b/crates/moon/tests/test_cases/cond_comp.in/moon.test index 25655626..ff050ccc 100644 --- a/crates/moon/tests/test_cases/cond_comp.in/moon.test +++ b/crates/moon/tests/test_cases/cond_comp.in/moon.test @@ -4,7 +4,7 @@ moonc link-core ./target/wasm-gc/release/build/lib/lib.core ./target/wasm-gc/release/build/main/main.core -main username/hello/main -o ./target/wasm-gc/release/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm-gc $ moon build --target wasm --dry-run --sort-input --nostd - moonc build-package ./src/lib/all.mbt ./src/lib/all_wasm.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_wasm.mbt ./src/lib/wasm_release_or_js_debug.mbt -o ./target/wasm/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm + moonc build-package ./src/lib/all.mbt ./src/lib/all_wasm.mbt ./src/lib/js_or_wasm.mbt ./src/lib/native_and_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_wasm.mbt ./src/lib/wasm_release_or_js_debug.mbt -o ./target/wasm/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm moonc build-package ./src/main/main.mbt -o ./target/wasm/release/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm/release/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm moonc link-core ./target/wasm/release/build/lib/lib.core ./target/wasm/release/build/main/main.core -main username/hello/main -o ./target/wasm/release/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm @@ -19,7 +19,7 @@ moonc link-core ./target/js/release/build/lib/lib.core ./target/js/release/build/main/main.core -main username/hello/main -o ./target/js/release/build/main/main.js -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target js $ moon build --dry-run --target wasm --sort-input --nostd --debug - moonc build-package ./src/lib/all.mbt ./src/lib/all_wasm.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt ./src/lib/only_wasm.mbt ./src/lib/wasm_release_or_js_debug.mbt -o ./target/wasm/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm -g + moonc build-package ./src/lib/all.mbt ./src/lib/all_wasm.mbt ./src/lib/js_or_wasm.mbt ./src/lib/native_and_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt ./src/lib/only_wasm.mbt ./src/lib/wasm_release_or_js_debug.mbt -o ./target/wasm/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm -g moonc build-package ./src/main/main.mbt -o ./target/wasm/debug/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm/debug/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm -g moonc link-core ./target/wasm/debug/build/lib/lib.core ./target/wasm/debug/build/main/main.core -main username/hello/main -o ./target/wasm/debug/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm -g @@ -52,3 +52,8 @@ moonc build-package ./src/main/main.mbt -o ./target/js/release/bundle/main/main.core -pkg username/hello/main -is-main -i ./target/js/release/bundle/lib/lib.mi:lib -pkg-sources username/hello/main:./main -target js moonc bundle-core ./target/js/release/bundle/lib/lib.core ./target/js/release/bundle/main/main.core -o ./target/js/release/bundle/hello.core + $ moon build --dry-run --target native --sort-input --nostd --debug + moonc build-package ./src/lib/all.mbt ./src/lib/native_and_wasm.mbt ./src/lib/native_only.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt -o ./target/native/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target native -g + moonc build-package ./src/main/main.mbt -o ./target/native/debug/build/main/main.core -pkg username/hello/main -is-main -i ./target/native/debug/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target native -g + moonc link-core ./target/native/debug/build/lib/lib.core ./target/native/debug/build/main/main.core -main username/hello/main -o ./target/native/debug/build/main/main.exe -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target native -g + diff --git a/crates/moon/tests/test_cases/cond_comp.in/src/lib/moon.pkg.json b/crates/moon/tests/test_cases/cond_comp.in/src/lib/moon.pkg.json index 61ba6e36..06898f84 100644 --- a/crates/moon/tests/test_cases/cond_comp.in/src/lib/moon.pkg.json +++ b/crates/moon/tests/test_cases/cond_comp.in/src/lib/moon.pkg.json @@ -1,5 +1,7 @@ { "targets": { + "native_only.mbt": ["native"], + "native_and_wasm.mbt": ["native", "wasm"], "only_js.mbt": ["js"], "only_wasm.mbt": ["wasm"], "only_wasm_gc.mbt": ["wasm-gc"], diff --git a/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_and_wasm.mbt b/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_and_wasm.mbt new file mode 100644 index 00000000..40488335 --- /dev/null +++ b/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_and_wasm.mbt @@ -0,0 +1,4 @@ +test { + let a = 1 + +} diff --git a/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_only.mbt b/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_only.mbt new file mode 100644 index 00000000..40488335 --- /dev/null +++ b/crates/moon/tests/test_cases/cond_comp.in/src/lib/native_only.mbt @@ -0,0 +1,4 @@ +test { + let a = 1 + +}