fix clap error

339884894
This commit is contained in:
Anton-4 2023-03-12 15:50:59 +01:00
parent 24c7bded35
commit 4737a5c01e
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
3 changed files with 46 additions and 20 deletions

View file

@ -13,10 +13,19 @@ mod editor_launch_test {
use roc_utils::root_dir;
use std::io::Read;
// ignored because we don't want to bring up the editor window during regular tests, only on specific CI machines
#[ignore]
#[ignore = "we don't want to bring up the editor window during regular tests, only on specific CI machines"]
#[test]
fn launch() {
fn launch_test() {
launch(None);
// with a file arg
launch(Some("roc-projects/new-roc-project-1/main.roc"));
// with a folder arg
launch(Some("roc-projects/new-roc-project-1"));
}
fn launch(arg_path_str_opt: Option<&str>) {
let root_dir = root_dir();
// The editor expects to be run from the root of the repo, so it can find the cli-platform to init a new project folder.
@ -25,8 +34,14 @@ mod editor_launch_test {
let roc_binary_path = build_roc_bin_cached();
let mut cmd_args = vec![CMD_EDIT];
if let Some(arg_path_str) = arg_path_str_opt {
cmd_args.push(arg_path_str)
}
let mut roc_process = Command::new(roc_binary_path)
.arg(CMD_EDIT)
.args(cmd_args)
.stdout(Stdio::piped())
.spawn()
.expect("Failed to start editor from cli.");