From 877897201465f143cd42f4a766b35da073c07261 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 11 Jun 2024 22:10:32 +0200 Subject: [PATCH] Test shell not found error messages (#2145) --- tests/shell.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/shell.rs b/tests/shell.rs index a55fb10b..7096f7ae 100644 --- a/tests/shell.rs +++ b/tests/shell.rs @@ -151,3 +151,39 @@ test! { stderr: "echo bar\necho foo\n", shell: false, } + +#[test] +fn recipe_shell_not_found_error_message() { + Test::new() + .justfile( + " + foo: + @echo bar + ", + ) + .shell(false) + .args(["--shell", "NOT_A_REAL_SHELL"]) + .stderr_regex( + "error: Recipe `foo` could not be run because just could not find the shell: .*\n", + ) + .status(1) + .run(); +} + +#[test] +fn backtick_recipe_shell_not_found_error_message() { + Test::new() + .justfile( + " + bar := `echo bar` + + foo: + echo {{bar}} + ", + ) + .shell(false) + .args(["--shell", "NOT_A_REAL_SHELL"]) + .stderr_regex("(?s)error: Backtick could not be run because just could not find the shell:.*") + .status(1) + .run(); +}