Skip to content

Commit

Permalink
Only build effects platform once in roc_cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agu-z committed Nov 7, 2024
1 parent cfa3cbb commit a5aeb82
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions crates/cli/tests/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ mod cli_run {
)
}

static BUILD_EFFECTS_PLATFORM: std::sync::Once = std::sync::Once::new();

#[allow(clippy::too_many_arguments)]
fn test_roc_app(
dir_name: &str,
Expand Down Expand Up @@ -438,6 +440,22 @@ mod cli_run {
custom_flags = vec![LINKER_FLAG, "legacy"];
}

if dir_name.to_ascii_lowercase().contains("effectful")
|| roc_filename.ends_with("effects.roc")
{
BUILD_EFFECTS_PLATFORM.call_once(|| {
run_roc_on(
Path::new("../../examples/cli/effects.roc"),
[CMD_BUILD],
&[],
&[],
&[],
);
});

custom_flags.push(PREBUILT_PLATFORM);
}

// Check with and without optimizations
check_output_with_stdin(
&file_name,
Expand Down Expand Up @@ -986,6 +1004,21 @@ mod cli_run {
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn interactive_effects() {
test_roc_app(
"examples/cli",
"effects.roc",
&["hi there!"],
&[],
&[],
"hi there!\nIt is known\n",
UseValgrind::Yes,
TestCliCommands::Run,
)
}

#[test]
#[cfg_attr(windows, ignore)]
fn effectful_hello() {
Expand Down Expand Up @@ -1255,21 +1288,6 @@ mod cli_run {
assert_valid_roc_check_status(out.status);
}

#[test]
#[cfg_attr(windows, ignore)]
fn interactive_effects() {
test_roc_app(
"examples/cli",
"effects.roc",
&["hi there!"],
&[],
&[],
"hi there!\nIt is known\n",
UseValgrind::Yes,
TestCliCommands::Run,
)
}

#[test]
#[cfg_attr(windows, ignore)]
// tea = The Elm Architecture
Expand Down

0 comments on commit a5aeb82

Please sign in to comment.