mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
fix editor test
This commit is contained in:
parent
16f32c9409
commit
0605639fa8
2 changed files with 40 additions and 30 deletions
|
@ -8,12 +8,12 @@ mod editor_launch_test {
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
use cli_utils::helpers::build_roc_bin_cached;
|
use cli_utils::helpers::build_roc_bin;
|
||||||
use roc_cli::CMD_EDIT;
|
use roc_cli::CMD_EDIT;
|
||||||
use roc_command_utils::root_dir;
|
use roc_command_utils::root_dir;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
|
||||||
#[ignore = "we don't want to bring up the editor window during regular tests, only on specific CI machines"]
|
#[ignore = "We don't want to bring up the editor window during regular tests, only on specific CI machines."]
|
||||||
#[test]
|
#[test]
|
||||||
fn launch_test() {
|
fn launch_test() {
|
||||||
launch(None);
|
launch(None);
|
||||||
|
@ -32,7 +32,7 @@ mod editor_launch_test {
|
||||||
env::set_current_dir(&root_dir)
|
env::set_current_dir(&root_dir)
|
||||||
.unwrap_or_else(|_| panic!("Failed to set current dir to {:?}", root_dir));
|
.unwrap_or_else(|_| panic!("Failed to set current dir to {:?}", root_dir));
|
||||||
|
|
||||||
let roc_binary_path = build_roc_bin_cached();
|
let roc_binary_path = build_roc_bin(&vec!["--features", "editor"]);
|
||||||
|
|
||||||
let mut cmd_args = vec![CMD_EDIT];
|
let mut cmd_args = vec![CMD_EDIT];
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,15 @@ pub fn build_roc_bin_cached() -> PathBuf {
|
||||||
let roc_binary_path = path_to_roc_binary();
|
let roc_binary_path = path_to_roc_binary();
|
||||||
|
|
||||||
if !roc_binary_path.exists() {
|
if !roc_binary_path.exists() {
|
||||||
|
build_roc_bin(&[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
roc_binary_path
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build_roc_bin(extra_args: &[&str]) -> PathBuf {
|
||||||
|
let roc_binary_path = path_to_roc_binary();
|
||||||
|
|
||||||
// Remove the /target/release/roc part
|
// Remove the /target/release/roc part
|
||||||
let root_project_dir = roc_binary_path
|
let root_project_dir = roc_binary_path
|
||||||
.parent()
|
.parent()
|
||||||
|
@ -50,12 +59,14 @@ pub fn build_roc_bin_cached() -> PathBuf {
|
||||||
|
|
||||||
// cargo build --bin roc
|
// cargo build --bin roc
|
||||||
// (with --release iff the test is being built with --release)
|
// (with --release iff the test is being built with --release)
|
||||||
let args = if cfg!(debug_assertions) {
|
let mut args = if cfg!(debug_assertions) {
|
||||||
vec!["build", "--bin", "roc"]
|
vec!["build", "--bin", "roc"]
|
||||||
} else {
|
} else {
|
||||||
vec!["build", "--release", "--bin", "roc"]
|
vec!["build", "--release", "--bin", "roc"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
args.extend(extra_args);
|
||||||
|
|
||||||
let mut cargo_cmd = cargo();
|
let mut cargo_cmd = cargo();
|
||||||
|
|
||||||
cargo_cmd.current_dir(root_project_dir).args(&args);
|
cargo_cmd.current_dir(root_project_dir).args(&args);
|
||||||
|
@ -72,7 +83,6 @@ pub fn build_roc_bin_cached() -> PathBuf {
|
||||||
String::from_utf8(cargo_output.stderr).unwrap()
|
String::from_utf8(cargo_output.stderr).unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
roc_binary_path
|
roc_binary_path
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue