Skip to content

Commit

Permalink
Merge pull request #7401 from roc-lang/cleanup-examples
Browse files Browse the repository at this point in the history
Cleanup Examples folder
  • Loading branch information
lukewilliamboswell authored Jan 8, 2025
2 parents 99dfc55 + 68f4aab commit 3e0c626
Show file tree
Hide file tree
Showing 92 changed files with 20 additions and 8,512 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
#pull_request:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
Expand Down
3 changes: 2 additions & 1 deletion ci/package_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ mkdir -p $1 $1/examples
mv target/release-with-lto/{roc,roc_language_server,lib} $1
mv LICENSE LEGAL_DETAILS $1

mv examples/platform-switching $1/examples
mv crates/cli/tests/platform-switching $1/examples
mv examples/README.md $1/examples

# temporary github.com/roc-lang/roc/pull/7231
rm $1/examples/platform-switching/rocLovesRust.roc
Expand Down
39 changes: 7 additions & 32 deletions crates/cli/tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ mod cli_tests {
// pre-build the platform
std::process::Command::new("bash")
.arg(file_from_root(
"examples/platform-switching/rust-platform",
"crates/cli/tests/platform-switching/rust-platform",
"build.sh",
))
.status()
.unwrap();

let cli_build = ExecCli::new(
roc_cli::CMD_DEV,
file_from_root("examples/platform-switching", "rocLovesRust.roc"),
file_from_root("crates/cli/tests/platform-switching", "rocLovesRust.roc"),
);

let expected_output = "Roc <3 Rust!\n";
Expand All @@ -80,7 +80,7 @@ mod cli_tests {

let cli_build = ExecCli::new(
CMD_BUILD,
file_from_root("examples/platform-switching", "rocLovesZig.roc"),
file_from_root("crates/cli/tests/platform-switching", "rocLovesZig.roc"),
)
.arg(BUILD_HOST_FLAG)
.arg(SUPPRESS_BUILD_HOST_WARNING_FLAG);
Expand All @@ -104,7 +104,10 @@ mod cli_tests {
// so let's just check it for now
let cli_check = ExecCli::new(
CMD_CHECK,
file_from_root("examples/platform-switching", "rocLovesWebAssembly.roc"),
file_from_root(
"crates/cli/tests/platform-switching",
"rocLovesWebAssembly.roc",
),
);

let cli_check_out = cli_check.run();
Expand Down Expand Up @@ -160,34 +163,6 @@ mod cli_tests {
);
}

// TODO: write a new test once mono bugs are resolved in investigation
// Encountering this TODO years later, I presume the new test should test the execution, not just roc check.
#[test]
#[cfg(not(debug_assertions))] // https://github.com/roc-lang/roc/issues/4806 - later observation: this issue is closed but the tests still hangs in debug mode
fn check_virtual_dom_server() {
let cli_check = ExecCli::new(
CMD_CHECK,
file_from_root("examples/virtual-dom-wip", "example-server.roc"),
);

let cli_check_out = cli_check.run();
cli_check_out.assert_clean_success();
}

// TODO: write a new test once mono bugs are resolved in investigation
// Encountering this TODO years later, I presume the new test should test the execution, not just roc check.
#[test]
#[cfg(not(debug_assertions))] // https://github.com/roc-lang/roc/issues/4806 - later observation: this issue is closed but the tests still hangs in debug mode
fn check_virtual_dom_client() {
let cli_check = ExecCli::new(
CMD_CHECK,
file_from_root("examples/virtual-dom-wip", "example-client.roc"),
);

let cli_check_out = cli_check.run();
cli_check_out.assert_clean_success();
}

#[test]
#[cfg_attr(windows, ignore)]
// tea = The Elm Architecture
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[toolchain]
channel = "1.77.2"

profile = "default"

components = [
# for usages of rust-analyzer or similar tools inside `nix develop`
"rust-src"
[toolchain]
channel = "1.77.2"

profile = "default"

components = [
# for usages of rust-analyzer or similar tools inside `nix develop`
"rust-src"
]
26 changes: 0 additions & 26 deletions crates/compiler/test_syntax/tests/test_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5992,32 +5992,6 @@ mod test_fmt {
));
}

#[test]
/// Test that everything under examples/ is formatted correctly
/// If this test fails on your diff, it probably means you need to re-format the examples.
/// Try this:
/// `cargo run -- format $(find examples -name \*.roc)`
fn test_fmt_examples() {
let mut count = 0;
let mut root = workspace_root();
root.push("examples");
for entry in walkdir::WalkDir::new(&root) {
let entry = entry.unwrap();
let path = entry.path();
if path.extension() == Some(std::ffi::OsStr::new("roc")) {
count += 1;
let src = std::fs::read_to_string(path).unwrap();
println!("Now trying to format {}", path.display());
module_formats_same(&src);
}
}
assert!(
count > 0,
"Expecting to find at least 1 .roc file to format under {}",
root.display()
);
}

#[test]
/// Test that builtins are formatted correctly
/// If this test fails on your diff, it probably means you need to re-format a builtin.
Expand Down
2 changes: 1 addition & 1 deletion crates/copy_zig_glue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ pub fn copy_zig_glue() {
workspace_dir.join("crates/valgrind_tests/zig-platform/glue"),
workspace_dir.join("crates/cli/tests/test-projects/test-platform-effects-zig/glue"),
workspace_dir.join("crates/cli/tests/test-projects/test-platform-simple-zig/glue"),
workspace_dir.join("examples/platform-switching/zig-platform/glue"),
workspace_dir.join("crates/cli/tests/test-projects/multiple_exposed/platform/glue"),
workspace_dir.join("crates/cli/tests/test-projects/tui/platform/glue"),
workspace_dir.join("crates/cli/tests/platform-switching/zig-platform/glue"),
];

for target_dir in zig_test_platforms_dirs {
Expand Down
8 changes: 1 addition & 7 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Examples

To run examples:

```bash
roc run examples/hello-world/main.roc
```

[More examples](https://github.com/roc-lang/examples)
Checkout the [roc examples site](https://github.com/roc-lang/examples) to see examples of using roc.
7 changes: 0 additions & 7 deletions examples/glue/glue.roc

This file was deleted.

2 changes: 0 additions & 2 deletions examples/glue/rust-platform/.cargo/config.toml

This file was deleted.

23 changes: 0 additions & 23 deletions examples/glue/rust-platform/Cargo.toml

This file was deleted.

9 changes: 0 additions & 9 deletions examples/glue/rust-platform/build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions examples/glue/rust-platform/host.c

This file was deleted.

17 changes: 0 additions & 17 deletions examples/glue/rust-platform/main.roc

This file was deleted.

Loading

0 comments on commit 3e0c626

Please sign in to comment.