Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Nov 22, 2023
1 parent a298fb5 commit 1bc3f54
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/error_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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();
}

0 comments on commit 1bc3f54

Please sign in to comment.