Use box-drawing characters in error messages (#1798)

This commit is contained in:
Casey Rodarmor 2023-12-29 13:25:30 -08:00 committed by GitHub
parent e2c0d86bdd
commit b188882ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 506 additions and 507 deletions

View File

@ -2311,10 +2311,10 @@ mod tests {
.to_string(),
"error: Internal error, this may indicate a bug in just: Lexer presumed character `-`
consider filing an issue: https://github.com/casey/just/issues/new
--> justfile:1:1
|
1 | !
| ^"
justfile:1:1
1 !
^"
);
}
}

View File

@ -57,7 +57,7 @@ impl<'src> ColorDisplay for Token<'src> {
f,
"{:width$}{} {}:{}:{}",
"",
color.context().paint("-->"),
color.context().paint("——▶"),
self.path.display(),
line_number,
self.column.ordinal(),
@ -67,19 +67,19 @@ impl<'src> ColorDisplay for Token<'src> {
f,
"{:width$} {}",
"",
color.context().paint("|"),
color.context().paint(""),
width = line_number_width
)?;
writeln!(
f,
"{} {space_line}",
color.context().paint(&format!("{line_number} |"))
color.context().paint(&format!("{line_number} "))
)?;
write!(
f,
"{:width$} {}",
"",
color.context().paint("|"),
color.context().paint(""),
width = line_number_width
)?;
write!(

View File

@ -33,10 +33,10 @@ fn duplicate_attributes_are_disallowed() {
.stderr(
"
error: Recipe attribute `no-exit-message` first used on line 1 is duplicated on line 2
--> justfile:2:2
|
2 | [no-exit-message]
| ^^^^^^^^^^^^^^^
justfile:2:2
2 [no-exit-message]
^^^^^^^^^^^^^^^
",
)
.status(1)
@ -73,10 +73,10 @@ fn multiple_attributes_one_line_error_message() {
.stderr(
"
error: Expected ']' or ',', but found identifier
--> justfile:1:17
|
1 | [macos, windows linux]
| ^^^^^
justfile:1:17
1 [macos, windows linux]
^^^^^
",
)
.status(1)
@ -97,10 +97,10 @@ fn multiple_attributes_one_line_duplicate_check() {
.stderr(
"
error: Recipe attribute `linux` first used on line 1 is duplicated on line 2
--> justfile:2:2
|
2 | [linux]
| ^^^^^
justfile:2:2
2 [linux]
^^^^^
",
)
.status(1)

View File

@ -27,10 +27,10 @@ fn non_leading_byte_order_mark_produces_error() {
.stderr(
"
error: Expected \'@\', \'[\', comment, end of file, end of line, or identifier, but found byte order mark
--> justfile:3:1
|
3 | \u{feff}
| ^
justfile:3:1
3 \u{feff}
^
")
.status(EXIT_FAILURE)
.run();
@ -43,10 +43,10 @@ fn dont_mention_byte_order_mark_in_errors() {
.stderr(
"
error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{'
--> justfile:1:1
|
1 | {
| ^
justfile:1:1
1 {
^
",
)
.status(EXIT_FAILURE)

View File

@ -61,10 +61,10 @@ test! {
stdout: "",
stderr: "
error: Variable `b` not defined
--> justfile:1:9
|
1 | a := if b == '' { '' } else { '' }
| ^
justfile:1:9
1 a := if b == '' { '' } else { '' }
^
",
status: EXIT_FAILURE,
}
@ -80,10 +80,10 @@ test! {
stdout: "",
stderr: "
error: Variable `b` not defined
--> justfile:1:15
|
1 | a := if '' == b { '' } else { '' }
| ^
justfile:1:15
1 a := if '' == b { '' } else { '' }
^
",
status: EXIT_FAILURE,
}
@ -99,10 +99,10 @@ test! {
stdout: "",
stderr: "
error: Variable `b` not defined
--> justfile:1:20
|
1 | a := if '' == '' { b } else { '' }
| ^
justfile:1:20
1 a := if '' == '' { b } else { '' }
^
",
status: EXIT_FAILURE,
}
@ -118,10 +118,10 @@ test! {
stdout: "",
stderr: "
error: Variable `b` not defined
--> justfile:1:32
|
1 | a := if '' == '' { '' } else { b }
| ^
justfile:1:32
1 a := if '' == '' { '' } else { b }
^
",
status: EXIT_FAILURE,
}
@ -137,10 +137,10 @@ test! {
stdout: "",
stderr: "
error: Expected '!=', '==', '=~', '+', or '/', but found identifier
--> justfile:1:12
|
1 | a := if '' a '' { '' } else { b }
| ^
justfile:1:12
1 a := if '' a '' { '' } else { b }
^
",
status: EXIT_FAILURE,
}
@ -182,10 +182,10 @@ test! {
stdout: "",
stderr: "
error: Expected keyword `else` but found `end of line`
--> justfile:1:54
|
1 | TEST := if path_exists('/bin/bash') == 'true' {'yes'}
| ^
justfile:1:54
1 TEST := if path_exists('/bin/bash') == 'true' {'yes'}
^
",
status: EXIT_FAILURE,
}
@ -198,10 +198,10 @@ test! {
stdout: "",
stderr: "
error: Expected keyword `else` but found identifier `els`
--> justfile:1:55
|
1 | TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'}
| ^^^
justfile:1:55
1 TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'}
^^^
",
status: EXIT_FAILURE,
}

View File

@ -5,10 +5,10 @@ test! {
justfile: "(]",
stderr: "
error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?)
--> justfile:1:2
|
1 | (]
| ^
justfile:1:2
1 (]
^
",
status: EXIT_FAILURE,
}
@ -18,10 +18,10 @@ test! {
justfile: "]",
stderr: "
error: Unexpected closing delimiter `]`
--> justfile:1:1
|
1 | ]
| ^
justfile:1:1
1 ]
^
",
status: EXIT_FAILURE,
}
@ -98,10 +98,10 @@ test! {
stdout: "",
stderr: "
error: Unterminated interpolation
--> justfile:2:8
|
2 | echo {{ (
| ^^
justfile:2:8
2 echo {{ (
^^
",
status: EXIT_FAILURE,
}

View File

@ -5,10 +5,10 @@ test! {
justfile: "[private]\n[linux]\nalias t := test\n\ntest:\n",
stderr: "
error: Alias t has an invalid attribute `linux`
--> justfile:3:7
|
3 | alias t := test
| ^
justfile:3:7
3 alias t := test
^
",
status: EXIT_FAILURE,
}
@ -18,10 +18,10 @@ test! {
justfile: "foo := if '' == '' { '' } arlo { '' }",
stderr: "
error: Expected keyword `else` but found identifier `arlo`
--> justfile:1:27
|
1 | foo := if '' == '' { '' } arlo { '' }
| ^^^^
justfile:1:27
1 foo := if '' == '' { '' } arlo { '' }
^^^^
",
status: EXIT_FAILURE,
}
@ -31,10 +31,10 @@ test! {
justfile: "&~",
stderr: "
error: Expected character `&`
--> justfile:1:2
|
1 | &~
| ^
justfile:1:2
1 &~
^
",
status: EXIT_FAILURE,
}
@ -63,10 +63,10 @@ fn file_path_is_indented_if_justfile_is_long() {
.stderr(
"
error: Expected '*', ':', '$', identifier, or '+', but found end of file
--> justfile:20:4
|
20 | foo
| ^
justfile:20:4
20 foo
^
",
)
.run();
@ -81,10 +81,10 @@ fn file_paths_are_relative() {
.stderr(format!(
"
error: Expected '*', ':', '$', identifier, or '+', but found end of file
--> foo{}bar.just:1:4
|
1 | baz
| ^
foo{}bar.just:1:4
1 baz
^
",
MAIN_SEPARATOR
))
@ -92,6 +92,7 @@ error: Expected '*', ':', '$', identifier, or '+', but found end of file
}
#[test]
#[cfg(not(windows))]
fn file_paths_not_in_subdir_are_absolute() {
Test::new()
.write("foo/justfile", "import '../bar.just'")
@ -99,15 +100,13 @@ fn file_paths_not_in_subdir_are_absolute() {
.no_justfile()
.args(["--justfile", "foo/justfile"])
.status(EXIT_FAILURE)
.stderr_regex(format!(
"
error: Expected '*', ':', '$', identifier, or '+', but found end of file
--> {}.*{}bar.just:1:4
|
1 | baz
| ^
.stderr_regex(
r"error: Expected '\*', ':', '\$', identifier, or '\+', but found end of file
/.*/bar.just:1:4
1 baz
\^
",
MAIN_SEPARATOR, MAIN_SEPARATOR
))
)
.run();
}

View File

@ -146,10 +146,10 @@ fn print_error_from_parent_if_recipe_not_found_in_current() {
.stderr(
"
error: Variable `bar` not defined
--> justfile:2:9
|
2 | echo {{bar}}
| ^^^
justfile:2:9
2 echo {{bar}}
^^^
",
)
.status(EXIT_FAILURE)

View File

@ -88,10 +88,10 @@ foo:
stderr: format!("{} {}\n{}\n{}\n{}\n{}\n",
"error: Call to function `without_extension` failed:",
"Could not extract parent from ``",
" --> justfile:1:8",
" |",
"1 | we := without_extension(\'\')",
" | ^^^^^^^^^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := without_extension(\'\')",
" ^^^^^^^^^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -107,10 +107,10 @@ foo:
stdout: "",
stderr: format!("{}\n{}\n{}\n{}\n{}\n",
"error: Call to function `extension` failed: Could not extract extension from ``",
" --> justfile:1:8",
" |",
"1 | we := extension(\'\')",
" | ^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := extension(\'\')",
" ^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -126,10 +126,10 @@ foo:
stdout: "",
stderr: format!("{}\n{}\n{}\n{}\n{}\n",
"error: Call to function `extension` failed: Could not extract extension from `foo`",
" --> justfile:1:8",
" |",
"1 | we := extension(\'foo\')",
" | ^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := extension(\'foo\')",
" ^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -145,10 +145,10 @@ foo:
stdout: "",
stderr: format!("{}\n{}\n{}\n{}\n{}\n",
"error: Call to function `file_stem` failed: Could not extract file stem from ``",
" --> justfile:1:8",
" |",
"1 | we := file_stem(\'\')",
" | ^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := file_stem(\'\')",
" ^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -164,10 +164,10 @@ foo:
stdout: "",
stderr: format!("{}\n{}\n{}\n{}\n{}\n",
"error: Call to function `file_name` failed: Could not extract file name from ``",
" --> justfile:1:8",
" |",
"1 | we := file_name(\'\')",
" | ^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := file_name(\'\')",
" ^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -184,10 +184,10 @@ foo:
stderr: format!("{} {}\n{}\n{}\n{}\n{}\n",
"error: Call to function `parent_directory` failed:",
"Could not extract parent directory from ``",
" --> justfile:1:8",
" |",
"1 | we := parent_directory(\'\')",
" | ^^^^^^^^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := parent_directory(\'\')",
" ^^^^^^^^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -204,10 +204,10 @@ foo:
stderr: format!("{} {}\n{}\n{}\n{}\n{}\n",
"error: Call to function `parent_directory` failed:",
"Could not extract parent directory from `/`",
" --> justfile:1:8",
" |",
"1 | we := parent_directory(\'/\')",
" | ^^^^^^^^^^^^^^^^").as_str(),
" ——▶ justfile:1:8",
" ",
"1 we := parent_directory(\'/\')",
" ^^^^^^^^^^^^^^^^").as_str(),
status: EXIT_FAILURE,
}
@ -232,10 +232,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Call to function `env_var` failed: environment variable `ZADDY` not present
--> justfile:2:10
|
2 | echo {{env_var('ZADDY')}}
| ^^^^^^^
justfile:2:10
2 echo {{env_var('ZADDY')}}
^^^^^^^
",
status: EXIT_FAILURE,
}
@ -403,10 +403,10 @@ test! {
foo\\
^
error: incomplete escape sequence, reached end of pattern prematurely
--> justfile:2:11
|
2 | echo {{ replace_regex('barbarbar', 'foo\\', 'foo') }}
| ^^^^^^^^^^^^^
justfile:2:11
2 echo {{ replace_regex('barbarbar', 'foo\\', 'foo') }}
^^^^^^^^^^^^^
",
status: EXIT_FAILURE,
}
@ -507,10 +507,10 @@ fn join_argument_count_error() {
.stderr(
"
error: Function `join` called with 1 argument but takes 2 or more
--> justfile:1:6
|
1 | x := join(\'a\')
| ^^^^
justfile:1:6
1 x := join(\'a\')
^^^^
",
)
.status(EXIT_FAILURE)
@ -547,10 +547,10 @@ fn error_errors_with_message() {
.stderr(
"
error: Call to function `error` failed: Thing Not Supported
--> justfile:1:6
|
1 | x := error ('Thing Not Supported')
| ^^^^^
justfile:1:6
1 x := error ('Thing Not Supported')
^^^^^
",
)
.run();

View File

@ -40,10 +40,10 @@ fn missing_import_file_error() {
.stderr(
"
error: Could not find source file for import.
--> justfile:1:8
|
1 | import './import.justfile'
| ^^^^^^^^^^^^^^^^^^^
justfile:1:8
1 import './import.justfile'
^^^^^^^^^^^^^^^^^^^
",
)
.run();
@ -162,10 +162,10 @@ fn include_error() {
.stderr(
"
error: The `!include` directive has been stabilized as `import`
--> justfile:1:1
|
1 | !include foo
| ^
justfile:1:1
1 !include foo
^
",
)
.run();

View File

@ -72,10 +72,10 @@ test! {
",
stderr: "
error: Unknown setting `foo`
--> justfile:1:5
|
1 | set foo
| ^^^
justfile:1:5
1 set foo
^^^
",
status: EXIT_FAILURE,
}
@ -87,10 +87,10 @@ test! {
",
stderr: "
error: Unknown setting `if`
--> justfile:1:5
|
1 | set if := 'foo'
| ^^
justfile:1:5
1 set if := 'foo'
^^
",
status: EXIT_FAILURE,
}
@ -108,10 +108,10 @@ test! {
justfile: "alias foo := bar\nalias foo := baz\n",
stderr: "
error: Alias `foo` first defined on line 1 is redefined on line 2
--> justfile:2:7
|
2 | alias foo := baz
| ^^^
justfile:2:7
2 alias foo := baz
^^^
",
status: EXIT_FAILURE,
}
@ -121,10 +121,10 @@ test! {
justfile: "alias foo := bar\n",
stderr: "
error: Alias `foo` has an unknown target `bar`
--> justfile:1:7
|
1 | alias foo := bar
| ^^^
justfile:1:7
1 alias foo := bar
^^^
",
status: EXIT_FAILURE,
}
@ -134,10 +134,10 @@ test! {
justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo",
stderr: "
error: Alias `foo` defined on line 3 is redefined as a recipe on line 4
--> justfile:4:1
|
4 | foo:
| ^^^
justfile:4:1
4 foo:
^^^
",
status: EXIT_FAILURE,
}
@ -234,10 +234,10 @@ test! {
justfile: "bar:\nhello:\nfoo: bar baaaaaaaz hello",
stderr: "
error: Recipe `foo` has unknown dependency `baaaaaaaz`
--> justfile:3:10
|
3 | foo: bar baaaaaaaz hello
| ^^^^^^^^^
justfile:3:10
3 foo: bar baaaaaaaz hello
^^^^^^^^^
",
status: EXIT_FAILURE,
}
@ -261,10 +261,10 @@ test! {
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
stderr: "
error: Backtick failed with exit code 100
--> justfile:2:6
|
2 | a := `exit 100`
| ^^^^^^^^^^
justfile:2:6
2 a := `exit 100`
^^^^^^^^^^
",
status: 100,
}
@ -274,10 +274,10 @@ test! {
justfile: "b := a\na := `echo hello`\nbar:\n echo '{{`exit 200`}}'",
stderr: "
error: Backtick failed with exit code 200
--> justfile:4:10
|
4 | echo '{{`exit 200`}}'
| ^^^^^^^^^^
justfile:4:10
4 echo '{{`exit 200`}}'
^^^^^^^^^^
",
status: 200,
}
@ -287,10 +287,10 @@ test! {
justfile: "f:\n 無{{`exit 200`}}",
stderr: "
error: Backtick failed with exit code 200
--> justfile:2:7
|
2 | {{`exit 200`}}
| ^^^^^^^^^^
justfile:2:7
2 {{`exit 200`}}
^^^^^^^^^^
",
status: 200,
}
@ -302,10 +302,10 @@ test! {
\techo {{`exit 200`}}
",
stderr: " error: Backtick failed with exit code 200
--> justfile:2:9
|
2 | echo {{`exit 200`}}
| ^^^^^^^^^^
justfile:2:9
2 echo {{`exit 200`}}
^^^^^^^^^^
",
status: 200,
}
@ -317,10 +317,10 @@ test! {
\techo {{\t`exit 200`}}
",
stderr: "error: Backtick failed with exit code 200
--> justfile:2:10
|
2 | echo {{ `exit 200`}}
| ^^^^^^^^^^
justfile:2:10
2 echo {{ `exit 200`}}
^^^^^^^^^^
",
status: 200,
}
@ -333,10 +333,10 @@ test! {
",
stderr: "
error: Backtick failed with exit code 200
--> justfile:2:10
|
2 | echo {{ `exit 200`}}
| ^^^^^^^^^^^^^^^^^
justfile:2:10
2 echo {{ `exit 200`}}
^^^^^^^^^^^^^^^^^
",
status: 200,
}
@ -349,10 +349,10 @@ test! {
",
stderr: "
error: Backtick failed with exit code 200
--> justfile:2:13
|
2 | echo 😬{{`exit 200`}}
| ^^^^^^^^^^
justfile:2:13
2 echo 😬{{`exit 200`}}
^^^^^^^^^^
",
status: 200,
}
@ -365,10 +365,10 @@ test! {
",
stderr: "
error: Backtick failed with exit code 200
--> justfile:2:24
|
2 | echo 😬{{ `exit 200 # abc`}} 😬
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
justfile:2:24
2 echo 😬{{ `exit 200 # abc`}} 😬
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
",
status: 200,
}
@ -389,10 +389,10 @@ test! {
",
stderr: "
error: Backtick failed with exit code 200
--> justfile:10:10
|
10 | echo '{{`exit 200`}}'
| ^^^^^^^^^^
justfile:10:10
10 echo '{{`exit 200`}}'
^^^^^^^^^^
",
status: 200,
}
@ -406,10 +406,10 @@ test! {
stdout: "",
stderr: "
error: Backtick failed with exit code 123
--> justfile:4:9
|
4 | echo {{`exit 123`}}
| ^^^^^^^^^^
justfile:4:9
4 echo {{`exit 123`}}
^^^^^^^^^^
",
status: 123,
}
@ -423,10 +423,10 @@ test! {
stderr: "
echo hello
error: Backtick failed with exit code 123
--> justfile:3:9
|
3 | echo {{`exit 123`}}
| ^^^^^^^^^^
justfile:3:9
3 echo {{`exit 123`}}
^^^^^^^^^^
",
status: 123,
}
@ -440,10 +440,10 @@ a := `exit 222`",
stdout: "",
stderr: "
error: Backtick failed with exit code 222
--> justfile:4:6
|
4 | a := `exit 222`
| ^^^^^^^^^^
justfile:4:6
4 a := `exit 222`
^^^^^^^^^^
",
status: 222,
}
@ -556,10 +556,10 @@ test! {
"#,
stdout: "",
stderr: "error: Unknown start of token:
--> justfile:10:1
|
10 | ^^^
| ^
justfile:10:1
10 ^^^
^
",
status: EXIT_FAILURE,
}
@ -661,7 +661,7 @@ test! {
justfile: "b := a\na := `exit 100`\nbar:\n echo '{{`exit 200`}}'",
args: ("--color", "always"),
stdout: "",
stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1mBacktick failed with exit code 100\u{1b}[0m\n \u{1b}[1;34m-->\u{1b}[0m justfile:2:6\n \u{1b}[1;34m|\u{1b}[0m\n\u{1b}[1;34m2 |\u{1b}[0m a := `exit 100`\n \u{1b}[1;34m|\u{1b}[0m \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n",
stderr: "\u{1b}[1;31merror\u{1b}[0m: \u{1b}[1mBacktick failed with exit code 100\u{1b}[0m\n \u{1b}[1;34m——▶\u{1b}[0m justfile:2:6\n \u{1b}[1;34m│\u{1b}[0m\n\u{1b}[1;34m2 │\u{1b}[0m a := `exit 100`\n \u{1b}[1;34m│\u{1b}[0m \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n",
status: 100,
}
@ -671,10 +671,10 @@ test! {
args: ("--color", "never"),
stdout: "",
stderr: "error: Backtick failed with exit code 100
--> justfile:2:6
|
2 | a := `exit 100`
| ^^^^^^^^^^
justfile:2:6
2 a := `exit 100`
^^^^^^^^^^
",
status: 100,
}
@ -685,10 +685,10 @@ test! {
args: ("--color", "auto"),
stdout: "",
stderr: "error: Backtick failed with exit code 100
--> justfile:2:6
|
2 | a := `exit 100`
| ^^^^^^^^^^
justfile:2:6
2 a := `exit 100`
^^^^^^^^^^
",
status: 100,
}
@ -724,10 +724,10 @@ test! {
stdout: "",
stderr: "error: Found a mix of tabs and spaces in leading whitespace: `␉␠`
Leading whitespace may consist of tabs or spaces, but not both
--> justfile:2:1
|
2 | echo hello
| ^^^^^
justfile:2:1
2 echo hello
^^^^^
",
status: EXIT_FAILURE,
}
@ -737,10 +737,10 @@ test! {
justfile: "bar:\n\t\techo hello\n\t\t\techo goodbye",
stdout: "",
stderr: "error: Recipe line has extra leading whitespace
--> justfile:3:3
|
3 | echo goodbye
| ^^^^^^^^^^^^^^^^
justfile:3:3
3 echo goodbye
^^^^^^^^^^^^^^^^
",
status: EXIT_FAILURE,
}
@ -751,10 +751,10 @@ test! {
stdout: "",
stderr: "error: Recipe line has inconsistent leading whitespace. \
Recipe started with `` but found line with ``
--> justfile:3:1
|
3 | echo goodbye
| ^^^^^
justfile:3:1
3 echo goodbye
^^^^^
",
status: EXIT_FAILURE,
}
@ -764,10 +764,10 @@ test! {
justfile: "bar:\nhello baz arg='foo' bar:",
stdout: "",
stderr: "error: Non-default parameter `bar` follows default parameter
--> justfile:2:21
|
2 | hello baz arg='foo' bar:
| ^^^
justfile:2:21
2 hello baz arg='foo' bar:
^^^
",
status: EXIT_FAILURE,
}
@ -777,10 +777,10 @@ test! {
justfile: "bar:\nhello baz +arg bar:",
stdout: "",
stderr: "error: Parameter `bar` follows variadic parameter
--> justfile:2:16
|
2 | hello baz +arg bar:
| ^^^
justfile:2:16
2 hello baz +arg bar:
^^^
",
status: EXIT_FAILURE,
}
@ -790,10 +790,10 @@ test! {
justfile: "bar:\nhello baz *arg bar:",
stdout: "",
stderr: "error: Parameter `bar` follows variadic parameter
--> justfile:2:16
|
2 | hello baz *arg bar:
| ^^^
justfile:2:16
2 hello baz *arg bar:
^^^
",
status: EXIT_FAILURE,
}
@ -1163,10 +1163,10 @@ bar:"#,
args: ("bar"),
stdout: "",
stderr: r#"error: Call to unknown function `foo`
--> justfile:1:8
|
1 | foo := foo() + "hello"
| ^^^
justfile:1:8
1 foo := foo() + "hello"
^^^
"#,
status: EXIT_FAILURE,
}
@ -1180,10 +1180,10 @@ test! {
args: ("b"),
stdout: "",
stderr: "error: Dependency `a` got 0 arguments but takes 1 argument
--> justfile:2:4
|
2 | b: a
| ^
justfile:2:4
2 b: a
^
",
status: EXIT_FAILURE,
}
@ -1197,10 +1197,10 @@ test! {
args: ("b"),
stdout: "",
stderr: "error: Dependency `a` got 0 arguments but takes at least 1 argument
--> justfile:2:4
|
2 | b: a
| ^
justfile:2:4
2 b: a
^
",
status: EXIT_FAILURE,
}
@ -1214,10 +1214,10 @@ test! {
args: ("b"),
stdout: "",
stderr: "error: Dependency `a` got 3 arguments but takes at most 2 arguments
--> justfile:2:5
|
2 | b: (a '0' '1' '2')
| ^
justfile:2:5
2 b: (a '0' '1' '2')
^
",
status: EXIT_FAILURE,
}
@ -1228,10 +1228,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Recipe `a` has duplicate parameter `foo`
--> justfile:1:7
|
1 | a foo foo:
| ^^^
justfile:1:7
1 a foo foo:
^^^
",
status: EXIT_FAILURE,
}
@ -1242,10 +1242,10 @@ test! {
args: ("b"),
stdout: "",
stderr: "error: Recipe `b` first defined on line 1 is redefined on line 2
--> justfile:2:1
|
2 | b:
| ^
justfile:2:1
2 b:
^
",
status: EXIT_FAILURE,
}
@ -1256,10 +1256,10 @@ test! {
args: ("foo"),
stdout: "",
stderr: "error: Variable `a` has multiple definitions
--> justfile:2:1
|
2 | a := 'hello'
| ^
justfile:2:1
2 a := 'hello'
^
",
status: EXIT_FAILURE,
}
@ -1271,10 +1271,10 @@ test! {
stdout: "",
stderr: "error: Expected '&&', comment, end of file, end of line, \
identifier, or '(', but found string
--> justfile:1:6
|
1 | foo: 'bar'
| ^^^^^
justfile:1:6
1 foo: 'bar'
^^^^^
",
status: EXIT_FAILURE,
}
@ -1285,10 +1285,10 @@ test! {
args: ("foo"),
stdout: "",
stderr: "error: Expected '*', ':', '$', identifier, or '+', but found string
--> justfile:1:5
|
1 | foo 'bar'
| ^^^^^
justfile:1:5
1 foo 'bar'
^^^^^
",
status: EXIT_FAILURE,
}
@ -1299,10 +1299,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Recipe `a` depends on itself
--> justfile:1:4
|
1 | a: a
| ^
justfile:1:4
1 a: a
^
",
status: EXIT_FAILURE,
}
@ -1313,10 +1313,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Recipe `d` has circular dependency `a -> b -> c -> d -> a`
--> justfile:4:4
|
4 | d: a
| ^
justfile:4:4
4 d: a
^
",
status: EXIT_FAILURE,
}
@ -1327,10 +1327,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Variable `z` is defined in terms of itself
--> justfile:1:1
|
1 | z := z
| ^
justfile:1:1
1 z := z
^
",
status: EXIT_FAILURE,
}
@ -1341,10 +1341,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Variable `x` depends on its own value: `x -> y -> z -> x`
--> justfile:1:1
|
1 | x := y
| ^
justfile:1:1
1 x := y
^
",
status: EXIT_FAILURE,
}
@ -1361,10 +1361,10 @@ test! {
args: ("a"),
stdout: "",
stderr: "error: Variable `x` depends on its own value: `x -> y -> x`
--> justfile:2:1
|
2 | x := y
| ^
justfile:2:1
2 x := y
^
",
status: EXIT_FAILURE,
}
@ -1466,10 +1466,10 @@ foo *a +b:
",
stdout: "",
stderr: "error: Expected \':\' or \'=\', but found \'+\'
--> justfile:1:8
|
1 | foo *a +b:
| ^
justfile:1:8
1 foo *a +b:
^
",
status: EXIT_FAILURE,
}
@ -1482,10 +1482,10 @@ foo +a *b:
",
stdout: "",
stderr: "error: Expected \':\' or \'=\', but found \'*\'
--> justfile:1:8
|
1 | foo +a *b:
| ^
justfile:1:8
1 foo +a *b:
^
",
status: EXIT_FAILURE,
}
@ -1516,10 +1516,10 @@ a: x y
",
stdout: "",
stderr: "error: Recipe `a` has unknown dependency `y`
--> justfile:3:6
|
3 | a: x y
| ^
justfile:3:6
3 a: x y
^
",
status: EXIT_FAILURE,
}
@ -1674,10 +1674,10 @@ X := "\'"
"#,
stdout: "",
stderr: r#"error: `\'` is not a valid escape sequence
--> justfile:1:6
|
1 | X := "\'"
| ^^^^
justfile:1:6
1 X := "\'"
^^^^
"#,
status: EXIT_FAILURE,
}
@ -1689,10 +1689,10 @@ test! {
",
stdout: "",
stderr: r#"error: Variable `bar` not defined
--> justfile:1:7
|
1 | foo x=bar:
| ^^^
justfile:1:7
1 foo x=bar:
^^^
"#,
status: EXIT_FAILURE,
}
@ -1704,10 +1704,10 @@ foo x=bar():
",
stdout: "",
stderr: r#"error: Call to unknown function `bar`
--> justfile:1:7
|
1 | foo x=bar():
| ^^^
justfile:1:7
1 foo x=bar():
^^^
"#,
status: EXIT_FAILURE,
}
@ -1761,10 +1761,10 @@ test! {
",
stderr: r#"
error: Unterminated interpolation
--> justfile:2:8
|
2 | echo {{
| ^^
justfile:2:8
2 echo {{
^^
"#,
status: EXIT_FAILURE,
}
@ -1777,10 +1777,10 @@ test! {
",
stderr: r#"
error: Unterminated interpolation
--> justfile:2:8
|
2 | echo {{
| ^^
justfile:2:8
2 echo {{
^^
"#,
status: EXIT_FAILURE,
}
@ -1792,10 +1792,10 @@ assembly_source_files = %(wildcard src/arch/$(arch)/*.s)
",
stderr: r#"
error: Unknown start of token:
--> justfile:1:25
|
1 | assembly_source_files = %(wildcard src/arch/$(arch)/*.s)
| ^
justfile:1:25
1 assembly_source_files = %(wildcard src/arch/$(arch)/*.s)
^
"#,
status: EXIT_FAILURE,
}
@ -1891,10 +1891,10 @@ test! {
",
stderr: "
error: Expected '*', ':', '$', identifier, or '+', but found '='
--> justfile:1:5
|
1 | foo = 'bar'
| ^
justfile:1:5
1 foo = 'bar'
^
",
status: EXIT_FAILURE,
}
@ -2089,10 +2089,10 @@ test! {
stdout: "",
stderr: "
error: Variable `a` not defined
--> justfile:3:9
|
3 | bar a b=a:
| ^
justfile:3:9
3 bar a b=a:
^
",
status: EXIT_FAILURE,
shell: false,

View File

@ -163,10 +163,10 @@ fn modules_use_module_settings() {
.stderr(
"
error: Recipe `foo` first defined on line 2 is redefined on line 3
--> foo.just:3:1
|
3 | foo:
| ^^^
foo.just:3:1
3 foo:
^^^
",
)
.run();
@ -185,10 +185,10 @@ fn modules_conflict_with_recipes() {
.stderr(
"
error: Module `foo` defined on line 1 is redefined as a recipe on line 2
--> justfile:2:1
|
2 | foo:
| ^^^
justfile:2:1
2 foo:
^^^
",
)
.test_round_trip(false)
@ -211,10 +211,10 @@ fn modules_conflict_with_aliases() {
.stderr(
"
error: Module `foo` defined on line 1 is redefined as an alias on line 3
--> justfile:3:7
|
3 | alias foo := bar
| ^^^
justfile:3:7
3 alias foo := bar
^^^
",
)
.test_round_trip(false)
@ -240,10 +240,10 @@ fn modules_conflict_with_other_modules() {
.stderr(
"
error: Module `foo` first defined on line 1 is redefined on line 2
--> justfile:2:5
|
2 | mod foo
| ^^^
justfile:2:5
2 mod foo
^^^
",
)
.arg("--unstable")
@ -366,10 +366,10 @@ fn modules_require_unambiguous_file() {
.stderr(
"
error: Found multiple source files for module `foo`: `foo.just` and `foo/justfile`
--> justfile:1:5
|
1 | mod foo
| ^^^
justfile:1:5
1 mod foo
^^^
",
)
.run();
@ -389,10 +389,10 @@ fn missing_module_file_error() {
.stderr(
"
error: Could not find source file for module `foo`.
--> justfile:1:5
|
1 | mod foo
| ^^^
justfile:1:5
1 mod foo
^^^
",
)
.run();

View File

@ -72,10 +72,10 @@ fn newline_escape_deps_invalid_esc() {
.stderr(
"
error: `\\ ` is not a valid escape sequence
--> justfile:1:11
|
1 | default: a\\ b
| ^
justfile:1:11
1 default: a\\ b
^
",
)
.status(EXIT_FAILURE)
@ -93,10 +93,10 @@ fn newline_escape_unpaired_linefeed() {
.stderr(
"
error: Unpaired carriage return
--> justfile:1:9
|
1 | default:\\\ra
| ^
justfile:1:9
1 default:\\\ra
^
",
)
.status(EXIT_FAILURE)

View File

@ -53,10 +53,10 @@ hello:
"#,
stderr: r#"
error: Unknown attribute `unknown-attribute`
--> justfile:2:2
|
2 | [unknown-attribute]
| ^^^^^^^^^^^^^^^^^
justfile:2:2
2 [unknown-attribute]
^^^^^^^^^^^^^^^^^
"#,
status: EXIT_FAILURE,
}
@ -71,10 +71,10 @@ hello:
"#,
stderr: r#"
error: Expected identifier, but found ']'
--> justfile:2:2
|
2 | []
| ^
justfile:2:2
2 []
^
"#,
status: EXIT_FAILURE,
}
@ -89,10 +89,10 @@ hello:
"#,
stderr: r#"
error: Expected '@', '[', or identifier, but found comment
--> justfile:2:1
|
2 | # This is a doc comment
| ^^^^^^^^^^^^^^^^^^^^^^^
justfile:2:1
2 # This is a doc comment
^^^^^^^^^^^^^^^^^^^^^^^
"#,
status: EXIT_FAILURE,
@ -106,7 +106,7 @@ test! {
hello:
@exit 100
"#,
stderr: "error: Expected '@', '[', or identifier, but found end of line\n --> justfile:2:1\n |\n2 | \n | ^\n",
stderr: "error: Expected '@', '[', or identifier, but found end of line\n ——▶ justfile:2:1\n\n2 │ \n ^\n",
status: EXIT_FAILURE,
}

View File

@ -16,17 +16,17 @@ fn bugfix() {
#[cfg(not(windows))]
const RECURSION_LIMIT_REACHED: &str = "
error: Parsing recursion depth exceeded
--> justfile:1:265
|
1 | foo: (x ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
| ^
justfile:1:265
1 foo: (x ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
^
";
#[cfg(windows)]
const RECURSION_LIMIT_REACHED: &str = "
error: Parsing recursion depth exceeded
--> justfile:1:57
|
1 | foo: (x ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
| ^
justfile:1:57
1 foo: (x ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
^
";

View File

@ -30,10 +30,10 @@ test! {
args: ("--show", "f"),
stderr: "
error: Alias `f` has an unknown target `foo`
--> justfile:1:7
|
1 | alias f := foo
| ^
justfile:1:7
1 alias f := foo
^
",
status: EXIT_FAILURE,
}

View File

@ -48,10 +48,10 @@ fn no_rhs_once() {
.stderr(
"
error: Expected backtick, identifier, '(', '/', or string, but found end of file
--> justfile:1:11
|
1 | x := 'a' /
| ^
justfile:1:11
1 x := 'a' /
^
",
)
.status(EXIT_FAILURE)
@ -70,10 +70,10 @@ fn default_un_parenthesized() {
.stderr(
"
error: Expected '*', ':', '$', identifier, or '+', but found '/'
--> justfile:1:11
|
1 | foo x='a' / 'b':
| ^
justfile:1:11
1 foo x='a' / 'b':
^
",
)
.status(EXIT_FAILURE)
@ -92,10 +92,10 @@ fn no_lhs_un_parenthesized() {
.stderr(
"
error: Expected backtick, identifier, '(', or string, but found '/'
--> justfile:1:7
|
1 | foo x=/ 'a' / 'b':
| ^
justfile:1:7
1 foo x=/ 'a' / 'b':
^
",
)
.status(EXIT_FAILURE)

View File

@ -88,10 +88,10 @@ a:"#,
args: ("a"),
stdout: "",
stderr: "error: `\\q` is not a valid escape sequence
--> justfile:1:6
|
1 | x := \"\\q\"
| ^^^^
justfile:1:6
1 x := \"\\q\"
^^^^
",
status: EXIT_FAILURE,
}
@ -109,10 +109,10 @@ a:
args: ("a"),
stdout: "",
stderr: "error: Variable `foo` not defined
--> justfile:6:11
|
6 | echo '{{foo}}'
| ^^^
justfile:6:11
6 echo '{{foo}}'
^^^
",
status: EXIT_FAILURE,
}
@ -130,10 +130,10 @@ a:
args: ("a"),
stdout: "",
stderr: "error: Variable `bar` not defined
--> justfile:3:13
|
3 | whatever' + bar
| ^^^
justfile:3:13
3 whatever' + bar
^^^
",
status: EXIT_FAILURE,
}
@ -168,10 +168,10 @@ a:
args: ("a"),
stdout: "",
stderr: "error: Variable `b` not defined
--> justfile:5:10
|
5 | echo {{b}}
| ^
justfile:5:10
5 echo {{b}}
^
",
status: EXIT_FAILURE,
}
@ -185,10 +185,10 @@ test! {
stdout: "",
stderr: "
error: Unterminated string
--> justfile:1:6
|
1 | a b= ':
| ^
justfile:1:6
1 a b= ':
^
",
status: EXIT_FAILURE,
}
@ -202,10 +202,10 @@ test! {
stdout: "",
stderr: r#"
error: Unterminated string
--> justfile:1:6
|
1 | a b= ":
| ^
justfile:1:6
1 a b= ":
^
"#,
status: EXIT_FAILURE,
}
@ -218,10 +218,10 @@ test! {
",
stderr: r#"
error: Unterminated backtick
--> justfile:1:8
|
1 | foo a= `echo blaaaaaah:
| ^
justfile:1:8
1 foo a= `echo blaaaaaah:
^
"#,
status: EXIT_FAILURE,
}
@ -235,10 +235,10 @@ test! {
stdout: "",
stderr: "
error: Unterminated string
--> justfile:1:6
|
1 | a b= ''':
| ^^^
justfile:1:6
1 a b= ''':
^^^
",
status: EXIT_FAILURE,
}
@ -252,10 +252,10 @@ test! {
stdout: "",
stderr: r#"
error: Unterminated string
--> justfile:1:6
|
1 | a b= """:
| ^^^
justfile:1:6
1 a b= """:
^^^
"#,
status: EXIT_FAILURE,
}
@ -268,10 +268,10 @@ test! {
",
stderr: r#"
error: Unterminated backtick
--> justfile:1:8
|
1 | foo a= ```echo blaaaaaah:
| ^^^
justfile:1:8
1 foo a= ```echo blaaaaaah:
^^^
"#,
status: EXIT_FAILURE,
}
@ -384,10 +384,10 @@ test! {
",
stderr: "
error: Backticks may not start with `#!`
--> justfile:1:6
|
1 | x := `#!/usr/bin/env sh`
| ^^^^^^^^^^^^^^^^^^^
justfile:1:6
1 x := `#!/usr/bin/env sh`
^^^^^^^^^^^^^^^^^^^
",
status: EXIT_FAILURE,
}

View File

@ -47,10 +47,10 @@ test! {
",
stderr: "
error: Recipe `foo` depends on itself
--> justfile:1:9
|
1 | foo: && foo
| ^^^
justfile:1:9
1 foo: && foo
^^^
",
status: EXIT_FAILURE,
}
@ -62,10 +62,10 @@ test! {
",
stderr: "
error: Recipe `foo` has unknown dependency `bar`
--> justfile:1:9
|
1 | foo: && bar
| ^^^
justfile:1:9
1 foo: && bar
^^^
",
status: EXIT_FAILURE,
}
@ -79,10 +79,10 @@ test! {
",
stderr: "
error: Variable `y` not defined
--> justfile:3:14
|
3 | foo: && (bar y)
| ^
justfile:3:14
3 foo: && (bar y)
^
",
status: EXIT_FAILURE,
}

View File

@ -7,10 +7,10 @@ fn parameter_default_unknown_variable_in_expression() {
.stderr(
"
error: Variable `b` not defined
--> justfile:1:8
|
1 | foo a=(b+''):
| ^
justfile:1:8
1 foo a=(b+''):
^
",
)
.status(EXIT_FAILURE)
@ -28,10 +28,10 @@ fn unknown_variable_in_unary_call() {
.stderr(
"
error: Variable `a` not defined
--> justfile:1:15
|
1 | foo x=env_var(a):
| ^
justfile:1:15
1 foo x=env_var(a):
^
",
)
.status(EXIT_FAILURE)
@ -49,10 +49,10 @@ fn unknown_first_variable_in_binary_call() {
.stderr(
"
error: Variable `a` not defined
--> justfile:1:26
|
1 | foo x=env_var_or_default(a, b):
| ^
justfile:1:26
1 foo x=env_var_or_default(a, b):
^
",
)
.status(EXIT_FAILURE)
@ -70,10 +70,10 @@ fn unknown_second_variable_in_binary_call() {
.stderr(
"
error: Variable `b` not defined
--> justfile:1:30
|
1 | foo x=env_var_or_default('', b):
| ^
justfile:1:30
1 foo x=env_var_or_default('', b):
^
",
)
.status(EXIT_FAILURE)
@ -91,10 +91,10 @@ fn unknown_variable_in_ternary_call() {
.stderr(
"
error: Variable `a` not defined
--> justfile:1:15
|
1 | foo x=replace(a, b, c):
| ^
justfile:1:15
1 foo x=replace(a, b, c):
^
",
)
.status(EXIT_FAILURE)