WIP upgrade cli tests transitive-deps

This commit is contained in:
Luke Boswell 2024-08-16 12:16:24 +10:00
parent 804cb6e067
commit c8522c246f
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
6 changed files with 90 additions and 72 deletions

View file

@ -1233,6 +1233,84 @@ mod cli_run {
out.assert_stdout_ends_with(expected_ending);
}
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_deps_app() {
build_platform_host();
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one.roc",
);
let expected_ending = "[One imports Two: From two]\n";
let runner = cli_utils::helpers::Run::new_roc()
.arg(CMD_RUN)
.arg(file_path.as_path());
if ALLOW_VALGRIND {
let out = runner.run_with_valgrind();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
} else {
let out = runner.run();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
}
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_transitive_and_direct_dep_app() {
build_platform_host();
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one-and-two.roc",
);
let expected_ending = "[One imports Two: From two] | From two\n";
let runner = cli_utils::helpers::Run::new_roc()
.arg(CMD_RUN)
.arg(file_path.as_path());
if ALLOW_VALGRIND {
let out = runner.run_with_valgrind();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
} else {
let out = runner.run();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
}
}
#[test]
#[cfg_attr(windows, ignore)]
fn run_double_transitive_dep_app() {
build_platform_host();
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-zero.roc",
);
let expected_ending = "[Zero imports One: [One imports Two: From two]]\n";
let runner = cli_utils::helpers::Run::new_roc()
.arg(CMD_RUN)
.arg(file_path.as_path());
if ALLOW_VALGRIND {
let out = runner.run_with_valgrind();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
} else {
let out = runner.run();
out.assert_clean_success();
out.assert_stdout_ends_with(expected_ending);
}
}
}
// TODO not sure if this cfg should still be here: #[cfg(not(debug_assertions))]
@ -1503,66 +1581,6 @@ mod cli_run {
}
}
#[test]
#[serial(multi_dep_thunk)]
#[cfg_attr(windows, ignore)]
fn run_transitive_deps_app() {
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one.roc",
);
test_roc_app(
file_path.as_path(),
vec![],
&[],
vec![],
"[One imports Two: From two]\n",
UseValgrind::Yes,
TestCliCommands::Run,
);
}
#[test]
#[serial(multi_dep_thunk)]
#[cfg_attr(windows, ignore)]
fn run_transitive_and_direct_dep_app() {
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-one-and-two.roc",
);
test_roc_app(
file_path.as_path(),
vec![],
&[],
vec![],
"[One imports Two: From two] | From two\n",
UseValgrind::Yes,
TestCliCommands::Run,
);
}
#[test]
#[serial(multi_dep_thunk)]
#[cfg_attr(windows, ignore)]
fn run_double_transitive_dep_app() {
let file_path = from_root(
"crates/cli/tests/fixtures/transitive-deps",
"direct-zero.roc",
);
test_roc_app(
file_path.as_path(),
vec![],
&[],
vec![],
"[Zero imports One: [One imports Two: From two]]\n",
UseValgrind::Yes,
TestCliCommands::Run,
);
}
#[test]
fn known_type_error() {
check_compile_error(

View file

@ -1,7 +1,7 @@
app [main] {
pf: platform "../packages/platform/main.roc",
one: "one/main.roc",
two: "two/main.roc",
app [main] {
pf: platform "../../test-platform-simple-zig/main.roc",
one: "one/main.roc",
two: "two/main.roc",
}
import one.One

View file

@ -1,6 +1,6 @@
app [main] {
pf: platform "../packages/platform/main.roc",
one: "one/main.roc",
app [main] {
pf: platform "../../test-platform-simple-zig/main.roc",
one: "one/main.roc",
}
import one.One

View file

@ -1,6 +1,6 @@
app [main] {
pf: platform "../packages/platform/main.roc",
zero: "zero/main.roc",
app [main] {
pf: platform "../../test-platform-simple-zig/main.roc",
zero: "zero/main.roc",
}
import zero.Zero

View file

@ -1,4 +1,4 @@
module [example]
module [example]
import two.Two

View file

@ -1,3 +1,3 @@
package [Zero] {
one: "../one/main.roc"
one: "../one/main.roc",
}