diff --git a/tests/golden_tests.rs b/tests/golden_tests.rs index 6e746a91d..49d9f94e1 100644 --- a/tests/golden_tests.rs +++ b/tests/golden_tests.rs @@ -73,7 +73,7 @@ fn run_golden_test_dir_multiple(test_name: &str, run: &[&dyn Fn(&str, &Path) -> let walker = WalkDir::new(&root).sort_by_file_name().max_depth(2).into_iter().filter_entry(|e| { let path = e.path(); - path == root || (path.is_file() && path.extension().is_some_and(|x| x == "hvm")) + path == root || path.is_dir() || (path.is_file() && path.extension().is_some_and(|x| x == "hvm")) }); for entry in walker { @@ -318,8 +318,9 @@ fn cli() { args_file.read_to_string(&mut args_buf).expect("Read args"); let args = args_buf.lines(); - let output = std::process::Command::new("cargo").arg("run").args(args).output().expect("Run process"); + let output = + std::process::Command::new("cargo").arg("run").arg("-q").args(args).output().expect("Run process"); - Ok(format!("{}", String::from_utf8_lossy(&output.stdout))) + Ok(format!("{}\n{}", String::from_utf8_lossy(&output.stderr), String::from_utf8_lossy(&output.stdout))) }) } diff --git a/tests/golden_tests/cli/compile_no_opts.args b/tests/golden_tests/cli/compile_no_opts.args new file mode 100644 index 000000000..997cd69b0 --- /dev/null +++ b/tests/golden_tests/cli/compile_no_opts.args @@ -0,0 +1,11 @@ +compile +tests/golden_tests/cli/compile_no_opts.hvm +-Ono-all +-Ono-eta +-Ono-prune +-Ono-ref-to-ref +-Ono-pre-reduce +-Ono-float-combinators +-Ono-simplify-main +-Ono-merge +-Ono-inline diff --git a/tests/golden_tests/cli/compile_no_opts.hvm b/tests/golden_tests/cli/compile_no_opts.hvm new file mode 100644 index 000000000..c6ec074e6 --- /dev/null +++ b/tests/golden_tests/cli/compile_no_opts.hvm @@ -0,0 +1 @@ +main = * diff --git a/tests/golden_tests/cli/compile_wrong_opt.args b/tests/golden_tests/cli/compile_wrong_opt.args new file mode 100644 index 000000000..f00d73fee --- /dev/null +++ b/tests/golden_tests/cli/compile_wrong_opt.args @@ -0,0 +1,3 @@ +compile +tests/golden_tests/cli/compile_wrong_opt.hvm +-Ofoo diff --git a/tests/golden_tests/cli/compile_wrong_opt.hvm b/tests/golden_tests/cli/compile_wrong_opt.hvm new file mode 100644 index 000000000..c6ec074e6 --- /dev/null +++ b/tests/golden_tests/cli/compile_wrong_opt.hvm @@ -0,0 +1 @@ +main = * diff --git a/tests/snapshots/cli__compile_no_opts.hvm.snap b/tests/snapshots/cli__compile_no_opts.hvm.snap new file mode 100644 index 000000000..e04fe3b66 --- /dev/null +++ b/tests/snapshots/cli__compile_no_opts.hvm.snap @@ -0,0 +1,5 @@ +--- +source: tests/golden_tests.rs +input_file: tests/golden_tests/cli/compile_no_opts.hvm +--- +@main = * diff --git a/tests/snapshots/cli__compile_pre_reduce.hvm.snap b/tests/snapshots/cli__compile_pre_reduce.hvm.snap index b68654b6f..e02d96d53 100644 --- a/tests/snapshots/cli__compile_pre_reduce.hvm.snap +++ b/tests/snapshots/cli__compile_pre_reduce.hvm.snap @@ -2,5 +2,8 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/cli/compile_pre_reduce.hvm --- +Warnings: +Unused definition 'I'. + @I = #5 @main = * diff --git a/tests/snapshots/cli__compile_wrong_opt.hvm.snap b/tests/snapshots/cli__compile_wrong_opt.hvm.snap new file mode 100644 index 000000000..a515e011c --- /dev/null +++ b/tests/snapshots/cli__compile_wrong_opt.hvm.snap @@ -0,0 +1,10 @@ +--- +source: tests/golden_tests.rs +input_file: tests/golden_tests/cli/compile_wrong_opt.hvm +--- +error: invalid value 'foo' for '-O ' + [possible values: all, no-all, eta, no-eta, prune, no-prune, ref-to-ref, no-ref-to-ref, pre-reduce, no-pre-reduce, linearize-matches, linearize-matches-extra, no-linearize-matches, float-combinators, no-float-combinators, simplify-main, no-simplify-main, merge, no-merge, inline, no-inline, adt-scott, adt-tagged-scott] + + tip: a similar value exists: 'float-combinators' + +For more information, try '--help'.