diff --git a/crates/cli/tests/cli_run.rs b/crates/cli/tests/cli_run.rs index e4f24d61a9..aa85d8b483 100644 --- a/crates/cli/tests/cli_run.rs +++ b/crates/cli/tests/cli_run.rs @@ -386,7 +386,7 @@ mod cli_run { // We exclude the C platforming switching example // because the main platform switching example runs the c platform. // If we don't a race condition leads to test flakiness. - // platformSwitchingC:"platform-switching/c-platform" => Example { + // platformSwitchingC:"platform-switching" => Example { // filename: "rocLovesC.roc", // executable_filename: "rocLovesC", // stdin: &[], @@ -394,7 +394,7 @@ mod cli_run { // expected_ending:"Roc <3 C!\n", // use_valgrind: true, // }, - platformSwitchingRust:"platform-switching/rust-platform" => Example { + platformSwitchingRust:"platform-switching" => Example { filename: "rocLovesRust.roc", executable_filename: "rocLovesRust", stdin: &[], @@ -402,7 +402,7 @@ mod cli_run { expected_ending:"Roc <3 Rust!\n", use_valgrind: true, }, - platformSwitchingSwift:"platform-switching/swift-platform" => Example { + platformSwitchingSwift:"platform-switching" => Example { filename: "rocLovesSwift.roc", executable_filename: "rocLovesSwift", stdin: &[], @@ -410,7 +410,7 @@ mod cli_run { expected_ending:"Roc <3 Swift!\n", use_valgrind: true, }, - platformSwitchingWebAssembly:"platform-switching/web-assembly-platform" => Example { + platformSwitchingWebAssembly:"platform-switching" => Example { filename: "rocLovesWebAssembly.roc", executable_filename: "rocLovesWebAssembly", stdin: &[], @@ -418,7 +418,7 @@ mod cli_run { expected_ending:"Roc <3 Web Assembly!\n", use_valgrind: true, }, - platformSwitchingZig:"platform-switching/zig-platform" => Example { + platformSwitchingZig:"platform-switching" => Example { filename: "rocLovesZig.roc", executable_filename: "rocLovesZig", stdin: &[], @@ -821,25 +821,6 @@ mod cli_run { if entry.file_type().unwrap().is_dir() { let example_dir_name = entry.file_name().into_string().unwrap(); - // TODO: Improve this with a more-dynamic approach. (Read all subdirectories?) - // Some platform-switching examples live in nested directories - if example_dir_name == "platform-switching" { - for sub_dir in [ - // We exclude the C platforming switching example - // because the main platform switching example runs the c platform. - // If we don't a race condition leads to test flakiness. - // "c-platform", - "rust-platform", - "swift-platform", - "web-assembly-platform", - "zig-platform", - ] { - all_examples.remove(format!("{}/{}", example_dir_name, sub_dir).as_str()).unwrap_or_else(|| { - panic!("The example directory {}/{}/{} does not have any corresponding tests in cli_run. Please add one, so if it ever stops working, we'll know about it right away!", examples_dir, example_dir_name, sub_dir); - }); - } - } - // We test benchmarks separately if example_dir_name != "benchmarks" { all_examples.remove(example_dir_name.as_str()).unwrap_or_else(|| { diff --git a/examples/platform-switching/c-platform/rocLovesC.roc b/examples/platform-switching/rocLovesC.roc similarity index 64% rename from examples/platform-switching/c-platform/rocLovesC.roc rename to examples/platform-switching/rocLovesC.roc index 71e366a7b0..43e7f606f6 100644 --- a/examples/platform-switching/c-platform/rocLovesC.roc +++ b/examples/platform-switching/rocLovesC.roc @@ -1,5 +1,5 @@ app "rocLovesC" - packages { pf: "main.roc" } + packages { pf: "c-platform/main.roc" } imports [] provides [main] to pf diff --git a/examples/platform-switching/rust-platform/rocLovesRust.roc b/examples/platform-switching/rocLovesRust.roc similarity index 64% rename from examples/platform-switching/rust-platform/rocLovesRust.roc rename to examples/platform-switching/rocLovesRust.roc index ce0da7a63c..7d9c8da26b 100644 --- a/examples/platform-switching/rust-platform/rocLovesRust.roc +++ b/examples/platform-switching/rocLovesRust.roc @@ -1,5 +1,5 @@ app "rocLovesRust" - packages { pf: "main.roc" } + packages { pf: "rust-platform/main.roc" } imports [] provides [main] to pf diff --git a/examples/platform-switching/swift-platform/rocLovesSwift.roc b/examples/platform-switching/rocLovesSwift.roc similarity index 64% rename from examples/platform-switching/swift-platform/rocLovesSwift.roc rename to examples/platform-switching/rocLovesSwift.roc index 9413607c5a..8dcf22a97f 100644 --- a/examples/platform-switching/swift-platform/rocLovesSwift.roc +++ b/examples/platform-switching/rocLovesSwift.roc @@ -1,5 +1,5 @@ app "rocLovesSwift" - packages { pf: "main.roc" } + packages { pf: "swift-platform/main.roc" } imports [] provides [main] to pf diff --git a/examples/platform-switching/web-assembly-platform/rocLovesWebAssembly.roc b/examples/platform-switching/rocLovesWebAssembly.roc similarity index 64% rename from examples/platform-switching/web-assembly-platform/rocLovesWebAssembly.roc rename to examples/platform-switching/rocLovesWebAssembly.roc index 6a67749d14..ff550ad37a 100644 --- a/examples/platform-switching/web-assembly-platform/rocLovesWebAssembly.roc +++ b/examples/platform-switching/rocLovesWebAssembly.roc @@ -1,5 +1,5 @@ app "rocLovesWebAssembly" - packages { pf: "main.roc" } + packages { pf: "web-assembly-platform/main.roc" } imports [] provides [main] to pf diff --git a/examples/platform-switching/zig-platform/rocLovesZig.roc b/examples/platform-switching/rocLovesZig.roc similarity index 64% rename from examples/platform-switching/zig-platform/rocLovesZig.roc rename to examples/platform-switching/rocLovesZig.roc index ad9bdfa733..fe838c5396 100644 --- a/examples/platform-switching/zig-platform/rocLovesZig.roc +++ b/examples/platform-switching/rocLovesZig.roc @@ -1,5 +1,5 @@ app "rocLovesZig" - packages { pf: "main.roc" } + packages { pf: "zig-platform/main.roc" } imports [] provides [main] to pf diff --git a/examples/platform-switching/web-assembly-platform/README.md b/examples/platform-switching/web-assembly-platform/README.md index 2e77e5a0f0..192ebc7041 100644 --- a/examples/platform-switching/web-assembly-platform/README.md +++ b/examples/platform-switching/web-assembly-platform/README.md @@ -3,8 +3,8 @@ To run this website, first compile either of these identical apps: ```bash -# Option A: Compile examples/platform-switching/web-assembly-platform/rocLovesWebAssembly.roc -cargo run -- build --target=wasm32 examples/platform-switching/web-assembly-platform/rocLovesWebAssembly.roc +# Option A: Compile examples/platform-switching/rocLovesWebAssembly.roc +cargo run -- build --target=wasm32 examples/platform-switching/rocLovesWebAssembly.roc # Option B: Compile examples/platform-switching/main.roc with `pf: "web-assembly-platform/main.roc"` and move the result cargo run -- build --target=wasm32 examples/platform-switching/main.roc diff --git a/getting_started/linux_x86.md b/getting_started/linux_x86.md index fdedf4853a..7fffcfe88a 100644 --- a/getting_started/linux_x86.md +++ b/getting_started/linux_x86.md @@ -38,9 +38,9 @@ ```sh # Note: If you installed Rust in this terminal session, you'll need to open a new one first! - ./roc examples/platform-switching/rust-platform/rocLovesRust.roc + ./roc examples/platform-switching/rocLovesRust.roc - ./roc examples/platform-switching/zig-platform/rocLovesZig.roc + ./roc examples/platform-switching/rocLovesZig.roc - ./roc examples/platform-switching/c-platform/rocLovesC.roc + ./roc examples/platform-switching/rocLovesC.roc ``` diff --git a/getting_started/macos_apple_silicon.md b/getting_started/macos_apple_silicon.md index de6c2b6332..a3b294e3de 100644 --- a/getting_started/macos_apple_silicon.md +++ b/getting_started/macos_apple_silicon.md @@ -34,9 +34,9 @@ ```sh # Note: If you installed rust in this terminal session, you'll need to open a new one first! - ./roc examples/platform-switching/rust-platform/rocLovesRust.roc + ./roc examples/platform-switching/rocLovesRust.roc - ./roc examples/platform-switching/zig-platform/rocLovesZig.roc + ./roc examples/platform-switching/rocLovesZig.roc - ./roc examples/platform-switching/c-platform/rocLovesC.roc + ./roc examples/platform-switching/rocLovesC.roc ``` diff --git a/getting_started/macos_x86.md b/getting_started/macos_x86.md index fc88823b2f..339f3e80e2 100644 --- a/getting_started/macos_x86.md +++ b/getting_started/macos_x86.md @@ -34,9 +34,9 @@ ```sh # Note: If you installed rust in this terminal session, you'll need to open a new one first! - ./roc examples/platform-switching/rust-platform/rocLovesRust.roc + ./roc examples/platform-switching/rocLovesRust.roc - ./roc examples/platform-switching/zig-platform/rocLovesZig.roc + ./roc examples/platform-switching/rocLovesZig.roc - ./roc examples/platform-switching/c-platform/rocLovesC.roc + ./roc examples/platform-switching/rocLovesC.roc ``` diff --git a/getting_started/other.md b/getting_started/other.md index 69b529c0bd..70f01dd2e5 100644 --- a/getting_started/other.md +++ b/getting_started/other.md @@ -7,11 +7,11 @@ 1. Run examples: ```sh - cargo run examples/platform-switching/rust-platform/rocLovesRust.roc + cargo run examples/platform-switching/rocLovesRust.roc # This requires installing the Zig compiler, too. - cargo run examples/platform-switching/zig-platform/rocLovesZig.roc + cargo run examples/platform-switching/rocLovesZig.roc # This requires installing the `clang` C compiler, too. - cargo run examples/platform-switching/c-platform/rocLovesC.roc + cargo run examples/platform-switching/rocLovesC.roc ```