From e95f0035b8c00abf01a063225089658f00c7dca1 Mon Sep 17 00:00:00 2001 From: Marc Addeo Date: Tue, 10 Sep 2024 19:33:37 -0400 Subject: [PATCH] Add test for redefinition error messaging --- tests/error_messages.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/error_messages.rs b/tests/error_messages.rs index 5b66ac3cb9..6ee0ce5b0c 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -109,3 +109,21 @@ fn file_paths_not_in_subdir_are_absolute() { ) .run(); } + +#[test] +fn redefinition_errors_properly_swap_types() { + Test::new() + .write("foo.just", "foo:") + .justfile("foo:\n echo foo\n\nmod foo 'foo.just'") + .status(EXIT_FAILURE) + .stderr(format!( + " +error: Recipe `foo` defined on line 1 is redefined as a module on line 4 + ——▶ justfile:4:5 + │ +4 │ mod foo 'foo.just' + │ ^^^ +", + )) + .run(); +}