From 251e1ed07083f33f7555423ff4ca057b9df93268 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:17:00 +0200 Subject: [PATCH] misc improvements --- Cargo.lock | 2 -- crates/cli/Cargo.toml | 2 -- crates/cli/tests/cli_run.rs | 52 ++++++++++++++++----------------- crates/cli_utils/src/helpers.rs | 2 +- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b72c27da2..55a5982b95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2402,10 +2402,8 @@ dependencies = [ "roc_repl_expect", "roc_reporting", "roc_target", - "roc_test_utils", "roc_tracing", "roc_wasm_interp", - "serial_test", "signal-hook", "strum", "target-lexicon", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index cd3ecedb87..e3c99ec384 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -84,14 +84,12 @@ roc_repl_expect = { path = "../repl_expect" } [dev-dependencies] cli_utils = { path = "../cli_utils" } -roc_test_utils = { path = "../test_utils" } roc_command_utils = { path = "../utils/command" } criterion.workspace = true indoc.workspace = true parking_lot.workspace = true pretty_assertions.workspace = true -serial_test.workspace = true [[bench]] name = "time_bench" diff --git a/crates/cli/tests/cli_run.rs b/crates/cli/tests/cli_run.rs index 9fec8d007e..19b9a4a3e4 100644 --- a/crates/cli/tests/cli_run.rs +++ b/crates/cli/tests/cli_run.rs @@ -65,7 +65,7 @@ mod cli_run { // .arg(BUILD_HOST_FLAG) // .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) // .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - // .with_valigrind(ALLOW_VALGRIND) + // .with_valgrind(ALLOW_VALGRIND) // .arg(file_from_root("examples/platform-switching", "main.roc").as_path()); // let out = runner.run(); @@ -87,7 +87,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("examples/platform-switching", "rocLovesRust.roc").as_path()); let out = runner.run(); @@ -104,7 +104,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("examples/platform-switching", "rocLovesZig.roc").as_path()); let out = runner.run(); @@ -134,7 +134,7 @@ mod cli_run { ); let runner = Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .add_args(["--main", "tests/module_imports_pkg/app.roc"]) .arg(file_from_root("crates/cli/tests/module_imports_pkg", "Module.roc").as_path()); @@ -164,7 +164,7 @@ mod cli_run { ); let runner = Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/module_imports_pkg", "Module.roc").as_path()); let out = runner.run(); @@ -196,7 +196,7 @@ mod cli_run { ); let runner = Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .add_args(["--main", "tests/module_imports_pkg/app.roc"]) .arg( file_from_root( @@ -237,7 +237,7 @@ mod cli_run { ); let runner = Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/expects_transitive", "main.roc").as_path()); let out = runner.run(); @@ -260,7 +260,7 @@ mod cli_run { ); let runner = Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg("--verbose") .arg(file_from_root("crates/cli/tests/expects_transitive", "main.roc").as_path()); @@ -280,7 +280,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/algorithms", "fibonacci.roc").as_path()); let out = runner.run(); @@ -298,7 +298,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/algorithms", "quicksort.roc").as_path()); let out = runner.run(); @@ -418,7 +418,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/effects", "main.roc").as_path()) .with_stdin_vals(vec!["hi there!"]); @@ -437,7 +437,7 @@ mod cli_run { .arg(BUILD_HOST_FLAG) .arg(SUPPRESS_BUILD_HOST_WARNING_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/tui", "main.roc").as_path()) .with_stdin_vals(vec!["foo\n"]); @@ -467,7 +467,7 @@ mod cli_run { let runner = Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/false-interpreter", "False.roc").as_path()) .add_args([ "--", @@ -629,7 +629,7 @@ mod cli_run { let runner = Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) // uses basic-cli release .arg(file_from_root("examples", "inspect-logging.roc").as_path()); @@ -676,7 +676,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(roc_cli::CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg( file_from_root("crates/cli/tests/fixtures/multi-dep-str", "Main.roc").as_path(), ); @@ -696,7 +696,7 @@ mod cli_run { .arg(CMD_RUN) .arg(OPTIMIZE_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg( file_from_root("crates/cli/tests/fixtures/multi-dep-str", "Main.roc").as_path(), ); @@ -715,7 +715,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg( file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc") .as_path(), @@ -739,7 +739,7 @@ mod cli_run { .arg(CMD_RUN) .arg(OPTIMIZE_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg( file_from_root("crates/cli/tests/fixtures/multi-dep-thunk", "Main.roc") .as_path(), @@ -760,7 +760,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path()); let out = runner.run(); @@ -779,7 +779,7 @@ mod cli_run { .arg(CMD_RUN) .arg(OPTIMIZE_FLAG) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/fixtures/packages", "app.roc").as_path()); let out = runner.run(); @@ -801,7 +801,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_path.as_path()); let out = runner.run(); @@ -823,7 +823,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_path.as_path()); let out = runner.run(); @@ -845,7 +845,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_RUN) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_path.as_path()); let out = runner.run(); @@ -884,7 +884,7 @@ mod cli_run { let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_DEV) .add_arg_if(LINKER_FLAG, TEST_LEGACY_LINKER) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path()); let out = runner.run(); @@ -945,7 +945,7 @@ mod cli_run { ); let runner = cli_utils::helpers::Run::new_roc() .arg(CMD_TEST) - .with_valigrind(ALLOW_VALGRIND) + .with_valgrind(ALLOW_VALGRIND) .arg(file_from_root("crates/cli/tests/expects", "expects.roc").as_path()); let out = runner.run(); @@ -1002,7 +1002,7 @@ mod cli_run { .arg(roc_cli::CMD_RUN) .add_arg_if(super::LINKER_FLAG, super::TEST_LEGACY_LINKER) .arg(file_path.as_path()) - .with_valigrind(matches!(use_valgrind, UseValgrind::Yes) && ALLOW_VALGRIND) + .with_valgrind(matches!(use_valgrind, UseValgrind::Yes) && ALLOW_VALGRIND) .with_stdin_vals(stdin); let out = runner.run(); diff --git a/crates/cli_utils/src/helpers.rs b/crates/cli_utils/src/helpers.rs index 17968eb9bb..bed95859a7 100644 --- a/crates/cli_utils/src/helpers.rs +++ b/crates/cli_utils/src/helpers.rs @@ -253,7 +253,7 @@ impl Run { self } - pub fn with_valigrind(mut self, use_valgrind: bool) -> Self { + pub fn with_valgrind(mut self, use_valgrind: bool) -> Self { self.run_with_valgrind = use_valgrind; self }