From 1bc3f540359df5e870ea5d33dac17100e34a31d7 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 21 Nov 2023 20:09:06 -0800 Subject: [PATCH] Add test --- tests/error_messages.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/error_messages.rs b/tests/error_messages.rs index 8518651fc3..26f93e8aca 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -56,7 +56,7 @@ fn argument_count_mismatch() { } #[test] -fn file_name_is_indented_if_justfile_is_long() { +fn file_path_is_indented_if_justfile_is_long() { Test::new() .justfile("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfoo") .status(EXIT_FAILURE) @@ -73,7 +73,7 @@ error: Expected '*', ':', '$', identifier, or '+', but found end of file } #[test] -fn filenames_are_relative() { +fn file_paths_are_relative() { Test::new() .justfile("!include foo/bar.just") .write("foo/bar.just", "baz") @@ -90,3 +90,23 @@ error: Expected '*', ':', '$', identifier, or '+', but found end of file ) .run(); } + +#[test] +fn file_paths_not_in_subdir_are_absolute() { + Test::new() + .write("foo/justfile", "!include ../bar.just") + .write("bar.just", "baz") + .no_justfile() + .args(["--unstable", "--justfile", "foo/justfile"]) + .status(EXIT_FAILURE) + .stderr_regex( + " +error: Expected '*', ':', '$', identifier, or '+', but found end of file + --> /.*/bar.just:1:4 + | +1 | baz + | ^ +", + ) + .run(); +}