From 7a104f5a53150b82f4d4c9a580397210a469f858 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 9 Oct 2024 21:57:12 -0700 Subject: [PATCH 01/14] Add ariadne --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + 2 files changed, 12 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 40179f8c0c..10fcede449 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,6 +79,16 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "ariadne" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" +dependencies = [ + "unicode-width 0.1.14", + "yansi", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -549,6 +559,7 @@ name = "just" version = "1.46.0" dependencies = [ "ansi_term", + "ariadne", "blake3", "camino", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 545011120d..76dd644a5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ members = [".", "crates/*"] [dependencies] ansi_term = "0.12.0" +ariadne = "0.4.1" blake3 = { version = "1.5.0", features = ["rayon", "mmap"] } camino = "1.0.4" chrono = "0.4.38" From a9ad80614210689b53e971443e458d4d7f0b14d8 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 9 Oct 2024 23:13:09 -0700 Subject: [PATCH 02/14] Use ariadne https://github.com/casey/just/issues/1323 --- justfile | 3 +- src/compile_error.rs | 108 +++++++++++++++++++++++++++++++++++++++++++ src/error.rs | 7 +++ src/run.rs | 2 +- 4 files changed, 118 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index cfd9400d58..70893ca850 100755 --- a/justfile +++ b/justfile @@ -12,7 +12,7 @@ export JUST_LOG := log watch +args='test': cargo watch --clear --exec '{{ args }}' -[group: 'test'] +[group('test')] test: cargo test --all @@ -34,6 +34,7 @@ run: filter PATTERN: cargo test {{PATTERN}} +[group: 'misc'] [group: 'misc'] build: cargo build diff --git a/src/compile_error.rs b/src/compile_error.rs index 469e73fd84..432dd6d81f 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -26,6 +26,114 @@ impl<'src> CompileError<'src> { } } +pub(crate) fn render_compile_error(error: &CompileError) { + use ariadne::{Label, Report, ReportKind, Source}; + + let token = error.token; + let source = Source::from(token.src); + + let start = token.offset; + let end = token.offset + token.length; + + let path = format!("{}", token.path.display()); + let label = Label::new((&path, start..end)); + + let report = Report::build(ReportKind::Error, &path, start); + + let report = match &*error.kind { + CompileErrorKind::AttributeArgumentCountMismatch { + attribute, + found, + min, + max, + } => { + let label_msg = format!("Found {found} {}", Count("argument", *found)); + + let note = if min == max { + format!("`{attribute}` takes {min} {}", Count("argument", *min)) + } else { + format!("`{attribute}` takes between {min} and {max} arguments") + }; + + report + .with_code("E01") + .with_message("Attribute argument count mismatch") + .with_label(label.with_message(label_msg)) + .with_note(note) + .finish() + } + /* + CompileErrorKind::BacktickShebang => todo!(), + CompileErrorKind::CircularRecipeDependency { recipe, circle } => todo!(), + CompileErrorKind::CircularVariableDependency { variable, circle } => todo!(), + CompileErrorKind::DependencyArgumentCountMismatch { dependency, found, min, max } => todo!(), + CompileErrorKind::Redefinition { first, first_type, name, second_type } => todo!(), + */ + CompileErrorKind::DuplicateAttribute { attribute, first } => { + let original_label = source + .line(*first) + .map(|line| Label::new((&path, line.span())).with_message("original")); + + let mut report = report + .with_code("E02") + .with_message(format!("Duplicate attribute `{attribute}`")); + if let Some(original) = original_label { + report = report.with_label(original); + } + report.with_label(label.with_message("duplicate")).finish() + } + _ => { + let message = format!("{error}"); + report.with_message(message).with_label(label).finish() + } /* + CompileErrorKind::DuplicateParameter { recipe, parameter } => todo!(), + CompileErrorKind::DuplicateSet { setting, first } => todo!(), + CompileErrorKind::DuplicateVariable { variable } => todo!(), + CompileErrorKind::DuplicateUnexport { variable } => todo!(), + CompileErrorKind::ExpectedKeyword { expected, found } => todo!(), + CompileErrorKind::ExportUnexported { variable } => todo!(), + CompileErrorKind::ExtraLeadingWhitespace => todo!(), + CompileErrorKind::ExtraneousAttributes { count } => todo!(), + CompileErrorKind::FunctionArgumentCountMismatch { function, found, expected } => todo!(), + CompileErrorKind::Include => todo!(), + CompileErrorKind::InconsistentLeadingWhitespace { expected, found } => todo!(), + CompileErrorKind::Internal { message } => todo!(), + CompileErrorKind::InvalidAttribute { item_kind, item_name, attribute } => todo!(), + CompileErrorKind::InvalidEscapeSequence { character } => todo!(), + CompileErrorKind::MismatchedClosingDelimiter { close, open, open_line } => todo!(), + CompileErrorKind::MixedLeadingWhitespace { whitespace } => todo!(), + CompileErrorKind::ParameterFollowsVariadicParameter { parameter } => todo!(), + CompileErrorKind::ParsingRecursionDepthExceeded => todo!(), + CompileErrorKind::RequiredParameterFollowsDefaultParameter { parameter } => todo!(), + CompileErrorKind::ShebangAndScriptAttribute { recipe } => todo!(), + CompileErrorKind::ShellExpansion { err } => todo!(), + CompileErrorKind::UndefinedVariable { variable } => todo!(), + CompileErrorKind::UnexpectedCharacter { expected } => todo!(), + CompileErrorKind::UnexpectedClosingDelimiter { close } => todo!(), + CompileErrorKind::UnexpectedEndOfToken { expected } => todo!(), + CompileErrorKind::UnexpectedToken { expected, found } => todo!(), + CompileErrorKind::UnicodeEscapeCharacter { character } => todo!(), + CompileErrorKind::UnicodeEscapeDelimiter { character } => todo!(), + CompileErrorKind::UnicodeEscapeEmpty => todo!(), + CompileErrorKind::UnicodeEscapeLength { hex } => todo!(), + CompileErrorKind::UnicodeEscapeRange { hex } => todo!(), + CompileErrorKind::UnicodeEscapeUnterminated => todo!(), + CompileErrorKind::UnknownAliasTarget { alias, target } => todo!(), + CompileErrorKind::UnknownAttribute { attribute } => todo!(), + CompileErrorKind::UnknownDependency { recipe, unknown } => todo!(), + CompileErrorKind::UnknownFunction { function } => todo!(), + CompileErrorKind::UnknownSetting { setting } => todo!(), + CompileErrorKind::UnknownStartOfToken => todo!(), + CompileErrorKind::UnpairedCarriageReturn => todo!(), + CompileErrorKind::UnterminatedBacktick => todo!(), + CompileErrorKind::UnterminatedInterpolation => todo!(), + CompileErrorKind::UnterminatedString => todo!(), + */ + }; + + report.eprint((&path, source)).unwrap(); +} + fn capitalize(s: &str) -> String { let mut chars = s.chars(); match chars.next() { diff --git a/src/error.rs b/src/error.rs index 81a6ef5f9e..a97aef9805 100644 --- a/src/error.rs +++ b/src/error.rs @@ -822,6 +822,13 @@ impl ColorDisplay for Error<'_> { } } +pub(crate) fn render_error(error: &Error, color: Color) { + match error { + Error::Compile { compile_error } => compile_error::render_compile_error(compile_error), + _ => eprintln!("{}", error.color_display(color.stderr())), + } +} + fn format_cmd(binary: &OsString, arguments: &Vec) -> String { iter::once(binary) .chain(arguments) diff --git a/src/run.rs b/src/run.rs index 056c9fa72d..ceec82cd63 100644 --- a/src/run.rs +++ b/src/run.rs @@ -29,7 +29,7 @@ pub fn run(args: impl Iterator + Clone>) -> Result<() }) .map_err(|error| { if !verbosity.quiet() && error.print_message() { - eprintln!("{}", error.color_display(color.stderr())); + crate::error::render_error(&error, color); } error.code().unwrap_or(EXIT_FAILURE) }) From 11bdbe1639452f149213c82432427378a6f3ba45 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 2 Dec 2024 02:57:32 -0800 Subject: [PATCH 03/14] Handle colors correctly --- Cargo.lock | 10 +++++-- justfile | 1 - src/compile_error.rs | 64 +++++--------------------------------------- src/error.rs | 2 +- tests/string.rs | 10 +++---- 5 files changed, 20 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10fcede449..3b8b67089e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,7 +461,7 @@ version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" dependencies = [ - "unicode-width", + "unicode-width 0.2.2", ] [[package]] @@ -594,7 +594,7 @@ dependencies = [ "tempfile", "temptree", "typed-arena", - "unicode-width", + "unicode-width 0.2.2", "uuid", "which", ] @@ -1118,6 +1118,12 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-width" version = "0.2.2" diff --git a/justfile b/justfile index 70893ca850..7cb0da22f0 100755 --- a/justfile +++ b/justfile @@ -34,7 +34,6 @@ run: filter PATTERN: cargo test {{PATTERN}} -[group: 'misc'] [group: 'misc'] build: cargo build diff --git a/src/compile_error.rs b/src/compile_error.rs index 432dd6d81f..a92718ad56 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -26,8 +26,8 @@ impl<'src> CompileError<'src> { } } -pub(crate) fn render_compile_error(error: &CompileError) { - use ariadne::{Label, Report, ReportKind, Source}; +pub(crate) fn render_compile_error(error: &CompileError, color: Color) { + use ariadne::{Config, Label, Report, ReportKind, Source}; let token = error.token; let source = Source::from(token.src); @@ -38,7 +38,8 @@ pub(crate) fn render_compile_error(error: &CompileError) { let path = format!("{}", token.path.display()); let label = Label::new((&path, start..end)); - let report = Report::build(ReportKind::Error, &path, start); + let config = Config::default().with_color(color.stderr().active()); + let report = Report::build(ReportKind::Error, &path, start).with_config(config); let report = match &*error.kind { CompileErrorKind::AttributeArgumentCountMismatch { @@ -56,27 +57,17 @@ pub(crate) fn render_compile_error(error: &CompileError) { }; report - .with_code("E01") .with_message("Attribute argument count mismatch") .with_label(label.with_message(label_msg)) .with_note(note) .finish() } - /* - CompileErrorKind::BacktickShebang => todo!(), - CompileErrorKind::CircularRecipeDependency { recipe, circle } => todo!(), - CompileErrorKind::CircularVariableDependency { variable, circle } => todo!(), - CompileErrorKind::DependencyArgumentCountMismatch { dependency, found, min, max } => todo!(), - CompileErrorKind::Redefinition { first, first_type, name, second_type } => todo!(), - */ CompileErrorKind::DuplicateAttribute { attribute, first } => { let original_label = source .line(*first) .map(|line| Label::new((&path, line.span())).with_message("original")); - let mut report = report - .with_code("E02") - .with_message(format!("Duplicate attribute `{attribute}`")); + let mut report = report.with_message(format!("Duplicate attribute `{attribute}`")); if let Some(original) = original_label { report = report.with_label(original); } @@ -85,50 +76,7 @@ pub(crate) fn render_compile_error(error: &CompileError) { _ => { let message = format!("{error}"); report.with_message(message).with_label(label).finish() - } /* - CompileErrorKind::DuplicateParameter { recipe, parameter } => todo!(), - CompileErrorKind::DuplicateSet { setting, first } => todo!(), - CompileErrorKind::DuplicateVariable { variable } => todo!(), - CompileErrorKind::DuplicateUnexport { variable } => todo!(), - CompileErrorKind::ExpectedKeyword { expected, found } => todo!(), - CompileErrorKind::ExportUnexported { variable } => todo!(), - CompileErrorKind::ExtraLeadingWhitespace => todo!(), - CompileErrorKind::ExtraneousAttributes { count } => todo!(), - CompileErrorKind::FunctionArgumentCountMismatch { function, found, expected } => todo!(), - CompileErrorKind::Include => todo!(), - CompileErrorKind::InconsistentLeadingWhitespace { expected, found } => todo!(), - CompileErrorKind::Internal { message } => todo!(), - CompileErrorKind::InvalidAttribute { item_kind, item_name, attribute } => todo!(), - CompileErrorKind::InvalidEscapeSequence { character } => todo!(), - CompileErrorKind::MismatchedClosingDelimiter { close, open, open_line } => todo!(), - CompileErrorKind::MixedLeadingWhitespace { whitespace } => todo!(), - CompileErrorKind::ParameterFollowsVariadicParameter { parameter } => todo!(), - CompileErrorKind::ParsingRecursionDepthExceeded => todo!(), - CompileErrorKind::RequiredParameterFollowsDefaultParameter { parameter } => todo!(), - CompileErrorKind::ShebangAndScriptAttribute { recipe } => todo!(), - CompileErrorKind::ShellExpansion { err } => todo!(), - CompileErrorKind::UndefinedVariable { variable } => todo!(), - CompileErrorKind::UnexpectedCharacter { expected } => todo!(), - CompileErrorKind::UnexpectedClosingDelimiter { close } => todo!(), - CompileErrorKind::UnexpectedEndOfToken { expected } => todo!(), - CompileErrorKind::UnexpectedToken { expected, found } => todo!(), - CompileErrorKind::UnicodeEscapeCharacter { character } => todo!(), - CompileErrorKind::UnicodeEscapeDelimiter { character } => todo!(), - CompileErrorKind::UnicodeEscapeEmpty => todo!(), - CompileErrorKind::UnicodeEscapeLength { hex } => todo!(), - CompileErrorKind::UnicodeEscapeRange { hex } => todo!(), - CompileErrorKind::UnicodeEscapeUnterminated => todo!(), - CompileErrorKind::UnknownAliasTarget { alias, target } => todo!(), - CompileErrorKind::UnknownAttribute { attribute } => todo!(), - CompileErrorKind::UnknownDependency { recipe, unknown } => todo!(), - CompileErrorKind::UnknownFunction { function } => todo!(), - CompileErrorKind::UnknownSetting { setting } => todo!(), - CompileErrorKind::UnknownStartOfToken => todo!(), - CompileErrorKind::UnpairedCarriageReturn => todo!(), - CompileErrorKind::UnterminatedBacktick => todo!(), - CompileErrorKind::UnterminatedInterpolation => todo!(), - CompileErrorKind::UnterminatedString => todo!(), - */ + } }; report.eprint((&path, source)).unwrap(); diff --git a/src/error.rs b/src/error.rs index a97aef9805..3d582ffe1a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -824,7 +824,7 @@ impl ColorDisplay for Error<'_> { pub(crate) fn render_error(error: &Error, color: Color) { match error { - Error::Compile { compile_error } => compile_error::render_compile_error(compile_error), + Error::Compile { compile_error } => compile_error::render_compile_error(compile_error, color), _ => eprintln!("{}", error.color_display(color.stderr())), } } diff --git a/tests/string.rs b/tests/string.rs index 2aaa243ae1..68f2ae4b51 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -596,11 +596,11 @@ fn unicode_escape_non_hex() { .args(["--evaluate", "x"]) .stderr( r#" -error: expected hex digit [0-9A-Fa-f] but found `o` - ——▶ justfile:1:6 - │ -1 │ x := "\u{foo}" - │ ^^^^^^^^^ +Error: expected hex digit [0-9A-Fa-f] but found `o` + ╭─[justfile:1:6] + │ + 1 │ x := "\u{foo}" +───╯ "#, ) .failure(); From a6841863af2b0b6157a68a5082838e0f3ee74b49 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 2 Dec 2024 21:26:43 -0800 Subject: [PATCH 04/14] Tests --- tests/string.rs | 10 +++++----- tests/test.rs | 3 ++- tests/working_directory.rs | 12 ++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/string.rs b/tests/string.rs index 68f2ae4b51..d10e9e76f4 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -630,11 +630,11 @@ fn unicode_escape_too_long() { .args(["--evaluate", "x"]) .stderr( r#" -error: unicode escape sequence starting with `\u{FFFFFFF` longer than six hex digits - ——▶ justfile:1:6 - │ -1 │ x := "\u{FFFFFFFFFF}" - │ ^^^^^^^^^^^^^^^^ +Error: unicode escape sequence starting with `\u{FFFFFFF` longer than six hex digits + ╭─[justfile:1:6] + │ + 1 │ x := "\u{FFFFFFFFFF}" +───╯ "#, ) .failure(); diff --git a/tests/test.rs b/tests/test.rs index 37161d30d6..6980f56edd 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -218,7 +218,8 @@ impl Test { fn compare_string(name: &str, have: &str, want: &str) -> bool { let equal = have == want; if !equal { - eprintln!("Bad {name}: {}", StrComparison::new(&have, &want)); + //eprintln!("Bad {name}: {}", StrComparison::new(&have, &want)); + eprintln!("Bad {name}:\n{}||\n-------------\n{}||\n=========", &have, &want); } equal } diff --git a/tests/working_directory.rs b/tests/working_directory.rs index c88d96c4a0..2eeb7cc7a1 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -380,12 +380,12 @@ fn attribute_with_nocd_is_forbidden() { ) .stderr( " - error: Recipe `bar` has both `[no-cd]` and `[working-directory]` attributes - ——▶ justfile:3:1 - │ - 3 │ bar: - │ ^^^ - ", +Error: Recipe `bar` has both `[no-cd]` and `[working-directory]` attributes + ╭─[justfile:3:1] + │ + 3 │ bar: +───╯ +" ) .failure(); } From d74eafc48e24e707413f6683980f35c6f870a033 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 00:42:49 -0800 Subject: [PATCH 05/14] Update tests for ariadne error format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update all integration test stderr expectations to match ariadne's output format, which uses '╭─[file:line:col]' and '───╯' instead of the previous '——▶' and '^^^^' format. Also remove unused `StrComparison` import from tests/test.rs. Co-Authored-By: Claude Sonnet 4.6 --- tests/alias.rs | 15 +- tests/allow_missing.rs | 15 +- tests/arg_attribute.rs | 124 +++----- tests/assignment.rs | 45 ++- tests/attributes.rs | 181 +++++------ tests/byte_order_mark.rs | 29 +- tests/conditional.rs | 105 +++---- tests/confirm.rs | 19 +- tests/default.rs | 15 +- tests/delimiters.rs | 30 +- tests/dependencies.rs | 42 ++- tests/error_messages.rs | 96 +++--- tests/fallback.rs | 15 +- tests/format_string.rs | 45 ++- tests/functions.rs | 45 ++- tests/ignore_comments.rs | 15 +- tests/imports.rs | 15 +- tests/interpolation.rs | 15 +- tests/misc.rs | 560 +++++++++++++++-------------------- tests/modules.rs | 67 ++--- tests/newline_escape.rs | 30 +- tests/no_exit_message.rs | 75 ++--- tests/options.rs | 165 +++++------ tests/parameters.rs | 15 +- tests/parser.rs | 30 +- tests/recursion_limit.rs | 13 +- tests/settings.rs | 150 ++++------ tests/shell_expansion.rs | 29 +- tests/show.rs | 15 +- tests/slash_operator.rs | 45 ++- tests/string.rs | 236 ++++++--------- tests/subsequents.rs | 45 ++- tests/test.rs | 2 +- tests/undefined_variables.rs | 75 ++--- tests/unexport.rs | 30 +- tests/working_directory.rs | 19 +- 36 files changed, 1029 insertions(+), 1438 deletions(-) diff --git a/tests/alias.rs b/tests/alias.rs index f69f08c3b9..6474f9667c 100644 --- a/tests/alias.rs +++ b/tests/alias.rs @@ -32,15 +32,12 @@ fn unknown_nested_alias() { ", ) .arg("b") - .stderr( - "\ - error: Alias `b` has an unknown target `foo::bar::baz` - ——▶ justfile:3:7 - │ -3 │ alias b := foo::bar::baz - │ ^ -", - ) + .stderr(r#"Error: Alias `b` has an unknown target `foo::bar::baz` + ╭─[justfile:3:7] + │ + 3 │ alias b := foo::bar::baz +───╯ +"#) .failure(); } diff --git a/tests/allow_missing.rs b/tests/allow_missing.rs index 237b013fcf..ecbfc583cb 100644 --- a/tests/allow_missing.rs +++ b/tests/allow_missing.rs @@ -25,15 +25,12 @@ fn allow_missing_does_not_apply_to_compilation_errors() { Test::new() .justfile("bar: foo") .args(["--allow-missing", "foo"]) - .stderr( - " - error: Recipe `bar` has unknown dependency `foo` - ——▶ justfile:1:6 - │ - 1 │ bar: foo - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `bar` has unknown dependency `foo` + ╭─[justfile:1:6] + │ + 1 │ bar: foo +───╯ +"#) .failure(); } diff --git a/tests/arg_attribute.rs b/tests/arg_attribute.rs index 59d8333a77..ab4d73e8bf 100644 --- a/tests/arg_attribute.rs +++ b/tests/arg_attribute.rs @@ -76,19 +76,12 @@ fn pattern_invalid_regex_error() { foo bar: ", ) - .stderr( - " - error: Failed to parse argument pattern - ——▶ justfile:1:21 - │ - 1 │ [arg('bar', pattern='{')] - │ ^^^ - caused by: regex parse error: - { - ^ - error: repetition operator missing expression - ", - ) + .stderr(r#"Error: Failed to parse argument pattern + ╭─[justfile:1:21] + │ + 1 │ [arg('bar', pattern='{')] +───╯ +"#) .failure(); } @@ -122,15 +115,12 @@ fn duplicate_attribute_error() { ", ) .args(["foo", "BAR"]) - .stderr( - " - error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 - ——▶ justfile:2:2 - │ - 2 │ [arg('bar', pattern='BAR')] - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 + ╭─[justfile:2:2] + │ + 2 │ [arg('bar', pattern='BAR')] +───╯ +"#) .failure(); } @@ -144,15 +134,12 @@ fn extra_keyword_error() { ", ) .args(["foo", "BAR"]) - .stderr( - " - error: Unknown keyword `foo` for `arg` attribute - ——▶ justfile:1:28 - │ - 1 │ [arg('bar', pattern='BAR', foo='foo')] - │ ^^^ - ", - ) + .stderr(r#"Error: Unknown keyword `foo` for `arg` attribute + ╭─[justfile:1:28] + │ + 1 │ [arg('bar', pattern='BAR', foo='foo')] +───╯ +"#) .failure(); } @@ -166,15 +153,12 @@ fn unknown_argument_error() { ", ) .arg("foo") - .stderr( - " - error: Argument attribute for undefined argument `bar` - ——▶ justfile:1:6 - │ - 1 │ [arg('bar', pattern='BAR')] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Argument attribute for undefined argument `bar` + ╭─[justfile:1:6] + │ + 1 │ [arg('bar', pattern='BAR')] +───╯ +"#) .failure(); } @@ -220,15 +204,12 @@ fn positional_arguments_cannot_follow_keyword_arguments() { ", ) .args(["foo", "BAR"]) - .stderr( - " - error: Positional attribute arguments cannot follow keyword attribute arguments - ——▶ justfile:1:21 - │ - 1 │ [arg(pattern='BAR', 'bar')] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Positional attribute arguments cannot follow keyword attribute arguments + ╭─[justfile:1:21] + │ + 1 │ [arg(pattern='BAR', 'bar')] +───╯ +"#) .failure(); } @@ -351,15 +332,12 @@ fn pattern_requires_value() { foo bar: ", ) - .stderr( - " - error: Attribute key `pattern` requires value - ——▶ justfile:1:13 - │ - 1 │ [arg('bar', pattern)] - │ ^^^^^^^ - ", - ) + .stderr(r#"Error: Attribute key `pattern` requires value + ╭─[justfile:1:13] + │ + 1 │ [arg('bar', pattern)] +───╯ +"#) .failure(); } @@ -372,15 +350,12 @@ fn short_requires_value() { foo bar: ", ) - .stderr( - " - error: Attribute key `short` requires value - ——▶ justfile:1:13 - │ - 1 │ [arg('bar', short)] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Attribute key `short` requires value + ╭─[justfile:1:13] + │ + 1 │ [arg('bar', short)] +───╯ +"#) .failure(); } @@ -393,14 +368,11 @@ fn value_requires_value() { foo bar: ", ) - .stderr( - " - error: Attribute key `value` requires value - ——▶ justfile:1:19 - │ - 1 │ [arg('bar', long, value)] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Attribute key `value` requires value + ╭─[justfile:1:19] + │ + 1 │ [arg('bar', long, value)] +───╯ +"#) .failure(); } diff --git a/tests/assignment.rs b/tests/assignment.rs index 4269bb1cf1..0309048825 100644 --- a/tests/assignment.rs +++ b/tests/assignment.rs @@ -8,15 +8,12 @@ fn set_export_parse_error() { set export := fals ", ) - .stderr( - " - error: Expected keyword `true` or `false` but found identifier `fals` - ——▶ justfile:1:15 - │ - 1 │ set export := fals - │ ^^^^ - ", - ) + .stderr(r#"Error: Expected keyword `true` or `false` but found identifier `fals` + ╭─[justfile:1:15] + │ + 1 │ set export := fals +───╯ +"#) .failure(); } @@ -28,15 +25,12 @@ fn set_export_parse_error_eol() { set export := ", ) - .stderr( - " - error: Expected identifier, but found end of line - ——▶ justfile:1:14 - │ - 1 │ set export := - │ ^ - ", - ) + .stderr(r#"Error: Expected identifier, but found end of line + ╭─[justfile:1:14] + │ + 1 │ set export := +───╯ +"#) .failure(); } @@ -50,14 +44,11 @@ fn invalid_attributes_are_an_error() { ", ) .args(["--evaluate", "x"]) - .stderr( - " - error: Assignment `x` has invalid attribute `group` - ——▶ justfile:2:1 - │ - 2 │ x := 'foo' - │ ^ - ", - ) + .stderr(r#"Error: Assignment `x` has invalid attribute `group` + ╭─[justfile:2:1] + │ + 2 │ x := 'foo' +───╯ +"#) .failure(); } diff --git a/tests/attributes.rs b/tests/attributes.rs index 408381282a..fdc227a2d6 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -30,15 +30,17 @@ fn duplicate_attributes_are_disallowed() { echo bar ", ) - .stderr( - " - error: Recipe attribute `no-exit-message` first used on line 1 is duplicated on line 2 - ——▶ justfile:2:2 - │ - 2 │ [no-exit-message] - │ ^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Duplicate attribute `no-exit-message` + ╭─[justfile:2:2] + │ + 1 │ [no-exit-message] + │ ─────────┬──────── + │ ╰────────── original + 2 │ [no-exit-message] + │ ───────┬─────── + │ ╰───────── duplicate +───╯ +"#) .failure(); } @@ -68,15 +70,12 @@ fn multiple_attributes_one_line_error_message() { exit 1 ", ) - .stderr( - " - error: Expected ']', ':', ',', or '(', but found identifier - ——▶ justfile:1:16 - │ - 1 │ [macos,windows linux,openbsd] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Expected ']', ':', ',', or '(', but found identifier + ╭─[justfile:1:16] + │ + 1 │ [macos,windows linux,openbsd] +───╯ +"#) .failure(); } @@ -91,15 +90,17 @@ fn multiple_attributes_one_line_duplicate_check() { exit 1 ", ) - .stderr( - " - error: Recipe attribute `linux` first used on line 1 is duplicated on line 2 - ——▶ justfile:2:2 - │ - 2 │ [linux] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Duplicate attribute `linux` + ╭─[justfile:2:2] + │ + 1 │ [macos, windows, linux, openbsd] + │ ────────────────┬──────────────── + │ ╰────────────────── original + 2 │ [linux] + │ ──┬── + │ ╰──── duplicate +───╯ +"#) .failure(); } @@ -113,15 +114,16 @@ fn unexpected_attribute_argument() { exit 1 ", ) - .stderr( - " - error: Attribute `private` got 1 argument but takes 0 arguments - ——▶ justfile:1:2 - │ - 1 │ [private('foo')] - │ ^^^^^^^ - ", - ) + .stderr(r#"Error: Attribute argument count mismatch + ╭─[justfile:1:2] + │ + 1 │ [private('foo')] + │ ───┬─── + │ ╰───── Found 1 argument + │ + │ Note: `private` takes 0 arguments +───╯ +"#) .failure(); } @@ -167,15 +169,16 @@ fn expected_metadata_attribute_argument() { exit 1 ", ) - .stderr( - " - error: Attribute `metadata` got 0 arguments but takes at least 1 argument - ——▶ justfile:1:2 - │ - 1 │ [metadata] - │ ^^^^^^^^ - ", - ) + .stderr(r#"Error: Attribute argument count mismatch + ╭─[justfile:1:2] + │ + 1 │ [metadata] + │ ────┬─── + │ ╰───── Found 0 arguments + │ + │ Note: `metadata` takes between 1 and 18446744073709551615 arguments +───╯ +"#) .failure(); } @@ -267,15 +270,12 @@ fn extension_on_linewise_error() { baz: ", ) - .stderr( - " - error: Recipe `baz` has invalid attribute `extension` - ——▶ justfile:2:1 - │ - 2 │ baz: - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `baz` has invalid attribute `extension` + ╭─[justfile:2:1] + │ + 2 │ baz: +───╯ +"#) .failure(); } @@ -289,15 +289,17 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { baz: ", ) - .stderr( - " - error: Recipe attribute `confirm` first used on line 1 is duplicated on line 2 - ——▶ justfile:2:2 - │ - 2 │ [confirm: 'no'] - │ ^^^^^^^ -", - ) + .stderr(r#"Error: Duplicate attribute `confirm` + ╭─[justfile:2:2] + │ + 1 │ [confirm: 'yes'] + │ ────────┬──────── + │ ╰────────── original + 2 │ [confirm: 'no'] + │ ───┬─── + │ ╰───── duplicate +───╯ +"#) .failure(); } @@ -391,15 +393,16 @@ fn env_attribute_too_few_arguments() { echo bar ", ) - .stderr( - " - error: Attribute `env` got 1 argument but takes 2 arguments - ——▶ justfile:1:2 - │ - 1 │ [env('MY_VAR')] - │ ^^^ -", - ) + .stderr(r#"Error: Attribute argument count mismatch + ╭─[justfile:1:2] + │ + 1 │ [env('MY_VAR')] + │ ─┬─ + │ ╰─── Found 1 argument + │ + │ Note: `env` takes 2 arguments +───╯ +"#) .failure(); } @@ -413,15 +416,16 @@ fn env_attribute_too_many_arguments() { echo bar ", ) - .stderr( - " - error: Attribute `env` got 3 arguments but takes 2 arguments - ——▶ justfile:1:2 - │ - 1 │ [env('A', 'B', 'C')] - │ ^^^ -", - ) + .stderr(r#"Error: Attribute argument count mismatch + ╭─[justfile:1:2] + │ + 1 │ [env('A', 'B', 'C')] + │ ─┬─ + │ ╰─── Found 3 arguments + │ + │ Note: `env` takes 2 arguments +───╯ +"#) .failure(); } @@ -436,14 +440,11 @@ fn env_attribute_duplicate_error() { @echo $VAR1 ", ) - .stderr( - " - error: Environment variable `VAR1` first set on line 1 is set again on line 2 - ——▶ justfile:2:2 - │ - 2 │ [env('VAR1', 'value 2')] - │ ^^^ -", - ) + .stderr(r#"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 + ╭─[justfile:2:2] + │ + 2 │ [env('VAR1', 'value 2')] +───╯ +"#) .failure(); } diff --git a/tests/byte_order_mark.rs b/tests/byte_order_mark.rs index 39269e89dc..20d0aef16a 100644 --- a/tests/byte_order_mark.rs +++ b/tests/byte_order_mark.rs @@ -24,14 +24,12 @@ fn non_leading_byte_order_mark_produces_error() { \u{feff} ", ) - .stderr( - " - error: Expected \'@\', \'[\', comment, end of file, end of line, or identifier, but found byte order mark - ——▶ justfile:3:1 - │ - 3 │ \u{feff} - │ ^ - ") + .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found byte order mark + ╭─[justfile:3:1] + │ + │ +───╯ +"#) .failure(); } @@ -39,14 +37,11 @@ fn non_leading_byte_order_mark_produces_error() { fn dont_mention_byte_order_mark_in_errors() { Test::new() .justfile("{") - .stderr( - " - error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' - ——▶ justfile:1:1 - │ - 1 │ { - │ ^ - ", - ) + .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' + ╭─[justfile:1:1] + │ + 1 │ { +───╯ +"#) .failure(); } diff --git a/tests/conditional.rs b/tests/conditional.rs index 6cee81468f..0378f31be1 100644 --- a/tests/conditional.rs +++ b/tests/conditional.rs @@ -81,15 +81,12 @@ fn undefined_lhs() { echo {{ a }} ", ) - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:9 - │ - 1 │ a := if b == '' { '' } else { '' } - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:9] + │ + 1 │ a := if b == '' { '' } else { '' } +───╯ +"#) .failure(); } @@ -104,15 +101,12 @@ fn undefined_rhs() { echo {{ a }} ", ) - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:15 - │ - 1 │ a := if '' == b { '' } else { '' } - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:15] + │ + 1 │ a := if '' == b { '' } else { '' } +───╯ +"#) .failure(); } @@ -127,15 +121,12 @@ fn undefined_then() { echo {{ a }} ", ) - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:20 - │ - 1 │ a := if '' == '' { b } else { '' } - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:20] + │ + 1 │ a := if '' == '' { b } else { '' } +───╯ +"#) .failure(); } @@ -150,15 +141,12 @@ fn undefined_otherwise() { echo {{ a }} ", ) - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:32 - │ - 1 │ a := if '' == '' { '' } else { b } - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:32] + │ + 1 │ a := if '' == '' { '' } else { b } +───╯ +"#) .failure(); } @@ -173,15 +161,12 @@ fn unexpected_op() { echo {{ a }} ", ) - .stderr( - " - error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier - ——▶ justfile:1:12 - │ - 1 │ a := if '' a '' { '' } else { b } - │ ^ - ", - ) + .stderr(r#"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier + ╭─[justfile:1:12] + │ + 1 │ a := if '' a '' { '' } else { b } +───╯ +"#) .failure(); } @@ -232,15 +217,12 @@ fn missing_else() { TEST := if path_exists('/bin/bash') == 'true' {'yes'} ", ) - .stderr( - " - error: Expected keyword `else` but found `end of line` - ——▶ justfile:1:54 - │ - 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} - │ ^ - ", - ) + .stderr(r#"Error: Expected keyword `else` but found `end of line` + ╭─[justfile:1:54] + │ + 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} +───╯ +"#) .failure(); } @@ -252,14 +234,11 @@ fn incorrect_else_identifier() { TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} ", ) - .stderr( - " - error: Expected keyword `else` but found identifier `els` - ——▶ justfile:1:55 - │ - 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} - │ ^^^ - ", - ) + .stderr(r#"Error: Expected keyword `else` but found identifier `els` + ╭─[justfile:1:55] + │ + 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} +───╯ +"#) .failure(); } diff --git a/tests/confirm.rs b/tests/confirm.rs index db7332be31..1d5eea6ec2 100644 --- a/tests/confirm.rs +++ b/tests/confirm.rs @@ -127,15 +127,16 @@ fn confirm_recipe_with_prompt_too_many_args() { echo confirmed "#, ) - .stderr( - r#" - error: Attribute `confirm` got 2 arguments but takes at most 1 argument - ——▶ justfile:1:2 - │ - 1 │ [confirm("PROMPT","EXTRA")] - │ ^^^^^^^ - "#, - ) + .stderr(r#"Error: Attribute argument count mismatch + ╭─[justfile:1:2] + │ + 1 │ [confirm("PROMPT","EXTRA")] + │ ───┬─── + │ ╰───── Found 2 arguments + │ + │ Note: `confirm` takes between 0 and 1 arguments +───╯ +"#) .failure(); } diff --git a/tests/default.rs b/tests/default.rs index 7322d33e7e..e9b9af999c 100644 --- a/tests/default.rs +++ b/tests/default.rs @@ -29,14 +29,11 @@ fn default_attribute_may_only_appear_once_per_justfile() { bar: ", ) - .stderr( - " - error: Recipe `foo` has duplicate `[default]` attribute, which may only appear once per module - ——▶ justfile:2:1 - │ - 2 │ foo: - │ ^^^ - " - ) + .stderr(r#"Error: Recipe `foo` has duplicate `[default]` attribute, which may only appear once per module + ╭─[justfile:2:1] + │ + 2 │ foo: +───╯ +"#) .failure(); } diff --git a/tests/delimiters.rs b/tests/delimiters.rs index 1a3686e53f..7707a809c1 100644 --- a/tests/delimiters.rs +++ b/tests/delimiters.rs @@ -4,15 +4,12 @@ use super::*; fn mismatched_delimiter() { Test::new() .justfile("(]") - .stderr( - " - error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) - ——▶ justfile:1:2 - │ - 1 │ (] - │ ^ - ", - ) + .stderr(r#"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) + ╭─[justfile:1:2] + │ + 1 │ (] +───╯ +"#) .failure(); } @@ -20,15 +17,12 @@ fn mismatched_delimiter() { fn unexpected_delimiter() { Test::new() .justfile("]") - .stderr( - " - error: Unexpected closing delimiter `]` - ——▶ justfile:1:1 - │ - 1 │ ] - │ ^ - ", - ) + .stderr(r#"Error: Unexpected closing delimiter `]` + ╭─[justfile:1:1] + │ + 1 │ ] +───╯ +"#) .failure(); } diff --git a/tests/dependencies.rs b/tests/dependencies.rs index 251664c320..7dda4fbcfb 100644 --- a/tests/dependencies.rs +++ b/tests/dependencies.rs @@ -44,14 +44,12 @@ fn dependency_not_in_submodule() { ", ) .arg("baz") - .stderr( - "error: Recipe `baz` has unknown dependency `foo::baz` - ——▶ justfile:2:11 - │ -2 │ baz: foo::baz - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::baz` + ╭─[justfile:2:11] + │ + 2 │ baz: foo::baz +───╯ +"#) .failure(); } @@ -68,14 +66,12 @@ fn dependency_submodule_missing() { ", ) .arg("baz") - .stderr( - "error: Recipe `baz` has unknown dependency `foo::bar` - ——▶ justfile:5:11 - │ -5 │ baz: foo::bar - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` + ╭─[justfile:5:11] + │ + 5 │ baz: foo::bar +───╯ +"#) .failure(); } @@ -91,14 +87,12 @@ fn recipe_dependency_on_module_fails() { ", ) .arg("baz") - .stderr( - "error: Recipe `baz` has unknown dependency `foo::bar` - ——▶ justfile:2:11 - │ -2 │ baz: foo::bar - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` + ╭─[justfile:2:11] + │ + 2 │ baz: foo::bar +───╯ +"#) .failure(); } diff --git a/tests/error_messages.rs b/tests/error_messages.rs index e8cf59a6f0..0ad6f660c8 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -4,15 +4,12 @@ use super::*; fn invalid_alias_attribute() { Test::new() .justfile("[private]\n[linux]\nalias t := test\n\ntest:\n") - .stderr( - " - error: Alias `t` has invalid attribute `linux` - ——▶ justfile:3:7 - │ - 3 │ alias t := test - │ ^ - ", - ) + .stderr(r#"Error: Alias `t` has invalid attribute `linux` + ╭─[justfile:3:7] + │ + 3 │ alias t := test +───╯ +"#) .failure(); } @@ -20,15 +17,12 @@ fn invalid_alias_attribute() { fn expected_keyword() { Test::new() .justfile("foo := if '' == '' { '' } arlo { '' }") - .stderr( - " - error: Expected keyword `else` but found identifier `arlo` - ——▶ justfile:1:27 - │ - 1 │ foo := if '' == '' { '' } arlo { '' } - │ ^^^^ - ", - ) + .stderr(r#"Error: Expected keyword `else` but found identifier `arlo` + ╭─[justfile:1:27] + │ + 1 │ foo := if '' == '' { '' } arlo { '' } +───╯ +"#) .failure(); } @@ -36,15 +30,12 @@ fn expected_keyword() { fn unexpected_character() { Test::new() .justfile("&~") - .stderr( - " - error: Expected character `&` - ——▶ justfile:1:2 - │ - 1 │ &~ - │ ^ - ", - ) + .stderr(r#"Error: Expected character `&` + ╭─[justfile:1:2] + │ + 1 │ &~ +───╯ +"#) .failure(); } @@ -67,15 +58,12 @@ fn argument_count_mismatch() { 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") - .stderr( - " -error: Expected '*', ':', '$', identifier, or '+', but found end of file - ——▶ justfile:20:4 - │ -20 │ foo - │ ^ -", - ) + .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found end of file + ╭─[justfile:20:4] + │ + 20 │ foo +────╯ +"#) .failure(); } @@ -85,12 +73,11 @@ fn file_paths_are_relative() { .justfile("import 'foo/bar.just'") .write("foo/bar.just", "baz") .stderr(format!( - " -error: Expected '*', ':', '$', identifier, or '+', but found end of file - ——▶ foo{MAIN_SEPARATOR}bar.just:1:4 - │ -1 │ baz - │ ^ + "Error: Expected '*', ':', '$', identifier, or '+', but found end of file + ╭─[foo{MAIN_SEPARATOR}bar.just:1:4] + │ + 1 │ baz +───╯ ", )) .failure(); @@ -107,11 +94,11 @@ fn file_paths_not_in_subdir_are_absolute() { .no_justfile() .args(["--justfile", "foo/justfile"]) .stderr_regex( - r"error: Expected '\*', ':', '\$', identifier, or '\+', but found end of file - ——▶ /.*/bar.just:1:4 - │ -1 │ baz - │ \^ + r"Error: Expected '\*', ':', '\$', identifier, or '\+', but found end of file + ╭─\[.+bar\.just:1:4\] + │ + 1 │ baz +───╯ ", ) .failure(); @@ -122,14 +109,11 @@ fn redefinition_errors_properly_swap_types() { Test::new() .write("foo.just", "foo:") .justfile("foo:\n echo foo\n\nmod foo 'foo.just'") - .stderr( - " -error: Recipe `foo` defined on line 1 is redefined as a module on line 4 - ——▶ justfile:4:5 - │ -4 │ mod foo 'foo.just' - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 + ╭─[justfile:4:5] + │ + 4 │ mod foo 'foo.just' +───╯ +"#) .failure(); } diff --git a/tests/fallback.rs b/tests/fallback.rs index 7b721ae5e7..92203a78f3 100644 --- a/tests/fallback.rs +++ b/tests/fallback.rs @@ -143,15 +143,12 @@ fn print_error_from_parent_if_recipe_not_found_in_current() { .justfile("foo:\n echo {{bar}}") .args(["foo"]) .current_dir("bar") - .stderr( - " - error: Variable `bar` not defined - ——▶ justfile:2:9 - │ - 2 │ echo {{bar}} - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:2:9] + │ + 2 │ echo {{bar}} +───╯ +"#) .failure(); } diff --git a/tests/format_string.rs b/tests/format_string.rs index 8c44c6b8cd..4d3d406788 100644 --- a/tests/format_string.rs +++ b/tests/format_string.rs @@ -147,15 +147,12 @@ fn recipe_body() { fn unclosed() { Test::new() .justfile("foo := f'FOO{{") - .stderr( - " - error: Expected backtick, identifier, '(', '/', or string, but found end of file - ——▶ justfile:1:15 - │ - 1 │ foo := f'FOO{{ - │ ^ - ", - ) + .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + ╭─[justfile:1:15] + │ + 1 │ foo := f'FOO{{ +───╯ +"#) .failure(); } @@ -236,15 +233,12 @@ fn escaped_delimiter_in_double_quoted_format_string() { "#, ) .args(["--evaluate", "foo"]) - .stderr( - r#" - error: `\{` is not a valid escape sequence - ——▶ justfile:1:9 - │ - 1 │ foo := f"\{{{{" - │ ^^^^^^^ - "#, - ) + .stderr(r#"Error: `\{` is not a valid escape sequence + ╭─[justfile:1:9] + │ + 1 │ foo := f"\{{{{" +───╯ +"#) .failure(); } @@ -340,15 +334,12 @@ fn undefined_variable_error() { foo := f'{{bar}}' ", ) - .stderr( - " - error: Variable `bar` not defined - ——▶ justfile:1:12 - │ - 1 │ foo := f'{{bar}}' - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:1:12] + │ + 1 │ foo := f'{{bar}}' +───╯ +"#) .failure(); } diff --git a/tests/functions.rs b/tests/functions.rs index c7d0bf751c..27b76fcb50 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -770,15 +770,12 @@ fn join_argument_count_error() { Test::new() .justfile("x := join('a')") .args(["--evaluate"]) - .stderr( - " - error: Function `join` called with 1 argument but takes 2 or more - ——▶ justfile:1:6 - │ - 1 │ x := join(\'a\') - │ ^^^^ - ", - ) + .stderr(r#"Error: Function `join` called with 1 argument but takes 2 or more + ╭─[justfile:1:6] + │ + 1 │ x := join('a') +───╯ +"#) .failure(); } @@ -992,15 +989,12 @@ fn shell_no_argument() { Test::new() .justfile("var := shell()") .args(["--evaluate"]) - .stderr( - " - error: Function `shell` called with 0 arguments but takes 1 or more - ——▶ justfile:1:8 - │ - 1 │ var := shell() - │ ^^^^^ - ", - ) + .stderr(r#"Error: Function `shell` called with 0 arguments but takes 1 or more + ╭─[justfile:1:8] + │ + 1 │ var := shell() +───╯ +"#) .failure(); } @@ -1277,15 +1271,12 @@ fn unary_argument_count_mismamatch_error_message() { Test::new() .justfile("x := datetime()") .args(["--evaluate"]) - .stderr( - " - error: Function `datetime` called with 0 arguments but takes 1 - ——▶ justfile:1:6 - │ - 1 │ x := datetime() - │ ^^^^^^^^ - ", - ) + .stderr(r#"Error: Function `datetime` called with 0 arguments but takes 1 + ╭─[justfile:1:6] + │ + 1 │ x := datetime() +───╯ +"#) .failure(); } diff --git a/tests/ignore_comments.rs b/tests/ignore_comments.rs index e598bc3ac4..389ee4b0be 100644 --- a/tests/ignore_comments.rs +++ b/tests/ignore_comments.rs @@ -122,14 +122,11 @@ fn comments_still_must_be_parsable_when_ignored() { # {{ foo bar }} ", ) - .stderr( - " - error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier - ——▶ justfile:4:12 - │ - 4 │ # {{ foo bar }} - │ ^^^ - ", - ) + .stderr(r#"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier + ╭─[justfile:4:12] + │ + 4 │ # {{ foo bar }} +───╯ +"#) .failure(); } diff --git a/tests/imports.rs b/tests/imports.rs index fd1fbb6aeb..6b66b59d0b 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -148,15 +148,12 @@ fn listed_recipes_in_imports_are_in_load_order() { fn include_error() { Test::new() .justfile("!include foo") - .stderr( - " - error: The `!include` directive has been stabilized as `import` - ——▶ justfile:1:1 - │ - 1 │ !include foo - │ ^ - ", - ) + .stderr(r#"Error: The `!include` directive has been stabilized as `import` + ╭─[justfile:1:1] + │ + 1 │ !include foo +───╯ +"#) .failure(); } diff --git a/tests/interpolation.rs b/tests/interpolation.rs index 81b7a55c33..f4956daf87 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -57,15 +57,12 @@ fn comment_in_interopolation() { }} ", ) - .stderr( - " - error: Expected backtick, identifier, '(', '/', or string, but found comment - ——▶ justfile:2:11 - │ - 2 │ echo {{ # hello - │ ^^^^^^^ - ", - ) + .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found comment + ╭─[justfile:2:11] + │ + 2 │ echo {{ # hello +───╯ +"#) .failure(); } diff --git a/tests/misc.rs b/tests/misc.rs index 0080f8e806..7dedd4da98 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -114,15 +114,12 @@ fn bad_setting() { set foo ", ) - .stderr( - " - error: Unknown setting `foo` - ——▶ justfile:1:5 - │ - 1 │ set foo - │ ^^^ - ", - ) + .stderr(r#"Error: Unknown setting `foo` + ╭─[justfile:1:5] + │ + 1 │ set foo +───╯ +"#) .failure(); } @@ -134,15 +131,12 @@ fn bad_setting_with_keyword_name() { set if := 'foo' ", ) - .stderr( - " - error: Unknown setting `if` - ——▶ justfile:1:5 - │ - 1 │ set if := 'foo' - │ ^^ - ", - ) + .stderr(r#"Error: Unknown setting `if` + ╭─[justfile:1:5] + │ + 1 │ set if := 'foo' +───╯ +"#) .failure(); } @@ -160,15 +154,12 @@ fn alias_with_dependencies() { fn duplicate_alias() { Test::new() .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 - │ ^^^ - ", - ) + .stderr(r#"Error: Alias `foo` first defined on line 1 is redefined on line 2 + ╭─[justfile:2:7] + │ + 2 │ alias foo := baz +───╯ +"#) .failure(); } @@ -176,15 +167,12 @@ fn duplicate_alias() { fn unknown_alias_target() { Test::new() .justfile("alias foo := bar\n") - .stderr( - " - error: Alias `foo` has an unknown target `bar` - ——▶ justfile:1:7 - │ - 1 │ alias foo := bar - │ ^^^ - ", - ) + .stderr(r#"Error: Alias `foo` has an unknown target `bar` + ╭─[justfile:1:7] + │ + 1 │ alias foo := bar +───╯ +"#) .failure(); } @@ -192,15 +180,12 @@ fn unknown_alias_target() { fn alias_shadows_recipe() { Test::new() .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: - │ ^^^ - ", - ) + .stderr(r#"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 + ╭─[justfile:4:1] + │ + 4 │ foo: +───╯ +"#) .failure(); } @@ -301,15 +286,12 @@ recipe: fn unknown_dependency() { Test::new() .justfile("bar:\nhello:\nfoo: bar baaaaaaaz hello") - .stderr( - " - error: Recipe `foo` has unknown dependency `baaaaaaaz` - ——▶ justfile:3:10 - │ - 3 │ foo: bar baaaaaaaz hello - │ ^^^^^^^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` has unknown dependency `baaaaaaaz` + ╭─[justfile:3:10] + │ + 3 │ foo: bar baaaaaaaz hello +───╯ +"#) .failure(); } @@ -735,14 +717,12 @@ fn line_error_spacing() { ^^^ ", ) - .stderr( - "error: Unknown start of token '^' - ——▶ justfile:10:1 - │ -10 │ ^^^ - │ ^ -", - ) + .stderr(r#"Error: Unknown start of token '^' + ╭─[justfile:10:1] + │ + 10 │ ^^^ +────╯ +"#) .failure(); } @@ -951,15 +931,13 @@ recipe a b +d: fn mixed_whitespace() { Test::new() .justfile("bar:\n\t echo hello") - .stderr( - "error: Found a mix of tabs and spaces in leading whitespace: `␉␠` + .stderr(r#"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 +───╯ +"#) .failure(); } @@ -967,14 +945,12 @@ Leading whitespace may consist of tabs or spaces, but not both fn extra_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t\t\techo goodbye") - .stderr( - "error: Recipe line has extra leading whitespace - ——▶ justfile:3:3 - │ -3 │ echo goodbye - │ ^^^^^^^^^^^^^^^^ -", - ) + .stderr(r#"Error: Recipe line has extra leading whitespace + ╭─[justfile:3:3] + │ + 3 │ echo goodbye +───╯ +"#) .failure(); } @@ -982,15 +958,12 @@ fn extra_leading_whitespace() { fn inconsistent_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t echo goodbye") - .stderr( - "error: Recipe line has inconsistent leading whitespace. \ - Recipe started with `␉␉` but found line with `␉␠` - ——▶ justfile:3:1 - │ -3 │ echo goodbye - │ ^^^^^ -", - ) + .stderr(r#"Error: Recipe line has inconsistent leading whitespace. Recipe started with `␉␉` but found line with `␉␠` + ╭─[justfile:3:1] + │ + 3 │ echo goodbye +───╯ +"#) .failure(); } @@ -998,14 +971,12 @@ fn inconsistent_leading_whitespace() { fn required_after_default() { Test::new() .justfile("bar:\nhello baz arg='foo' bar:") - .stderr( - "error: Non-default parameter `bar` follows default parameter - ——▶ justfile:2:21 - │ -2 │ hello baz arg='foo' bar: - │ ^^^ -", - ) + .stderr(r#"Error: Non-default parameter `bar` follows default parameter + ╭─[justfile:2:21] + │ + 2 │ hello baz arg='foo' bar: +───╯ +"#) .failure(); } @@ -1013,14 +984,12 @@ fn required_after_default() { fn required_after_plus_variadic() { Test::new() .justfile("bar:\nhello baz +arg bar:") - .stderr( - "error: Parameter `bar` follows variadic parameter - ——▶ justfile:2:16 - │ -2 │ hello baz +arg bar: - │ ^^^ -", - ) + .stderr(r#"Error: Parameter `bar` follows variadic parameter + ╭─[justfile:2:16] + │ + 2 │ hello baz +arg bar: +───╯ +"#) .failure(); } @@ -1028,14 +997,12 @@ fn required_after_plus_variadic() { fn required_after_star_variadic() { Test::new() .justfile("bar:\nhello baz *arg bar:") - .stderr( - "error: Parameter `bar` follows variadic parameter - ——▶ justfile:2:16 - │ -2 │ hello baz *arg bar: - │ ^^^ -", - ) + .stderr(r#"Error: Parameter `bar` follows variadic parameter + ╭─[justfile:2:16] + │ + 2 │ hello baz *arg bar: +───╯ +"#) .failure(); } @@ -1497,14 +1464,12 @@ fn unknown_function_in_assignment() { r#"foo := foo() + "hello" bar:"#, ) - .stderr( - r#"error: Call to unknown function `foo` - ——▶ justfile:1:8 - │ -1 │ foo := foo() + "hello" - │ ^^^ -"#, - ) + .stderr(r#"Error: Call to unknown function `foo` + ╭─[justfile:1:8] + │ + 1 │ foo := foo() + "hello" +───╯ +"#) .failure(); } @@ -1518,14 +1483,12 @@ fn dependency_takes_arguments_exact() { b: a ", ) - .stderr( - "error: Dependency `a` got 0 arguments but takes 1 argument - ——▶ justfile:2:4 - │ -2 │ b: a - │ ^ -", - ) + .stderr(r#"Error: Dependency `a` got 0 arguments but takes 1 argument + ╭─[justfile:2:4] + │ + 2 │ b: a +───╯ +"#) .failure(); } @@ -1539,14 +1502,12 @@ fn dependency_takes_arguments_at_least() { b: a ", ) - .stderr( - "error: Dependency `a` got 0 arguments but takes at least 1 argument - ——▶ justfile:2:4 - │ -2 │ b: a - │ ^ -", - ) + .stderr(r#"Error: Dependency `a` got 0 arguments but takes at least 1 argument + ╭─[justfile:2:4] + │ + 2 │ b: a +───╯ +"#) .failure(); } @@ -1560,14 +1521,12 @@ fn dependency_takes_arguments_at_most() { b: (a '0' '1' '2') ", ) - .stderr( - "error: Dependency `a` got 3 arguments but takes at most 2 arguments - ——▶ justfile:2:5 - │ -2 │ b: (a '0' '1' '2') - │ ^ -", - ) + .stderr(r#"Error: Dependency `a` got 3 arguments but takes at most 2 arguments + ╭─[justfile:2:5] + │ + 2 │ b: (a '0' '1' '2') +───╯ +"#) .failure(); } @@ -1576,14 +1535,12 @@ fn duplicate_parameter() { Test::new() .arg("a") .justfile("a foo foo:") - .stderr( - "error: Recipe `a` has duplicate parameter `foo` - ——▶ justfile:1:7 - │ -1 │ a foo foo: - │ ^^^ -", - ) + .stderr(r#"Error: Recipe `a` has duplicate parameter `foo` + ╭─[justfile:1:7] + │ + 1 │ a foo foo: +───╯ +"#) .failure(); } @@ -1592,14 +1549,12 @@ fn duplicate_recipe() { Test::new() .arg("b") .justfile("b:\nb:") - .stderr( - "error: Recipe `b` first defined on line 1 is redefined on line 2 - ——▶ justfile:2:1 - │ -2 │ b: - │ ^ -", - ) + .stderr(r#"Error: Recipe `b` first defined on line 1 is redefined on line 2 + ╭─[justfile:2:1] + │ + 2 │ b: +───╯ +"#) .failure(); } @@ -1608,14 +1563,12 @@ fn duplicate_variable() { Test::new() .arg("foo") .justfile("a := 'hello'\na := 'hello'\nfoo:") - .stderr( - "error: Variable `a` has multiple definitions - ——▶ justfile:2:1 - │ -2 │ a := 'hello' - │ ^ -", - ) + .stderr(r#"Error: Variable `a` has multiple definitions + ╭─[justfile:2:1] + │ + 2 │ a := 'hello' +───╯ +"#) .failure(); } @@ -1624,15 +1577,12 @@ fn unexpected_token_in_dependency_position() { Test::new() .arg("foo") .justfile("foo: 'bar'") - .stderr( - "error: Expected '&&', comment, end of file, end of line, \ - identifier, or '(', but found string - ——▶ justfile:1:6 - │ -1 │ foo: 'bar' - │ ^^^^^ -", - ) + .stderr(r#"Error: Expected '&&', comment, end of file, end of line, identifier, or '(', but found string + ╭─[justfile:1:6] + │ + 1 │ foo: 'bar' +───╯ +"#) .failure(); } @@ -1641,14 +1591,12 @@ fn unexpected_token_after_name() { Test::new() .arg("foo") .justfile("foo 'bar'") - .stderr( - "error: Expected '*', ':', '$', identifier, or '+', but found string - ——▶ justfile:1:5 - │ -1 │ foo 'bar' - │ ^^^^^ -", - ) + .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found string + ╭─[justfile:1:5] + │ + 1 │ foo 'bar' +───╯ +"#) .failure(); } @@ -1657,14 +1605,12 @@ fn self_dependency() { Test::new() .arg("a") .justfile("a: a") - .stderr( - "error: Recipe `a` depends on itself - ——▶ justfile:1:4 - │ -1 │ a: a - │ ^ -", - ) + .stderr(r#"Error: Recipe `a` depends on itself + ╭─[justfile:1:4] + │ + 1 │ a: a +───╯ +"#) .failure(); } @@ -1673,14 +1619,12 @@ fn long_circular_recipe_dependency() { Test::new() .arg("a") .justfile("a: b\nb: c\nc: d\nd: a") - .stderr( - "error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` - ——▶ justfile:4:4 - │ -4 │ d: a - │ ^ -", - ) + .stderr(r#"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` + ╭─[justfile:4:4] + │ + 4 │ d: a +───╯ +"#) .failure(); } @@ -1689,14 +1633,12 @@ fn variable_self_dependency() { Test::new() .arg("a") .justfile("z := z\na:") - .stderr( - "error: Variable `z` is defined in terms of itself - ——▶ justfile:1:1 - │ -1 │ z := z - │ ^ -", - ) + .stderr(r#"Error: Variable `z` is defined in terms of itself + ╭─[justfile:1:1] + │ + 1 │ z := z +───╯ +"#) .failure(); } @@ -1705,14 +1647,12 @@ fn variable_circular_dependency() { Test::new() .arg("a") .justfile("x := y\ny := z\nz := x\na:") - .stderr( - "error: Variable `x` depends on its own value: `x -> y -> z -> x` - ——▶ justfile:1:1 - │ -1 │ x := y - │ ^ -", - ) + .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> z -> x` + ╭─[justfile:1:1] + │ + 1 │ x := y +───╯ +"#) .failure(); } @@ -1729,14 +1669,12 @@ fn variable_circular_dependency_with_additional_variable() { a: ", ) - .stderr( - "error: Variable `x` depends on its own value: `x -> y -> x` - ——▶ justfile:2:1 - │ -2 │ x := y - │ ^ -", - ) + .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> x` + ╭─[justfile:2:1] + │ + 2 │ x := y +───╯ +"#) .failure(); } @@ -1902,14 +1840,12 @@ foo *a +b: echo {{a}} {{b}} ", ) - .stderr( - "error: Expected \':\' or \'=\', but found \'+\' - ——▶ justfile:1:8 - │ -1 │ foo *a +b: - │ ^ -", - ) + .stderr(r#"Error: Expected ':' or '=', but found '+' + ╭─[justfile:1:8] + │ + 1 │ foo *a +b: +───╯ +"#) .failure(); } @@ -1922,14 +1858,12 @@ foo +a *b: echo {{a}} {{b}} ", ) - .stderr( - "error: Expected \':\' or \'=\', but found \'*\' - ——▶ justfile:1:8 - │ -1 │ foo +a *b: - │ ^ -", - ) + .stderr(r#"Error: Expected ':' or '=', but found '*' + ╭─[justfile:1:8] + │ + 1 │ foo +a *b: +───╯ +"#) .failure(); } @@ -1972,14 +1906,12 @@ x: a: x y ", ) - .stderr( - "error: Recipe `a` has unknown dependency `y` - ——▶ justfile:3:6 - │ -3 │ a: x y - │ ^ -", - ) + .stderr(r#"Error: Recipe `a` has unknown dependency `y` + ╭─[justfile:3:6] + │ + 3 │ a: x y +───╯ +"#) .failure(); } @@ -2090,14 +2022,12 @@ fn invalid_escape_sequence_message() { X := "\'" "#, ) - .stderr( - r#"error: `\'` is not a valid escape sequence - ——▶ justfile:1:6 - │ -1 │ X := "\'" - │ ^^^^ -"#, - ) + .stderr(r#"Error: `\'` is not a valid escape sequence + ╭─[justfile:1:6] + │ + 1 │ X := "\'" +───╯ +"#) .failure(); } @@ -2109,14 +2039,12 @@ fn unknown_variable_in_default() { foo x=bar: ", ) - .stderr( - r"error: Variable `bar` not defined - ——▶ justfile:1:7 - │ -1 │ foo x=bar: - │ ^^^ -", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:1:7] + │ + 1 │ foo x=bar: +───╯ +"#) .failure(); } @@ -2128,14 +2056,12 @@ fn unknown_function_in_default() { foo x=bar(): ", ) - .stderr( - r"error: Call to unknown function `bar` - ——▶ justfile:1:7 - │ -1 │ foo x=bar(): - │ ^^^ -", - ) + .stderr(r#"Error: Call to unknown function `bar` + ╭─[justfile:1:7] + │ + 1 │ foo x=bar(): +───╯ +"#) .failure(); } @@ -2205,15 +2131,12 @@ fn unterminated_interpolation_eol() { echo {{ ", ) - .stderr( - r" - error: Unterminated interpolation - ——▶ justfile:2:8 - │ - 2 │ echo {{ - │ ^^ - ", - ) + .stderr(r#"Error: Unterminated interpolation + ╭─[justfile:2:8] + │ + 2 │ echo {{ +───╯ +"#) .failure(); } @@ -2226,15 +2149,12 @@ fn unterminated_interpolation_eof() { echo {{ ", ) - .stderr( - r" - error: Unterminated interpolation - ——▶ justfile:2:8 - │ - 2 │ echo {{ - │ ^^ - ", - ) + .stderr(r#"Error: Unterminated interpolation + ╭─[justfile:2:8] + │ + 2 │ echo {{ +───╯ +"#) .failure(); } @@ -2246,15 +2166,12 @@ fn unknown_start_of_token() { 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) - │ ^ - ", - ) + .stderr(r#"Error: Unknown start of token '%' + ╭─[justfile:1:25] + │ + 1 │ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) +───╯ +"#) .failure(); } @@ -2266,15 +2183,12 @@ fn unknown_start_of_token_invisible_unicode() { \u{200b}foo := 'bar' ", ) - .stderr( - " -error: Unknown start of token '\u{200b}' (U+200B) - ——▶ justfile:1:1 - │ -1 │ \u{200b}foo := 'bar' - │ ^ -", - ) + .stderr(r#"Error: Unknown start of token '​' (U+200B) + ╭─[justfile:1:1] + │ + 1 │ ​foo := 'bar' +───╯ +"#) .failure(); } @@ -2286,15 +2200,12 @@ fn unknown_start_of_token_ascii_control_char() { \0foo := 'bar' ", ) - .stderr( - " -error: Unknown start of token '\0' (U+0000) - ——▶ justfile:1:1 - │ -1 │ \0foo := 'bar' - │ ^ -", - ) + .stderr(r#"Error: Unknown start of token '' (U+0000) + ╭─[justfile:1:1] + │ + 1 │ foo := 'bar' +───╯ +"#) .failure(); } @@ -2418,15 +2329,12 @@ fn old_equals_assignment_syntax_produces_error() { echo {{foo}} ", ) - .stderr( - " - error: Expected '*', ':', '$', identifier, or '+', but found '=' - ——▶ justfile:1:5 - │ - 1 │ foo = 'bar' - │ ^ - ", - ) + .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '=' + ╭─[justfile:1:5] + │ + 1 │ foo = 'bar' +───╯ +"#) .failure(); } diff --git a/tests/modules.rs b/tests/modules.rs index d692c6d65a..5c6aadea57 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -203,15 +203,12 @@ foo: ) .arg("foo") .arg("foo") - .stderr( - " - error: Recipe `foo` first defined on line 1 is redefined on line 2 - ——▶ foo.just:2:1 - │ - 2 │ foo: - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` first defined on line 1 is redefined on line 2 + ╭─[foo.just:2:1] + │ + 2 │ foo: +───╯ +"#) .failure(); } @@ -225,15 +222,12 @@ fn modules_conflict_with_recipes() { foo: ", ) - .stderr( - " - error: Module `foo` defined on line 1 is redefined as a recipe on line 2 - ——▶ justfile:2:1 - │ - 2 │ foo: - │ ^^^ - ", - ) + .stderr(r#"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 + ╭─[justfile:2:1] + │ + 2 │ foo: +───╯ +"#) .failure(); } @@ -248,15 +242,12 @@ fn modules_conflict_with_aliases() { alias foo := bar ", ) - .stderr( - " - error: Module `foo` defined on line 1 is redefined as an alias on line 3 - ——▶ justfile:3:7 - │ - 3 │ alias foo := bar - │ ^^^ - ", - ) + .stderr(r#"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 + ╭─[justfile:3:7] + │ + 3 │ alias foo := bar +───╯ +"#) .failure(); } @@ -272,15 +263,12 @@ fn modules_conflict_with_other_modules() { bar: ", ) - .stderr( - " - error: Module `foo` first defined on line 1 is redefined on line 2 - ——▶ justfile:2:5 - │ - 2 │ mod foo - │ ^^^ - ", - ) + .stderr(r#"Error: Module `foo` first defined on line 1 is redefined on line 2 + ╭─[justfile:2:5] + │ + 2 │ mod foo +───╯ +"#) .failure(); } @@ -1019,7 +1007,12 @@ fn bad_module_attribute_fails() { ) .test_round_trip(false) .arg("--list") - .stderr("error: Module `foo` has invalid attribute `no-cd`\n ——▶ justfile:2:5\n │\n2 │ mod foo\n │ ^^^\n") + .stderr(r#"Error: Module `foo` has invalid attribute `no-cd` + ╭─[justfile:2:5] + │ + 2 │ mod foo +───╯ +"#) .failure(); } diff --git a/tests/newline_escape.rs b/tests/newline_escape.rs index 29f51612e5..34c8ea5e33 100644 --- a/tests/newline_escape.rs +++ b/tests/newline_escape.rs @@ -68,15 +68,12 @@ fn newline_escape_deps_invalid_esc() { default: a\\ b ", ) - .stderr( - " - error: `\\ ` is not a valid escape sequence - ——▶ justfile:1:11 - │ - 1 │ default: a\\ b - │ ^ - ", - ) + .stderr(r#"Error: `\ ` is not a valid escape sequence + ╭─[justfile:1:11] + │ + 1 │ default: a\ b +───╯ +"#) .failure(); } @@ -87,14 +84,11 @@ fn newline_escape_unpaired_linefeed() { " default:\\\ra", ) - .stderr( - " - error: Unpaired carriage return - ——▶ justfile:1:9 - │ - 1 │ default:\\\ra - │ ^ - ", - ) + .stderr(r#"Error: Unpaired carriage return + ╭─[justfile:1:9] + │ + 1 │ default:\ +───╯ +"#) .failure(); } diff --git a/tests/no_exit_message.rs b/tests/no_exit_message.rs index ff79d9a405..97c4137893 100644 --- a/tests/no_exit_message.rs +++ b/tests/no_exit_message.rs @@ -64,15 +64,12 @@ fn unknown_attribute() { @exit 100 ", ) - .stderr( - " - error: Unknown attribute `unknown-attribute` - ——▶ justfile:2:2 - │ - 2 │ [unknown-attribute] - │ ^^^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Unknown attribute `unknown-attribute` + ╭─[justfile:2:2] + │ + 2 │ [unknown-attribute] +───╯ +"#) .failure(); } @@ -87,15 +84,12 @@ fn empty_attribute() { @exit 100 ", ) - .stderr( - " - error: Expected identifier, but found ']' - ——▶ justfile:2:2 - │ - 2 │ [] - │ ^ - ", - ) + .stderr(r#"Error: Expected identifier, but found ']' + ╭─[justfile:2:2] + │ + 2 │ [] +───╯ +"#) .failure(); } @@ -110,15 +104,12 @@ fn extraneous_attribute_before_comment() { @exit 100 ", ) - .stderr( - " - error: Extraneous attribute - ——▶ justfile:1:1 - │ - 1 │ [no-exit-message] - │ ^ - ", - ) + .stderr(r#"Error: Extraneous attribute + ╭─[justfile:1:1] + │ + 1 │ [no-exit-message] +───╯ +"#) .failure(); } @@ -133,15 +124,12 @@ fn extraneous_attribute_before_empty_line() { @exit 100 ", ) - .stderr( - " - error: Extraneous attribute - ——▶ justfile:1:1 - │ - 1 │ [no-exit-message] - │ ^ - ", - ) + .stderr(r#"Error: Extraneous attribute + ╭─[justfile:1:1] + │ + 1 │ [no-exit-message] +───╯ +"#) .failure(); } @@ -251,14 +239,11 @@ fn exit_message_and_no_exit_message_compile_forbidden() { bar: ", ) - .stderr( - " - error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes - ——▶ justfile:2:1 - │ - 2 │ bar: - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes + ╭─[justfile:2:1] + │ + 2 │ bar: +───╯ +"#) .failure(); } diff --git a/tests/options.rs b/tests/options.rs index e9527ce9a1..ac41238c81 100644 --- a/tests/options.rs +++ b/tests/options.rs @@ -10,15 +10,12 @@ fn long_options_may_not_be_empty() { echo bar={{bar}} ", ) - .stderr( - " - error: Option name for parameter `bar` is empty - ——▶ justfile:1:18 - │ - 1 │ [arg('bar', long='')] - │ ^^ - ", - ) + .stderr(r#"Error: Option name for parameter `bar` is empty + ╭─[justfile:1:18] + │ + 1 │ [arg('bar', long='')] +───╯ +"#) .failure(); } @@ -32,15 +29,12 @@ fn short_options_may_not_be_empty() { echo bar={{bar}} ", ) - .stderr( - " - error: Option name for parameter `bar` is empty - ——▶ justfile:1:19 - │ - 1 │ [arg('bar', short='')] - │ ^^ - ", - ) + .stderr(r#"Error: Option name for parameter `bar` is empty + ╭─[justfile:1:19] + │ + 1 │ [arg('bar', short='')] +───╯ +"#) .failure(); } @@ -54,15 +48,12 @@ fn short_options_may_not_have_multiple_characters() { echo bar={{bar}} ", ) - .stderr( - " - error: Short option name for parameter `bar` contains multiple characters - ——▶ justfile:1:19 - │ - 1 │ [arg('bar', short='abc')] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Short option name for parameter `bar` contains multiple characters + ╭─[justfile:1:19] + │ + 1 │ [arg('bar', short='abc')] +───╯ +"#) .failure(); } @@ -169,15 +160,12 @@ fn duplicate_long_option_attributes_are_forbidden() { foo bar baz: ", ) - .stderr( - " - error: Recipe `foo` defines option `--bar` multiple times - ——▶ justfile:2:18 - │ - 2 │ [arg('baz', long='bar')] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times + ╭─[justfile:2:18] + │ + 2 │ [arg('baz', long='bar')] +───╯ +"#) .failure(); } @@ -194,15 +182,12 @@ fn defaulted_duplicate_long_option() { foo aaa bar: ", ) - .stderr( - " - error: Recipe `foo` defines option `--bar` multiple times - ——▶ justfile:5:19 - │ - 5 │ [arg( 'bar', long)] - │ ^^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times + ╭─[justfile:5:19] + │ + 5 │ [arg( 'bar', long)] +───╯ +"#) .failure(); } @@ -216,15 +201,12 @@ fn duplicate_short_option_attributes_are_forbidden() { foo bar baz: ", ) - .stderr( - " - error: Recipe `foo` defines option `-b` multiple times - ——▶ justfile:2:19 - │ - 2 │ [arg('baz', short='b')] - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` defines option `-b` multiple times + ╭─[justfile:2:19] + │ + 2 │ [arg('baz', short='b')] +───╯ +"#) .failure(); } @@ -237,15 +219,12 @@ fn variadics_with_long_options_are_forbidden() { foo +bar: ", ) - .stderr( - " - error: Variadic parameters may not be options - ——▶ justfile:2:6 - │ - 2 │ foo +bar: - │ ^^^ - ", - ) + .stderr(r#"Error: Variadic parameters may not be options + ╭─[justfile:2:6] + │ + 2 │ foo +bar: +───╯ +"#) .failure(); } @@ -258,15 +237,12 @@ fn variadics_with_short_options_are_forbidden() { foo +bar: ", ) - .stderr( - " - error: Variadic parameters may not be options - ——▶ justfile:2:6 - │ - 2 │ foo +bar: - │ ^^^ - ", - ) + .stderr(r#"Error: Variadic parameters may not be options + ╭─[justfile:2:6] + │ + 2 │ foo +bar: +───╯ +"#) .failure(); } @@ -279,15 +255,12 @@ fn long_option_names_may_not_contain_equal_sign() { foo bar: ", ) - .stderr( - " - error: Option name for parameter `bar` contains equal sign - ——▶ justfile:1:18 - │ - 1 │ [arg('bar', long='bar=baz')] - │ ^^^^^^^^^ - ", - ) + .stderr(r#"Error: Option name for parameter `bar` contains equal sign + ╭─[justfile:1:18] + │ + 1 │ [arg('bar', long='bar=baz')] +───╯ +"#) .failure(); } @@ -300,15 +273,12 @@ fn short_option_names_may_not_contain_equal_sign() { foo bar: ", ) - .stderr( - " - error: Option name for parameter `bar` contains equal sign - ——▶ justfile:1:19 - │ - 1 │ [arg('bar', short='=')] - │ ^^^ - ", - ) + .stderr(r#"Error: Option name for parameter `bar` contains equal sign + ╭─[justfile:1:19] + │ + 1 │ [arg('bar', short='=')] +───╯ +"#) .failure(); } @@ -669,15 +639,12 @@ fn value_requires_long_or_short() { ", ) .args(["foo", "-b=hello"]) - .stderr( - " - error: Argument attribute `value` only valid with `long` or `short` - ——▶ justfile:1:13 - │ - 1 │ [arg('bar', value='baz')] - │ ^^^^^ - ", - ) + .stderr(r#"Error: Argument attribute `value` only valid with `long` or `short` + ╭─[justfile:1:13] + │ + 1 │ [arg('bar', value='baz')] +───╯ +"#) .failure(); } diff --git a/tests/parameters.rs b/tests/parameters.rs index 519aeb9bf4..0f508da441 100644 --- a/tests/parameters.rs +++ b/tests/parameters.rs @@ -24,15 +24,12 @@ fn parameter_default_values_may_not_use_later_parameters() { ", ) .args(["foo", "bar"]) - .stderr( - " - error: Variable `c` not defined - ——▶ justfile:1:10 - │ - 1 │ @foo a b=c c='': - │ ^ - ", - ) + .stderr(r#"Error: Variable `c` not defined + ╭─[justfile:1:10] + │ + 1 │ @foo a b=c c='': +───╯ +"#) .failure(); } diff --git a/tests/parser.rs b/tests/parser.rs index 85ff23178a..b764e41468 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -20,15 +20,12 @@ fn invalid_bang_operator() { x := if '' !! '' { '' } else { '' } ", ) - .stderr( - r" -error: Expected character `=` or `~` - ——▶ justfile:1:13 - │ -1 │ x := if '' !! '' { '' } else { '' } - │ ^ -", - ) + .stderr(r#"Error: Expected character `=` or `~` + ╭─[justfile:1:13] + │ + 1 │ x := if '' !! '' { '' } else { '' } +───╯ +"#) .failure(); } @@ -36,14 +33,11 @@ error: Expected character `=` or `~` fn truncated_bang_operator() { Test::new() .justfile("x := if '' !") - .stderr( - r" -error: Expected character `=` or `~` but found end-of-file - ——▶ justfile:1:13 - │ -1 │ x := if '' ! - │ ^ -", - ) + .stderr(r#"Error: Expected character `=` or `~` but found end-of-file + ╭─[justfile:1:13] + │ + 1 │ x := if '' ! +───╯ +"#) .failure(); } diff --git a/tests/recursion_limit.rs b/tests/recursion_limit.rs index 042b38ed76..8b690bb99e 100644 --- a/tests/recursion_limit.rs +++ b/tests/recursion_limit.rs @@ -13,13 +13,12 @@ fn bugfix() { } #[cfg(not(windows))] -const RECURSION_LIMIT_REACHED: &str = " -error: Parsing recursion depth exceeded - ——▶ justfile:1:265 - │ -1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( - │ ^ -"; +const RECURSION_LIMIT_REACHED: &str = r#"Error: Parsing recursion depth exceeded + ╭─[justfile:1:265] + │ + 1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +───╯ +"#; #[cfg(windows)] const RECURSION_LIMIT_REACHED: &str = " diff --git a/tests/settings.rs b/tests/settings.rs index 73642b19b4..a85cac4f97 100644 --- a/tests/settings.rs +++ b/tests/settings.rs @@ -34,15 +34,12 @@ fn undefined_variable_in_working_directory() { set working-directory := foo ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:26 - │ - 1 │ set working-directory := foo - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:26] + │ + 1 │ set working-directory := foo +───╯ +"#) .failure(); } @@ -54,15 +51,12 @@ fn undefined_variable_in_dotenv_filename() { set dotenv-filename := foo ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:24 - │ - 1 │ set dotenv-filename := foo - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:24] + │ + 1 │ set dotenv-filename := foo +───╯ +"#) .failure(); } @@ -74,15 +68,12 @@ fn undefined_variable_in_dotenv_path() { set dotenv-path := foo ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:20 - │ - 1 │ set dotenv-path := foo - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:20] + │ + 1 │ set dotenv-path := foo +───╯ +"#) .failure(); } @@ -94,15 +85,12 @@ fn undefined_variable_in_tempdir() { set tempdir := foo ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:16 - │ - 1 │ set tempdir := foo - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:16] + │ + 1 │ set tempdir := foo +───╯ +"#) .failure(); } @@ -114,15 +102,12 @@ fn undefined_variable_in_script_interpreter_command() { set script-interpreter := [foo] ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:28 - │ - 1 │ set script-interpreter := [foo] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:28] + │ + 1 │ set script-interpreter := [foo] +───╯ +"#) .failure(); } @@ -134,15 +119,12 @@ fn undefined_variable_in_script_interpreter_argument() { set script-interpreter := ['foo', bar] ", ) - .stderr( - " - error: Variable `bar` not defined - ——▶ justfile:1:35 - │ - 1 │ set script-interpreter := ['foo', bar] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:1:35] + │ + 1 │ set script-interpreter := ['foo', bar] +───╯ +"#) .failure(); } @@ -154,15 +136,12 @@ fn undefined_variable_in_shell_command() { set shell := [foo] ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:15 - │ - 1 │ set shell := [foo] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:15] + │ + 1 │ set shell := [foo] +───╯ +"#) .failure(); } @@ -174,15 +153,12 @@ fn undefined_variable_in_shell_argument() { set shell := ['foo', bar] ", ) - .stderr( - " - error: Variable `bar` not defined - ——▶ justfile:1:22 - │ - 1 │ set shell := ['foo', bar] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:1:22] + │ + 1 │ set shell := ['foo', bar] +───╯ +"#) .failure(); } @@ -194,15 +170,12 @@ fn undefined_variable_in_windows_shell_command() { set windows-shell := [foo] ", ) - .stderr( - " - error: Variable `foo` not defined - ——▶ justfile:1:23 - │ - 1 │ set windows-shell := [foo] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:1:23] + │ + 1 │ set windows-shell := [foo] +───╯ +"#) .failure(); } @@ -214,15 +187,12 @@ fn undefined_variable_in_windows_shell_argument() { set windows-shell := ['foo', bar] ", ) - .stderr( - " - error: Variable `bar` not defined - ——▶ justfile:1:30 - │ - 1 │ set windows-shell := ['foo', bar] - │ ^^^ - ", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:1:30] + │ + 1 │ set windows-shell := ['foo', bar] +───╯ +"#) .failure(); } diff --git a/tests/shell_expansion.rs b/tests/shell_expansion.rs index 120708cf8e..fd77c909bf 100644 --- a/tests/shell_expansion.rs +++ b/tests/shell_expansion.rs @@ -22,15 +22,12 @@ fn shell_expanded_strings_must_not_have_whitespace() { x := x '$JUST_TEST_VARIABLE' ", ) - .stderr( - " - error: Expected '&&', '||', comment, end of file, end of line, '(', '+', or '/', but found string - ——▶ justfile:1:8 - │ - 1 │ x := x '$JUST_TEST_VARIABLE' - │ ^^^^^^^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Expected '&&', '||', comment, end of file, end of line, '(', '+', or '/', but found string + ╭─[justfile:1:8] + │ + 1 │ x := x '$JUST_TEST_VARIABLE' +───╯ +"#) .failure(); } @@ -44,14 +41,12 @@ fn shell_expanded_error_messages_highlight_string_token() { ) .env("JUST_TEST_VARIABLE", "FOO") .args(["--evaluate", "x"]) - .stderr( - " - error: Shell expansion failed: error looking key 'FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' up: environment variable not found - ——▶ justfile:1:7 - │ - 1 │ x := x'$FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - ") + .stderr(r#"Error: Shell expansion failed: error looking key 'FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' up: environment variable not found + ╭─[justfile:1:7] + │ + 1 │ x := x'$FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' +───╯ +"#) .failure(); } diff --git a/tests/show.rs b/tests/show.rs index b6d2bdf597..553129a2b6 100644 --- a/tests/show.rs +++ b/tests/show.rs @@ -42,15 +42,12 @@ fn alias_show_missing_target() { .arg("--show") .arg("f") .justfile("alias f := foo") - .stderr( - " - error: Alias `f` has an unknown target `foo` - ——▶ justfile:1:7 - │ - 1 │ alias f := foo - │ ^ - ", - ) + .stderr(r#"Error: Alias `f` has an unknown target `foo` + ╭─[justfile:1:7] + │ + 1 │ alias f := foo +───╯ +"#) .failure(); } diff --git a/tests/slash_operator.rs b/tests/slash_operator.rs index 01593f1e20..fdf327637a 100644 --- a/tests/slash_operator.rs +++ b/tests/slash_operator.rs @@ -45,15 +45,12 @@ fn no_lhs_twice() { fn no_rhs_once() { Test::new() .justfile("x := 'a' /") - .stderr( - " - error: Expected backtick, identifier, '(', '/', or string, but found end of file - ——▶ justfile:1:11 - │ - 1 │ x := 'a' / - │ ^ - ", - ) + .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + ╭─[justfile:1:11] + │ + 1 │ x := 'a' / +───╯ +"#) .failure(); } @@ -66,15 +63,12 @@ fn default_un_parenthesized() { echo {{x}} ", ) - .stderr( - " - error: Expected '*', ':', '$', identifier, or '+', but found '/' - ——▶ justfile:1:11 - │ - 1 │ foo x='a' / 'b': - │ ^ - ", - ) + .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '/' + ╭─[justfile:1:11] + │ + 1 │ foo x='a' / 'b': +───╯ +"#) .failure(); } @@ -87,15 +81,12 @@ fn no_lhs_un_parenthesized() { echo {{x}} ", ) - .stderr( - " - error: Expected backtick, identifier, '(', or string, but found '/' - ——▶ justfile:1:7 - │ - 1 │ foo x=/ 'a' / 'b': - │ ^ - ", - ) + .stderr(r#"Error: Expected backtick, identifier, '(', or string, but found '/' + ╭─[justfile:1:7] + │ + 1 │ foo x=/ 'a' / 'b': +───╯ +"#) .failure(); } diff --git a/tests/string.rs b/tests/string.rs index d10e9e76f4..5bce47bcb7 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -121,14 +121,12 @@ fn invalid_escape_sequence() { r#"x := "\q" a:"#, ) - .stderr( - "error: `\\q` is not a valid escape sequence - ——▶ justfile:1:6 - │ -1 │ x := \"\\q\" - │ ^^^^ -", - ) + .stderr(r#"Error: `\q` is not a valid escape sequence + ╭─[justfile:1:6] + │ + 1 │ x := "\q" +───╯ +"#) .failure(); } @@ -146,14 +144,12 @@ a: echo '{{foo}}' ", ) - .stderr( - "error: Variable `foo` not defined - ——▶ justfile:6:11 - │ -6 │ echo '{{foo}}' - │ ^^^ -", - ) + .stderr(r#"Error: Variable `foo` not defined + ╭─[justfile:6:11] + │ + 6 │ echo '{{foo}}' +───╯ +"#) .failure(); } @@ -171,14 +167,12 @@ a: echo '{{string}}' ", ) - .stderr( - "error: Variable `bar` not defined - ——▶ justfile:3:13 - │ -3 │ whatever' + bar - │ ^^^ -", - ) + .stderr(r#"Error: Variable `bar` not defined + ╭─[justfile:3:13] + │ + 3 │ whatever' + bar +───╯ +"#) .failure(); } @@ -221,14 +215,12 @@ a: echo {{b}} "#, ) - .stderr( - "error: Variable `b` not defined - ——▶ justfile:5:10 - │ -5 │ echo {{b}} - │ ^ -", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:5:10] + │ + 5 │ echo {{b}} +───╯ +"#) .failure(); } @@ -241,15 +233,12 @@ fn unterminated_raw_string() { a b= ': ", ) - .stderr( - " - error: Unterminated string - ——▶ justfile:1:6 - │ - 1 │ a b= ': - │ ^ - ", - ) + .stderr(r#"Error: Unterminated string + ╭─[justfile:1:6] + │ + 1 │ a b= ': +───╯ +"#) .failure(); } @@ -262,15 +251,12 @@ fn unterminated_string() { a b= ": "#, ) - .stderr( - r#" - error: Unterminated string - ——▶ justfile:1:6 - │ - 1 │ a b= ": - │ ^ - "#, - ) + .stderr(r#"Error: Unterminated string + ╭─[justfile:1:6] + │ + 1 │ a b= ": +───╯ +"#) .failure(); } @@ -283,15 +269,12 @@ fn unterminated_backtick() { echo {{a}} ", ) - .stderr( - r" - error: Unterminated backtick - ——▶ justfile:1:8 - │ - 1 │ foo a= `echo blaaaaaah: - │ ^ - ", - ) + .stderr(r#"Error: Unterminated backtick + ╭─[justfile:1:8] + │ + 1 │ foo a= `echo blaaaaaah: +───╯ +"#) .failure(); } @@ -304,15 +287,12 @@ fn unterminated_indented_raw_string() { a b= ''': ", ) - .stderr( - " - error: Unterminated string - ——▶ justfile:1:6 - │ - 1 │ a b= ''': - │ ^^^ - ", - ) + .stderr(r#"Error: Unterminated string + ╭─[justfile:1:6] + │ + 1 │ a b= ''': +───╯ +"#) .failure(); } @@ -325,15 +305,12 @@ fn unterminated_indented_string() { a b= """: "#, ) - .stderr( - r#" - error: Unterminated string - ——▶ justfile:1:6 - │ - 1 │ a b= """: - │ ^^^ - "#, - ) + .stderr(r#"Error: Unterminated string + ╭─[justfile:1:6] + │ + 1 │ a b= """: +───╯ +"#) .failure(); } @@ -346,15 +323,12 @@ fn unterminated_indented_backtick() { echo {{a}} ", ) - .stderr( - r" - error: Unterminated backtick - ——▶ justfile:1:8 - │ - 1 │ foo a= ```echo blaaaaaah: - │ ^^^ - ", - ) + .stderr(r#"Error: Unterminated backtick + ╭─[justfile:1:8] + │ + 1 │ foo a= ```echo blaaaaaah: +───╯ +"#) .failure(); } @@ -499,15 +473,12 @@ fn shebang_backtick() { x := `#!/usr/bin/env sh` ", ) - .stderr( - " - error: Backticks may not start with `#!` - ——▶ justfile:1:6 - │ - 1 │ x := `#!/usr/bin/env sh` - │ ^^^^^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Backticks may not start with `#!` + ╭─[justfile:1:6] + │ + 1 │ x := `#!/usr/bin/env sh` +───╯ +"#) .failure(); } @@ -543,15 +514,12 @@ fn unicode_escape_no_braces() { Test::new() .justfile("x := \"\\u1234\"") .args(["--evaluate", "x"]) - .stderr( - r#" -error: expected unicode escape sequence delimiter `{` but found `1` - ——▶ justfile:1:6 - │ -1 │ x := "\u1234" - │ ^^^^^^^^ -"#, - ) + .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found `1` + ╭─[justfile:1:6] + │ + 1 │ x := "\u1234" +───╯ +"#) .failure(); } @@ -560,15 +528,12 @@ fn unicode_escape_empty() { Test::new() .justfile("x := \"\\u{}\"") .args(["--evaluate", "x"]) - .stderr( - r#" -error: unicode escape sequences must not be empty - ——▶ justfile:1:6 - │ -1 │ x := "\u{}" - │ ^^^^^^ -"#, - ) + .stderr(r#"Error: unicode escape sequences must not be empty + ╭─[justfile:1:6] + │ + 1 │ x := "\u{}" +───╯ +"#) .failure(); } @@ -577,15 +542,12 @@ fn unicode_escape_requires_immediate_opening_brace() { Test::new() .justfile("x := \"\\u {1f916}\"") .args(["--evaluate", "x"]) - .stderr( - r#" -error: expected unicode escape sequence delimiter `{` but found ` ` - ——▶ justfile:1:6 - │ -1 │ x := "\u {1f916}" - │ ^^^^^^^^^^^^ -"#, - ) + .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found ` ` + ╭─[justfile:1:6] + │ + 1 │ x := "\u {1f916}" +───╯ +"#) .failure(); } @@ -611,15 +573,12 @@ fn unicode_escape_invalid_character() { Test::new() .justfile("x := \"\\u{BadBad}\"") .args(["--evaluate", "x"]) - .stderr( - r#" -error: unicode escape sequence value `BadBad` greater than maximum valid code point `10FFFF` - ——▶ justfile:1:6 - │ -1 │ x := "\u{BadBad}" - │ ^^^^^^^^^^^^ -"#, - ) + .stderr(r#"Error: unicode escape sequence value `BadBad` greater than maximum valid code point `10FFFF` + ╭─[justfile:1:6] + │ + 1 │ x := "\u{BadBad}" +───╯ +"#) .failure(); } @@ -645,14 +604,11 @@ fn unicode_escape_unterminated() { Test::new() .justfile("x := \"\\u{1f917\"") .args(["--evaluate", "x"]) - .stderr( - r#" -error: unterminated unicode escape sequence - ——▶ justfile:1:6 - │ -1 │ x := "\u{1f917" - │ ^^^^^^^^^^ -"#, - ) + .stderr(r#"Error: unterminated unicode escape sequence + ╭─[justfile:1:6] + │ + 1 │ x := "\u{1f917" +───╯ +"#) .failure(); } diff --git a/tests/subsequents.rs b/tests/subsequents.rs index 6d06c5fb0e..94b3ef21a9 100644 --- a/tests/subsequents.rs +++ b/tests/subsequents.rs @@ -63,15 +63,12 @@ fn circular_dependency() { foo: && foo ", ) - .stderr( - " - error: Recipe `foo` depends on itself - ——▶ justfile:1:9 - │ - 1 │ foo: && foo - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` depends on itself + ╭─[justfile:1:9] + │ + 1 │ foo: && foo +───╯ +"#) .failure(); } @@ -83,15 +80,12 @@ fn unknown() { foo: && bar ", ) - .stderr( - " - error: Recipe `foo` has unknown dependency `bar` - ——▶ justfile:1:9 - │ - 1 │ foo: && bar - │ ^^^ - ", - ) + .stderr(r#"Error: Recipe `foo` has unknown dependency `bar` + ╭─[justfile:1:9] + │ + 1 │ foo: && bar +───╯ +"#) .failure(); } @@ -105,15 +99,12 @@ fn unknown_argument() { foo: && (bar y) ", ) - .stderr( - " - error: Variable `y` not defined - ——▶ justfile:3:14 - │ - 3 │ foo: && (bar y) - │ ^ - ", - ) + .stderr(r#"Error: Variable `y` not defined + ╭─[justfile:3:14] + │ + 3 │ foo: && (bar y) +───╯ +"#) .failure(); } diff --git a/tests/test.rs b/tests/test.rs index 6980f56edd..e416515798 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,6 +1,6 @@ use { super::*, - pretty_assertions::{assert_eq, StrComparison}, + pretty_assertions::assert_eq, }; pub(crate) struct Output { diff --git a/tests/undefined_variables.rs b/tests/undefined_variables.rs index 5d62ec44ed..e5198b7add 100644 --- a/tests/undefined_variables.rs +++ b/tests/undefined_variables.rs @@ -4,15 +4,12 @@ use super::*; fn parameter_default_unknown_variable_in_expression() { Test::new() .justfile("foo a=(b+''):") - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:8 - │ - 1 │ foo a=(b+''): - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:8] + │ + 1 │ foo a=(b+''): +───╯ +"#) .failure(); } @@ -24,15 +21,12 @@ fn unknown_variable_in_unary_call() { foo x=env_var(a): ", ) - .stderr( - " - error: Variable `a` not defined - ——▶ justfile:1:15 - │ - 1 │ foo x=env_var(a): - │ ^ - ", - ) + .stderr(r#"Error: Variable `a` not defined + ╭─[justfile:1:15] + │ + 1 │ foo x=env_var(a): +───╯ +"#) .failure(); } @@ -44,15 +38,12 @@ fn unknown_first_variable_in_binary_call() { foo x=env_var_or_default(a, b): ", ) - .stderr( - " - error: Variable `a` not defined - ——▶ justfile:1:26 - │ - 1 │ foo x=env_var_or_default(a, b): - │ ^ - ", - ) + .stderr(r#"Error: Variable `a` not defined + ╭─[justfile:1:26] + │ + 1 │ foo x=env_var_or_default(a, b): +───╯ +"#) .failure(); } @@ -64,15 +55,12 @@ fn unknown_second_variable_in_binary_call() { foo x=env_var_or_default('', b): ", ) - .stderr( - " - error: Variable `b` not defined - ——▶ justfile:1:30 - │ - 1 │ foo x=env_var_or_default('', b): - │ ^ - ", - ) + .stderr(r#"Error: Variable `b` not defined + ╭─[justfile:1:30] + │ + 1 │ foo x=env_var_or_default('', b): +───╯ +"#) .failure(); } @@ -84,14 +72,11 @@ fn unknown_variable_in_ternary_call() { foo x=replace(a, b, c): ", ) - .stderr( - " - error: Variable `a` not defined - ——▶ justfile:1:15 - │ - 1 │ foo x=replace(a, b, c): - │ ^ - ", - ) + .stderr(r#"Error: Variable `a` not defined + ╭─[justfile:1:15] + │ + 1 │ foo x=replace(a, b, c): +───╯ +"#) .failure(); } diff --git a/tests/unexport.rs b/tests/unexport.rs index 764ef94d9a..34bad574b5 100644 --- a/tests/unexport.rs +++ b/tests/unexport.rs @@ -47,15 +47,12 @@ fn duplicate_unexport_fails() { ", ) .env("JUST_TEST_VARIABLE", "foo") - .stderr( - " - error: Variable `JUST_TEST_VARIABLE` is unexported multiple times - ——▶ justfile:6:10 - │ - 6 │ unexport JUST_TEST_VARIABLE - │ ^^^^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times + ╭─[justfile:6:10] + │ + 6 │ unexport JUST_TEST_VARIABLE +───╯ +"#) .failure(); } @@ -72,15 +69,12 @@ fn export_unexport_conflict() { export JUST_TEST_VARIABLE := 'foo' ", ) - .stderr( - " - error: Variable JUST_TEST_VARIABLE is both exported and unexported - ——▶ justfile:6:8 - │ - 6 │ export JUST_TEST_VARIABLE := 'foo' - │ ^^^^^^^^^^^^^^^^^^ - ", - ) + .stderr(r#"Error: Variable JUST_TEST_VARIABLE is both exported and unexported + ╭─[justfile:6:8] + │ + 6 │ export JUST_TEST_VARIABLE := 'foo' +───╯ +"#) .failure(); } diff --git a/tests/working_directory.rs b/tests/working_directory.rs index 2eeb7cc7a1..32c022e15c 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -342,14 +342,17 @@ fn attribute_duplicate() { foo: ", ) - .stderr( - "error: Recipe attribute `working-directory` first used on line 1 is duplicated on line 2 - ——▶ justfile:2:2 - │ -2 │ [working-directory('baz')] - │ ^^^^^^^^^^^^^^^^^ -", - ) + .stderr(r#"Error: Duplicate attribute `working-directory` + ╭─[justfile:2:2] + │ + 1 │ [working-directory('bar')] + │ ─────────────┬───────────── + │ ╰─────────────── original + 2 │ [working-directory('baz')] + │ ────────┬──────── + │ ╰────────── duplicate +───╯ +"#) .failure(); } From 679f286206b0650090052ce2b0c68b14457d04dd Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 02:32:42 -0800 Subject: [PATCH 06/14] Update to ariadne 0.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix Report::build API change: the 3-argument form (kind, source_id, offset) is now 2-argument (kind, span) where span is (source_id, range). Update all test stderr expectations for the new format where the location is wrapped with spaces: `╭─[ file:line:col ]` instead of `╭─[file:line:col]`. Co-Authored-By: Claude Sonnet 4.6 --- Cargo.lock | 16 +++----- Cargo.toml | 2 +- src/compile_error.rs | 2 +- tests/alias.rs | 2 +- tests/allow_missing.rs | 2 +- tests/arg_attribute.rs | 16 ++++---- tests/assignment.rs | 6 +-- tests/attributes.rs | 20 ++++----- tests/byte_order_mark.rs | 4 +- tests/conditional.rs | 14 +++---- tests/confirm.rs | 2 +- tests/default.rs | 2 +- tests/delimiters.rs | 4 +- tests/dependencies.rs | 6 +-- tests/error_messages.rs | 14 +++---- tests/fallback.rs | 2 +- tests/format_string.rs | 6 +-- tests/functions.rs | 6 +-- tests/ignore_comments.rs | 2 +- tests/imports.rs | 2 +- tests/interpolation.rs | 2 +- tests/misc.rs | 78 ++++++++++++++++++------------------ tests/modules.rs | 10 ++--- tests/newline_escape.rs | 4 +- tests/no_exit_message.rs | 10 ++--- tests/options.rs | 22 +++++----- tests/parameters.rs | 2 +- tests/parser.rs | 4 +- tests/recursion_limit.rs | 2 +- tests/settings.rs | 20 ++++----- tests/shell_expansion.rs | 4 +- tests/show.rs | 2 +- tests/slash_operator.rs | 6 +-- tests/string.rs | 36 ++++++++--------- tests/subsequents.rs | 6 +-- tests/undefined_variables.rs | 10 ++--- tests/unexport.rs | 4 +- tests/working_directory.rs | 4 +- 38 files changed, 175 insertions(+), 181 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3b8b67089e..df7b2e25f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,11 +81,11 @@ dependencies = [ [[package]] name = "ariadne" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44055e597c674aef7cb903b2b9f6e4cba1277ed0d2d61dae7cd52d7ffa81f8e2" +checksum = "8454c8a44ce2cb9cc7e7fae67fc6128465b343b92c6631e94beca3c8d1524ea5" dependencies = [ - "unicode-width 0.1.14", + "unicode-width", "yansi", ] @@ -461,7 +461,7 @@ version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" dependencies = [ - "unicode-width 0.2.2", + "unicode-width", ] [[package]] @@ -594,7 +594,7 @@ dependencies = [ "tempfile", "temptree", "typed-arena", - "unicode-width 0.2.2", + "unicode-width", "uuid", "which", ] @@ -1118,12 +1118,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 76dd644a5a..744a72cb53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ members = [".", "crates/*"] [dependencies] ansi_term = "0.12.0" -ariadne = "0.4.1" +ariadne = "0.6.0" blake3 = { version = "1.5.0", features = ["rayon", "mmap"] } camino = "1.0.4" chrono = "0.4.38" diff --git a/src/compile_error.rs b/src/compile_error.rs index a92718ad56..6cbd31e932 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -39,7 +39,7 @@ pub(crate) fn render_compile_error(error: &CompileError, color: Color) { let label = Label::new((&path, start..end)); let config = Config::default().with_color(color.stderr().active()); - let report = Report::build(ReportKind::Error, &path, start).with_config(config); + let report = Report::build(ReportKind::Error, (&path, start..end)).with_config(config); let report = match &*error.kind { CompileErrorKind::AttributeArgumentCountMismatch { diff --git a/tests/alias.rs b/tests/alias.rs index 6474f9667c..b1779d2369 100644 --- a/tests/alias.rs +++ b/tests/alias.rs @@ -33,7 +33,7 @@ fn unknown_nested_alias() { ) .arg("b") .stderr(r#"Error: Alias `b` has an unknown target `foo::bar::baz` - ╭─[justfile:3:7] + ╭─[ justfile:3:7 ] │ 3 │ alias b := foo::bar::baz ───╯ diff --git a/tests/allow_missing.rs b/tests/allow_missing.rs index ecbfc583cb..4abc4a3ed1 100644 --- a/tests/allow_missing.rs +++ b/tests/allow_missing.rs @@ -26,7 +26,7 @@ fn allow_missing_does_not_apply_to_compilation_errors() { .justfile("bar: foo") .args(["--allow-missing", "foo"]) .stderr(r#"Error: Recipe `bar` has unknown dependency `foo` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ bar: foo ───╯ diff --git a/tests/arg_attribute.rs b/tests/arg_attribute.rs index ab4d73e8bf..28de9d846c 100644 --- a/tests/arg_attribute.rs +++ b/tests/arg_attribute.rs @@ -77,7 +77,7 @@ fn pattern_invalid_regex_error() { ", ) .stderr(r#"Error: Failed to parse argument pattern - ╭─[justfile:1:21] + ╭─[ justfile:1:21 ] │ 1 │ [arg('bar', pattern='{')] ───╯ @@ -116,7 +116,7 @@ fn duplicate_attribute_error() { ) .args(["foo", "BAR"]) .stderr(r#"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 2 │ [arg('bar', pattern='BAR')] ───╯ @@ -135,7 +135,7 @@ fn extra_keyword_error() { ) .args(["foo", "BAR"]) .stderr(r#"Error: Unknown keyword `foo` for `arg` attribute - ╭─[justfile:1:28] + ╭─[ justfile:1:28 ] │ 1 │ [arg('bar', pattern='BAR', foo='foo')] ───╯ @@ -154,7 +154,7 @@ fn unknown_argument_error() { ) .arg("foo") .stderr(r#"Error: Argument attribute for undefined argument `bar` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ [arg('bar', pattern='BAR')] ───╯ @@ -205,7 +205,7 @@ fn positional_arguments_cannot_follow_keyword_arguments() { ) .args(["foo", "BAR"]) .stderr(r#"Error: Positional attribute arguments cannot follow keyword attribute arguments - ╭─[justfile:1:21] + ╭─[ justfile:1:21 ] │ 1 │ [arg(pattern='BAR', 'bar')] ───╯ @@ -333,7 +333,7 @@ fn pattern_requires_value() { ", ) .stderr(r#"Error: Attribute key `pattern` requires value - ╭─[justfile:1:13] + ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', pattern)] ───╯ @@ -351,7 +351,7 @@ fn short_requires_value() { ", ) .stderr(r#"Error: Attribute key `short` requires value - ╭─[justfile:1:13] + ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', short)] ───╯ @@ -369,7 +369,7 @@ fn value_requires_value() { ", ) .stderr(r#"Error: Attribute key `value` requires value - ╭─[justfile:1:19] + ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', long, value)] ───╯ diff --git a/tests/assignment.rs b/tests/assignment.rs index 0309048825..4f7be9fa64 100644 --- a/tests/assignment.rs +++ b/tests/assignment.rs @@ -9,7 +9,7 @@ fn set_export_parse_error() { ", ) .stderr(r#"Error: Expected keyword `true` or `false` but found identifier `fals` - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ set export := fals ───╯ @@ -26,7 +26,7 @@ fn set_export_parse_error_eol() { ", ) .stderr(r#"Error: Expected identifier, but found end of line - ╭─[justfile:1:14] + ╭─[ justfile:1:14 ] │ 1 │ set export := ───╯ @@ -45,7 +45,7 @@ fn invalid_attributes_are_an_error() { ) .args(["--evaluate", "x"]) .stderr(r#"Error: Assignment `x` has invalid attribute `group` - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ x := 'foo' ───╯ diff --git a/tests/attributes.rs b/tests/attributes.rs index fdc227a2d6..55a72fb5a7 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -31,7 +31,7 @@ fn duplicate_attributes_are_disallowed() { ", ) .stderr(r#"Error: Duplicate attribute `no-exit-message` - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 1 │ [no-exit-message] │ ─────────┬──────── @@ -71,7 +71,7 @@ fn multiple_attributes_one_line_error_message() { ", ) .stderr(r#"Error: Expected ']', ':', ',', or '(', but found identifier - ╭─[justfile:1:16] + ╭─[ justfile:1:16 ] │ 1 │ [macos,windows linux,openbsd] ───╯ @@ -91,7 +91,7 @@ fn multiple_attributes_one_line_duplicate_check() { ", ) .stderr(r#"Error: Duplicate attribute `linux` - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 1 │ [macos, windows, linux, openbsd] │ ────────────────┬──────────────── @@ -115,7 +115,7 @@ fn unexpected_attribute_argument() { ", ) .stderr(r#"Error: Attribute argument count mismatch - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ [private('foo')] │ ───┬─── @@ -170,7 +170,7 @@ fn expected_metadata_attribute_argument() { ", ) .stderr(r#"Error: Attribute argument count mismatch - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ [metadata] │ ────┬─── @@ -271,7 +271,7 @@ fn extension_on_linewise_error() { ", ) .stderr(r#"Error: Recipe `baz` has invalid attribute `extension` - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ baz: ───╯ @@ -290,7 +290,7 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { ", ) .stderr(r#"Error: Duplicate attribute `confirm` - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 1 │ [confirm: 'yes'] │ ────────┬──────── @@ -394,7 +394,7 @@ fn env_attribute_too_few_arguments() { ", ) .stderr(r#"Error: Attribute argument count mismatch - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ [env('MY_VAR')] │ ─┬─ @@ -417,7 +417,7 @@ fn env_attribute_too_many_arguments() { ", ) .stderr(r#"Error: Attribute argument count mismatch - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ [env('A', 'B', 'C')] │ ─┬─ @@ -441,7 +441,7 @@ fn env_attribute_duplicate_error() { ", ) .stderr(r#"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 2 │ [env('VAR1', 'value 2')] ───╯ diff --git a/tests/byte_order_mark.rs b/tests/byte_order_mark.rs index 20d0aef16a..6c61c0708c 100644 --- a/tests/byte_order_mark.rs +++ b/tests/byte_order_mark.rs @@ -25,7 +25,7 @@ fn non_leading_byte_order_mark_produces_error() { ", ) .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found byte order mark - ╭─[justfile:3:1] + ╭─[ justfile:3:1 ] │ │ ───╯ @@ -38,7 +38,7 @@ fn dont_mention_byte_order_mark_in_errors() { Test::new() .justfile("{") .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ { ───╯ diff --git a/tests/conditional.rs b/tests/conditional.rs index 0378f31be1..d84e6462b6 100644 --- a/tests/conditional.rs +++ b/tests/conditional.rs @@ -82,7 +82,7 @@ fn undefined_lhs() { ", ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:9] + ╭─[ justfile:1:9 ] │ 1 │ a := if b == '' { '' } else { '' } ───╯ @@ -102,7 +102,7 @@ fn undefined_rhs() { ", ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ a := if '' == b { '' } else { '' } ───╯ @@ -122,7 +122,7 @@ fn undefined_then() { ", ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:20] + ╭─[ justfile:1:20 ] │ 1 │ a := if '' == '' { b } else { '' } ───╯ @@ -142,7 +142,7 @@ fn undefined_otherwise() { ", ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:32] + ╭─[ justfile:1:32 ] │ 1 │ a := if '' == '' { '' } else { b } ───╯ @@ -162,7 +162,7 @@ fn unexpected_op() { ", ) .stderr(r#"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier - ╭─[justfile:1:12] + ╭─[ justfile:1:12 ] │ 1 │ a := if '' a '' { '' } else { b } ───╯ @@ -218,7 +218,7 @@ fn missing_else() { ", ) .stderr(r#"Error: Expected keyword `else` but found `end of line` - ╭─[justfile:1:54] + ╭─[ justfile:1:54 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} ───╯ @@ -235,7 +235,7 @@ fn incorrect_else_identifier() { ", ) .stderr(r#"Error: Expected keyword `else` but found identifier `els` - ╭─[justfile:1:55] + ╭─[ justfile:1:55 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} ───╯ diff --git a/tests/confirm.rs b/tests/confirm.rs index 1d5eea6ec2..b194acfd0b 100644 --- a/tests/confirm.rs +++ b/tests/confirm.rs @@ -128,7 +128,7 @@ fn confirm_recipe_with_prompt_too_many_args() { "#, ) .stderr(r#"Error: Attribute argument count mismatch - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ [confirm("PROMPT","EXTRA")] │ ───┬─── diff --git a/tests/default.rs b/tests/default.rs index e9b9af999c..bab9e0ec08 100644 --- a/tests/default.rs +++ b/tests/default.rs @@ -30,7 +30,7 @@ fn default_attribute_may_only_appear_once_per_justfile() { ", ) .stderr(r#"Error: Recipe `foo` has duplicate `[default]` attribute, which may only appear once per module - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ foo: ───╯ diff --git a/tests/delimiters.rs b/tests/delimiters.rs index 7707a809c1..a7570612c4 100644 --- a/tests/delimiters.rs +++ b/tests/delimiters.rs @@ -5,7 +5,7 @@ fn mismatched_delimiter() { Test::new() .justfile("(]") .stderr(r#"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ (] ───╯ @@ -18,7 +18,7 @@ fn unexpected_delimiter() { Test::new() .justfile("]") .stderr(r#"Error: Unexpected closing delimiter `]` - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ ] ───╯ diff --git a/tests/dependencies.rs b/tests/dependencies.rs index 7dda4fbcfb..163d48392c 100644 --- a/tests/dependencies.rs +++ b/tests/dependencies.rs @@ -45,7 +45,7 @@ fn dependency_not_in_submodule() { ) .arg("baz") .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::baz` - ╭─[justfile:2:11] + ╭─[ justfile:2:11 ] │ 2 │ baz: foo::baz ───╯ @@ -67,7 +67,7 @@ fn dependency_submodule_missing() { ) .arg("baz") .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` - ╭─[justfile:5:11] + ╭─[ justfile:5:11 ] │ 5 │ baz: foo::bar ───╯ @@ -88,7 +88,7 @@ fn recipe_dependency_on_module_fails() { ) .arg("baz") .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` - ╭─[justfile:2:11] + ╭─[ justfile:2:11 ] │ 2 │ baz: foo::bar ───╯ diff --git a/tests/error_messages.rs b/tests/error_messages.rs index 0ad6f660c8..859514bf3f 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -5,7 +5,7 @@ fn invalid_alias_attribute() { Test::new() .justfile("[private]\n[linux]\nalias t := test\n\ntest:\n") .stderr(r#"Error: Alias `t` has invalid attribute `linux` - ╭─[justfile:3:7] + ╭─[ justfile:3:7 ] │ 3 │ alias t := test ───╯ @@ -18,7 +18,7 @@ fn expected_keyword() { Test::new() .justfile("foo := if '' == '' { '' } arlo { '' }") .stderr(r#"Error: Expected keyword `else` but found identifier `arlo` - ╭─[justfile:1:27] + ╭─[ justfile:1:27 ] │ 1 │ foo := if '' == '' { '' } arlo { '' } ───╯ @@ -31,7 +31,7 @@ fn unexpected_character() { Test::new() .justfile("&~") .stderr(r#"Error: Expected character `&` - ╭─[justfile:1:2] + ╭─[ justfile:1:2 ] │ 1 │ &~ ───╯ @@ -59,7 +59,7 @@ 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") .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found end of file - ╭─[justfile:20:4] + ╭─[ justfile:20:4 ] │ 20 │ foo ────╯ @@ -74,7 +74,7 @@ fn file_paths_are_relative() { .write("foo/bar.just", "baz") .stderr(format!( "Error: Expected '*', ':', '$', identifier, or '+', but found end of file - ╭─[foo{MAIN_SEPARATOR}bar.just:1:4] + ╭─[ foo{MAIN_SEPARATOR}bar.just:1:4 ] │ 1 │ baz ───╯ @@ -95,7 +95,7 @@ fn file_paths_not_in_subdir_are_absolute() { .args(["--justfile", "foo/justfile"]) .stderr_regex( r"Error: Expected '\*', ':', '\$', identifier, or '\+', but found end of file - ╭─\[.+bar\.just:1:4\] + ╭─\[ .+bar\.just:1:4 \] │ 1 │ baz ───╯ @@ -110,7 +110,7 @@ fn redefinition_errors_properly_swap_types() { .write("foo.just", "foo:") .justfile("foo:\n echo foo\n\nmod foo 'foo.just'") .stderr(r#"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 - ╭─[justfile:4:5] + ╭─[ justfile:4:5 ] │ 4 │ mod foo 'foo.just' ───╯ diff --git a/tests/fallback.rs b/tests/fallback.rs index 92203a78f3..30899aa90e 100644 --- a/tests/fallback.rs +++ b/tests/fallback.rs @@ -144,7 +144,7 @@ fn print_error_from_parent_if_recipe_not_found_in_current() { .args(["foo"]) .current_dir("bar") .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:2:9] + ╭─[ justfile:2:9 ] │ 2 │ echo {{bar}} ───╯ diff --git a/tests/format_string.rs b/tests/format_string.rs index 4d3d406788..098cc3628d 100644 --- a/tests/format_string.rs +++ b/tests/format_string.rs @@ -148,7 +148,7 @@ fn unclosed() { Test::new() .justfile("foo := f'FOO{{") .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ foo := f'FOO{{ ───╯ @@ -234,7 +234,7 @@ fn escaped_delimiter_in_double_quoted_format_string() { ) .args(["--evaluate", "foo"]) .stderr(r#"Error: `\{` is not a valid escape sequence - ╭─[justfile:1:9] + ╭─[ justfile:1:9 ] │ 1 │ foo := f"\{{{{" ───╯ @@ -335,7 +335,7 @@ fn undefined_variable_error() { ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:1:12] + ╭─[ justfile:1:12 ] │ 1 │ foo := f'{{bar}}' ───╯ diff --git a/tests/functions.rs b/tests/functions.rs index 27b76fcb50..3b4831d173 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -771,7 +771,7 @@ fn join_argument_count_error() { .justfile("x := join('a')") .args(["--evaluate"]) .stderr(r#"Error: Function `join` called with 1 argument but takes 2 or more - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := join('a') ───╯ @@ -990,7 +990,7 @@ fn shell_no_argument() { .justfile("var := shell()") .args(["--evaluate"]) .stderr(r#"Error: Function `shell` called with 0 arguments but takes 1 or more - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ var := shell() ───╯ @@ -1272,7 +1272,7 @@ fn unary_argument_count_mismamatch_error_message() { .justfile("x := datetime()") .args(["--evaluate"]) .stderr(r#"Error: Function `datetime` called with 0 arguments but takes 1 - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := datetime() ───╯ diff --git a/tests/ignore_comments.rs b/tests/ignore_comments.rs index 389ee4b0be..33722218a5 100644 --- a/tests/ignore_comments.rs +++ b/tests/ignore_comments.rs @@ -123,7 +123,7 @@ fn comments_still_must_be_parsable_when_ignored() { ", ) .stderr(r#"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier - ╭─[justfile:4:12] + ╭─[ justfile:4:12 ] │ 4 │ # {{ foo bar }} ───╯ diff --git a/tests/imports.rs b/tests/imports.rs index 6b66b59d0b..f7b8d46b80 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -149,7 +149,7 @@ fn include_error() { Test::new() .justfile("!include foo") .stderr(r#"Error: The `!include` directive has been stabilized as `import` - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ !include foo ───╯ diff --git a/tests/interpolation.rs b/tests/interpolation.rs index f4956daf87..9b3020972a 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -58,7 +58,7 @@ fn comment_in_interopolation() { ", ) .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found comment - ╭─[justfile:2:11] + ╭─[ justfile:2:11 ] │ 2 │ echo {{ # hello ───╯ diff --git a/tests/misc.rs b/tests/misc.rs index 7dedd4da98..fe3147f68d 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -115,7 +115,7 @@ fn bad_setting() { ", ) .stderr(r#"Error: Unknown setting `foo` - ╭─[justfile:1:5] + ╭─[ justfile:1:5 ] │ 1 │ set foo ───╯ @@ -132,7 +132,7 @@ fn bad_setting_with_keyword_name() { ", ) .stderr(r#"Error: Unknown setting `if` - ╭─[justfile:1:5] + ╭─[ justfile:1:5 ] │ 1 │ set if := 'foo' ───╯ @@ -155,7 +155,7 @@ fn duplicate_alias() { Test::new() .justfile("alias foo := bar\nalias foo := baz\n") .stderr(r#"Error: Alias `foo` first defined on line 1 is redefined on line 2 - ╭─[justfile:2:7] + ╭─[ justfile:2:7 ] │ 2 │ alias foo := baz ───╯ @@ -168,7 +168,7 @@ fn unknown_alias_target() { Test::new() .justfile("alias foo := bar\n") .stderr(r#"Error: Alias `foo` has an unknown target `bar` - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ alias foo := bar ───╯ @@ -181,7 +181,7 @@ fn alias_shadows_recipe() { Test::new() .justfile("bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo") .stderr(r#"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 - ╭─[justfile:4:1] + ╭─[ justfile:4:1 ] │ 4 │ foo: ───╯ @@ -287,7 +287,7 @@ fn unknown_dependency() { Test::new() .justfile("bar:\nhello:\nfoo: bar baaaaaaaz hello") .stderr(r#"Error: Recipe `foo` has unknown dependency `baaaaaaaz` - ╭─[justfile:3:10] + ╭─[ justfile:3:10 ] │ 3 │ foo: bar baaaaaaaz hello ───╯ @@ -718,7 +718,7 @@ fn line_error_spacing() { ", ) .stderr(r#"Error: Unknown start of token '^' - ╭─[justfile:10:1] + ╭─[ justfile:10:1 ] │ 10 │ ^^^ ────╯ @@ -933,7 +933,7 @@ fn mixed_whitespace() { .justfile("bar:\n\t echo hello") .stderr(r#"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] + ╭─[ justfile:2:1 ] │ 2 │ echo hello ───╯ @@ -946,7 +946,7 @@ fn extra_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t\t\techo goodbye") .stderr(r#"Error: Recipe line has extra leading whitespace - ╭─[justfile:3:3] + ╭─[ justfile:3:3 ] │ 3 │ echo goodbye ───╯ @@ -959,7 +959,7 @@ fn inconsistent_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t echo goodbye") .stderr(r#"Error: Recipe line has inconsistent leading whitespace. Recipe started with `␉␉` but found line with `␉␠` - ╭─[justfile:3:1] + ╭─[ justfile:3:1 ] │ 3 │ echo goodbye ───╯ @@ -972,7 +972,7 @@ fn required_after_default() { Test::new() .justfile("bar:\nhello baz arg='foo' bar:") .stderr(r#"Error: Non-default parameter `bar` follows default parameter - ╭─[justfile:2:21] + ╭─[ justfile:2:21 ] │ 2 │ hello baz arg='foo' bar: ───╯ @@ -985,7 +985,7 @@ fn required_after_plus_variadic() { Test::new() .justfile("bar:\nhello baz +arg bar:") .stderr(r#"Error: Parameter `bar` follows variadic parameter - ╭─[justfile:2:16] + ╭─[ justfile:2:16 ] │ 2 │ hello baz +arg bar: ───╯ @@ -998,7 +998,7 @@ fn required_after_star_variadic() { Test::new() .justfile("bar:\nhello baz *arg bar:") .stderr(r#"Error: Parameter `bar` follows variadic parameter - ╭─[justfile:2:16] + ╭─[ justfile:2:16 ] │ 2 │ hello baz *arg bar: ───╯ @@ -1465,7 +1465,7 @@ fn unknown_function_in_assignment() { bar:"#, ) .stderr(r#"Error: Call to unknown function `foo` - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo := foo() + "hello" ───╯ @@ -1484,7 +1484,7 @@ fn dependency_takes_arguments_exact() { ", ) .stderr(r#"Error: Dependency `a` got 0 arguments but takes 1 argument - ╭─[justfile:2:4] + ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ @@ -1503,7 +1503,7 @@ fn dependency_takes_arguments_at_least() { ", ) .stderr(r#"Error: Dependency `a` got 0 arguments but takes at least 1 argument - ╭─[justfile:2:4] + ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ @@ -1522,7 +1522,7 @@ fn dependency_takes_arguments_at_most() { ", ) .stderr(r#"Error: Dependency `a` got 3 arguments but takes at most 2 arguments - ╭─[justfile:2:5] + ╭─[ justfile:2:5 ] │ 2 │ b: (a '0' '1' '2') ───╯ @@ -1536,7 +1536,7 @@ fn duplicate_parameter() { .arg("a") .justfile("a foo foo:") .stderr(r#"Error: Recipe `a` has duplicate parameter `foo` - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ a foo foo: ───╯ @@ -1550,7 +1550,7 @@ fn duplicate_recipe() { .arg("b") .justfile("b:\nb:") .stderr(r#"Error: Recipe `b` first defined on line 1 is redefined on line 2 - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ b: ───╯ @@ -1564,7 +1564,7 @@ fn duplicate_variable() { .arg("foo") .justfile("a := 'hello'\na := 'hello'\nfoo:") .stderr(r#"Error: Variable `a` has multiple definitions - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ a := 'hello' ───╯ @@ -1578,7 +1578,7 @@ fn unexpected_token_in_dependency_position() { .arg("foo") .justfile("foo: 'bar'") .stderr(r#"Error: Expected '&&', comment, end of file, end of line, identifier, or '(', but found string - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ foo: 'bar' ───╯ @@ -1592,7 +1592,7 @@ fn unexpected_token_after_name() { .arg("foo") .justfile("foo 'bar'") .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found string - ╭─[justfile:1:5] + ╭─[ justfile:1:5 ] │ 1 │ foo 'bar' ───╯ @@ -1606,7 +1606,7 @@ fn self_dependency() { .arg("a") .justfile("a: a") .stderr(r#"Error: Recipe `a` depends on itself - ╭─[justfile:1:4] + ╭─[ justfile:1:4 ] │ 1 │ a: a ───╯ @@ -1620,7 +1620,7 @@ fn long_circular_recipe_dependency() { .arg("a") .justfile("a: b\nb: c\nc: d\nd: a") .stderr(r#"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` - ╭─[justfile:4:4] + ╭─[ justfile:4:4 ] │ 4 │ d: a ───╯ @@ -1634,7 +1634,7 @@ fn variable_self_dependency() { .arg("a") .justfile("z := z\na:") .stderr(r#"Error: Variable `z` is defined in terms of itself - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ z := z ───╯ @@ -1648,7 +1648,7 @@ fn variable_circular_dependency() { .arg("a") .justfile("x := y\ny := z\nz := x\na:") .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> z -> x` - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ x := y ───╯ @@ -1670,7 +1670,7 @@ fn variable_circular_dependency_with_additional_variable() { ", ) .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> x` - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ x := y ───╯ @@ -1841,7 +1841,7 @@ foo *a +b: ", ) .stderr(r#"Error: Expected ':' or '=', but found '+' - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo *a +b: ───╯ @@ -1859,7 +1859,7 @@ foo +a *b: ", ) .stderr(r#"Error: Expected ':' or '=', but found '*' - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo +a *b: ───╯ @@ -1907,7 +1907,7 @@ a: x y ", ) .stderr(r#"Error: Recipe `a` has unknown dependency `y` - ╭─[justfile:3:6] + ╭─[ justfile:3:6 ] │ 3 │ a: x y ───╯ @@ -2023,7 +2023,7 @@ X := "\'" "#, ) .stderr(r#"Error: `\'` is not a valid escape sequence - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ X := "\'" ───╯ @@ -2040,7 +2040,7 @@ fn unknown_variable_in_default() { ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ foo x=bar: ───╯ @@ -2057,7 +2057,7 @@ foo x=bar(): ", ) .stderr(r#"Error: Call to unknown function `bar` - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ foo x=bar(): ───╯ @@ -2132,7 +2132,7 @@ fn unterminated_interpolation_eol() { ", ) .stderr(r#"Error: Unterminated interpolation - ╭─[justfile:2:8] + ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ @@ -2150,7 +2150,7 @@ fn unterminated_interpolation_eof() { ", ) .stderr(r#"Error: Unterminated interpolation - ╭─[justfile:2:8] + ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ @@ -2167,7 +2167,7 @@ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ", ) .stderr(r#"Error: Unknown start of token '%' - ╭─[justfile:1:25] + ╭─[ justfile:1:25 ] │ 1 │ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ───╯ @@ -2184,7 +2184,7 @@ fn unknown_start_of_token_invisible_unicode() { ", ) .stderr(r#"Error: Unknown start of token '​' (U+200B) - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ ​foo := 'bar' ───╯ @@ -2201,7 +2201,7 @@ fn unknown_start_of_token_ascii_control_char() { ", ) .stderr(r#"Error: Unknown start of token '' (U+0000) - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ foo := 'bar' ───╯ @@ -2330,7 +2330,7 @@ fn old_equals_assignment_syntax_produces_error() { ", ) .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '=' - ╭─[justfile:1:5] + ╭─[ justfile:1:5 ] │ 1 │ foo = 'bar' ───╯ diff --git a/tests/modules.rs b/tests/modules.rs index 5c6aadea57..f65d0a1959 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -204,7 +204,7 @@ foo: .arg("foo") .arg("foo") .stderr(r#"Error: Recipe `foo` first defined on line 1 is redefined on line 2 - ╭─[foo.just:2:1] + ╭─[ foo.just:2:1 ] │ 2 │ foo: ───╯ @@ -223,7 +223,7 @@ fn modules_conflict_with_recipes() { ", ) .stderr(r#"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ foo: ───╯ @@ -243,7 +243,7 @@ fn modules_conflict_with_aliases() { ", ) .stderr(r#"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 - ╭─[justfile:3:7] + ╭─[ justfile:3:7 ] │ 3 │ alias foo := bar ───╯ @@ -264,7 +264,7 @@ fn modules_conflict_with_other_modules() { ", ) .stderr(r#"Error: Module `foo` first defined on line 1 is redefined on line 2 - ╭─[justfile:2:5] + ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ @@ -1008,7 +1008,7 @@ fn bad_module_attribute_fails() { .test_round_trip(false) .arg("--list") .stderr(r#"Error: Module `foo` has invalid attribute `no-cd` - ╭─[justfile:2:5] + ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ diff --git a/tests/newline_escape.rs b/tests/newline_escape.rs index 34c8ea5e33..698eb31417 100644 --- a/tests/newline_escape.rs +++ b/tests/newline_escape.rs @@ -69,7 +69,7 @@ fn newline_escape_deps_invalid_esc() { ", ) .stderr(r#"Error: `\ ` is not a valid escape sequence - ╭─[justfile:1:11] + ╭─[ justfile:1:11 ] │ 1 │ default: a\ b ───╯ @@ -85,7 +85,7 @@ fn newline_escape_unpaired_linefeed() { default:\\\ra", ) .stderr(r#"Error: Unpaired carriage return - ╭─[justfile:1:9] + ╭─[ justfile:1:9 ] │ 1 │ default:\ ───╯ diff --git a/tests/no_exit_message.rs b/tests/no_exit_message.rs index 97c4137893..5c6820662a 100644 --- a/tests/no_exit_message.rs +++ b/tests/no_exit_message.rs @@ -65,7 +65,7 @@ fn unknown_attribute() { ", ) .stderr(r#"Error: Unknown attribute `unknown-attribute` - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 2 │ [unknown-attribute] ───╯ @@ -85,7 +85,7 @@ fn empty_attribute() { ", ) .stderr(r#"Error: Expected identifier, but found ']' - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 2 │ [] ───╯ @@ -105,7 +105,7 @@ fn extraneous_attribute_before_comment() { ", ) .stderr(r#"Error: Extraneous attribute - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ @@ -125,7 +125,7 @@ fn extraneous_attribute_before_empty_line() { ", ) .stderr(r#"Error: Extraneous attribute - ╭─[justfile:1:1] + ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ @@ -240,7 +240,7 @@ fn exit_message_and_no_exit_message_compile_forbidden() { ", ) .stderr(r#"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes - ╭─[justfile:2:1] + ╭─[ justfile:2:1 ] │ 2 │ bar: ───╯ diff --git a/tests/options.rs b/tests/options.rs index ac41238c81..4c36c8eb35 100644 --- a/tests/options.rs +++ b/tests/options.rs @@ -11,7 +11,7 @@ fn long_options_may_not_be_empty() { ", ) .stderr(r#"Error: Option name for parameter `bar` is empty - ╭─[justfile:1:18] + ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='')] ───╯ @@ -30,7 +30,7 @@ fn short_options_may_not_be_empty() { ", ) .stderr(r#"Error: Option name for parameter `bar` is empty - ╭─[justfile:1:19] + ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='')] ───╯ @@ -49,7 +49,7 @@ fn short_options_may_not_have_multiple_characters() { ", ) .stderr(r#"Error: Short option name for parameter `bar` contains multiple characters - ╭─[justfile:1:19] + ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='abc')] ───╯ @@ -161,7 +161,7 @@ fn duplicate_long_option_attributes_are_forbidden() { ", ) .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times - ╭─[justfile:2:18] + ╭─[ justfile:2:18 ] │ 2 │ [arg('baz', long='bar')] ───╯ @@ -183,7 +183,7 @@ fn defaulted_duplicate_long_option() { ", ) .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times - ╭─[justfile:5:19] + ╭─[ justfile:5:19 ] │ 5 │ [arg( 'bar', long)] ───╯ @@ -202,7 +202,7 @@ fn duplicate_short_option_attributes_are_forbidden() { ", ) .stderr(r#"Error: Recipe `foo` defines option `-b` multiple times - ╭─[justfile:2:19] + ╭─[ justfile:2:19 ] │ 2 │ [arg('baz', short='b')] ───╯ @@ -220,7 +220,7 @@ fn variadics_with_long_options_are_forbidden() { ", ) .stderr(r#"Error: Variadic parameters may not be options - ╭─[justfile:2:6] + ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ @@ -238,7 +238,7 @@ fn variadics_with_short_options_are_forbidden() { ", ) .stderr(r#"Error: Variadic parameters may not be options - ╭─[justfile:2:6] + ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ @@ -256,7 +256,7 @@ fn long_option_names_may_not_contain_equal_sign() { ", ) .stderr(r#"Error: Option name for parameter `bar` contains equal sign - ╭─[justfile:1:18] + ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='bar=baz')] ───╯ @@ -274,7 +274,7 @@ fn short_option_names_may_not_contain_equal_sign() { ", ) .stderr(r#"Error: Option name for parameter `bar` contains equal sign - ╭─[justfile:1:19] + ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='=')] ───╯ @@ -640,7 +640,7 @@ fn value_requires_long_or_short() { ) .args(["foo", "-b=hello"]) .stderr(r#"Error: Argument attribute `value` only valid with `long` or `short` - ╭─[justfile:1:13] + ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', value='baz')] ───╯ diff --git a/tests/parameters.rs b/tests/parameters.rs index 0f508da441..51b6731402 100644 --- a/tests/parameters.rs +++ b/tests/parameters.rs @@ -25,7 +25,7 @@ fn parameter_default_values_may_not_use_later_parameters() { ) .args(["foo", "bar"]) .stderr(r#"Error: Variable `c` not defined - ╭─[justfile:1:10] + ╭─[ justfile:1:10 ] │ 1 │ @foo a b=c c='': ───╯ diff --git a/tests/parser.rs b/tests/parser.rs index b764e41468..35cb11df37 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -21,7 +21,7 @@ fn invalid_bang_operator() { ", ) .stderr(r#"Error: Expected character `=` or `~` - ╭─[justfile:1:13] + ╭─[ justfile:1:13 ] │ 1 │ x := if '' !! '' { '' } else { '' } ───╯ @@ -34,7 +34,7 @@ fn truncated_bang_operator() { Test::new() .justfile("x := if '' !") .stderr(r#"Error: Expected character `=` or `~` but found end-of-file - ╭─[justfile:1:13] + ╭─[ justfile:1:13 ] │ 1 │ x := if '' ! ───╯ diff --git a/tests/recursion_limit.rs b/tests/recursion_limit.rs index 8b690bb99e..750fe496e8 100644 --- a/tests/recursion_limit.rs +++ b/tests/recursion_limit.rs @@ -14,7 +14,7 @@ fn bugfix() { #[cfg(not(windows))] const RECURSION_LIMIT_REACHED: &str = r#"Error: Parsing recursion depth exceeded - ╭─[justfile:1:265] + ╭─[ justfile:1:265 ] │ 1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( ───╯ diff --git a/tests/settings.rs b/tests/settings.rs index a85cac4f97..3171c341cf 100644 --- a/tests/settings.rs +++ b/tests/settings.rs @@ -35,7 +35,7 @@ fn undefined_variable_in_working_directory() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:26] + ╭─[ justfile:1:26 ] │ 1 │ set working-directory := foo ───╯ @@ -52,7 +52,7 @@ fn undefined_variable_in_dotenv_filename() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:24] + ╭─[ justfile:1:24 ] │ 1 │ set dotenv-filename := foo ───╯ @@ -69,7 +69,7 @@ fn undefined_variable_in_dotenv_path() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:20] + ╭─[ justfile:1:20 ] │ 1 │ set dotenv-path := foo ───╯ @@ -86,7 +86,7 @@ fn undefined_variable_in_tempdir() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:16] + ╭─[ justfile:1:16 ] │ 1 │ set tempdir := foo ───╯ @@ -103,7 +103,7 @@ fn undefined_variable_in_script_interpreter_command() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:28] + ╭─[ justfile:1:28 ] │ 1 │ set script-interpreter := [foo] ───╯ @@ -120,7 +120,7 @@ fn undefined_variable_in_script_interpreter_argument() { ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:1:35] + ╭─[ justfile:1:35 ] │ 1 │ set script-interpreter := ['foo', bar] ───╯ @@ -137,7 +137,7 @@ fn undefined_variable_in_shell_command() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ set shell := [foo] ───╯ @@ -154,7 +154,7 @@ fn undefined_variable_in_shell_argument() { ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:1:22] + ╭─[ justfile:1:22 ] │ 1 │ set shell := ['foo', bar] ───╯ @@ -171,7 +171,7 @@ fn undefined_variable_in_windows_shell_command() { ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:1:23] + ╭─[ justfile:1:23 ] │ 1 │ set windows-shell := [foo] ───╯ @@ -188,7 +188,7 @@ fn undefined_variable_in_windows_shell_argument() { ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:1:30] + ╭─[ justfile:1:30 ] │ 1 │ set windows-shell := ['foo', bar] ───╯ diff --git a/tests/shell_expansion.rs b/tests/shell_expansion.rs index fd77c909bf..abaa1bdafa 100644 --- a/tests/shell_expansion.rs +++ b/tests/shell_expansion.rs @@ -23,7 +23,7 @@ fn shell_expanded_strings_must_not_have_whitespace() { ", ) .stderr(r#"Error: Expected '&&', '||', comment, end of file, end of line, '(', '+', or '/', but found string - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ x := x '$JUST_TEST_VARIABLE' ───╯ @@ -42,7 +42,7 @@ fn shell_expanded_error_messages_highlight_string_token() { .env("JUST_TEST_VARIABLE", "FOO") .args(["--evaluate", "x"]) .stderr(r#"Error: Shell expansion failed: error looking key 'FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' up: environment variable not found - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ x := x'$FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' ───╯ diff --git a/tests/show.rs b/tests/show.rs index 553129a2b6..fef6aca7f7 100644 --- a/tests/show.rs +++ b/tests/show.rs @@ -43,7 +43,7 @@ fn alias_show_missing_target() { .arg("f") .justfile("alias f := foo") .stderr(r#"Error: Alias `f` has an unknown target `foo` - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ alias f := foo ───╯ diff --git a/tests/slash_operator.rs b/tests/slash_operator.rs index fdf327637a..cd33b5c361 100644 --- a/tests/slash_operator.rs +++ b/tests/slash_operator.rs @@ -46,7 +46,7 @@ fn no_rhs_once() { Test::new() .justfile("x := 'a' /") .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file - ╭─[justfile:1:11] + ╭─[ justfile:1:11 ] │ 1 │ x := 'a' / ───╯ @@ -64,7 +64,7 @@ fn default_un_parenthesized() { ", ) .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '/' - ╭─[justfile:1:11] + ╭─[ justfile:1:11 ] │ 1 │ foo x='a' / 'b': ───╯ @@ -82,7 +82,7 @@ fn no_lhs_un_parenthesized() { ", ) .stderr(r#"Error: Expected backtick, identifier, '(', or string, but found '/' - ╭─[justfile:1:7] + ╭─[ justfile:1:7 ] │ 1 │ foo x=/ 'a' / 'b': ───╯ diff --git a/tests/string.rs b/tests/string.rs index 5bce47bcb7..8d62561a7e 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -122,7 +122,7 @@ fn invalid_escape_sequence() { a:"#, ) .stderr(r#"Error: `\q` is not a valid escape sequence - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\q" ───╯ @@ -145,7 +145,7 @@ a: ", ) .stderr(r#"Error: Variable `foo` not defined - ╭─[justfile:6:11] + ╭─[ justfile:6:11 ] │ 6 │ echo '{{foo}}' ───╯ @@ -168,7 +168,7 @@ a: ", ) .stderr(r#"Error: Variable `bar` not defined - ╭─[justfile:3:13] + ╭─[ justfile:3:13 ] │ 3 │ whatever' + bar ───╯ @@ -216,7 +216,7 @@ a: "#, ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:5:10] + ╭─[ justfile:5:10 ] │ 5 │ echo {{b}} ───╯ @@ -234,7 +234,7 @@ fn unterminated_raw_string() { ", ) .stderr(r#"Error: Unterminated string - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ a b= ': ───╯ @@ -252,7 +252,7 @@ fn unterminated_string() { "#, ) .stderr(r#"Error: Unterminated string - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ a b= ": ───╯ @@ -270,7 +270,7 @@ fn unterminated_backtick() { ", ) .stderr(r#"Error: Unterminated backtick - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo a= `echo blaaaaaah: ───╯ @@ -288,7 +288,7 @@ fn unterminated_indented_raw_string() { ", ) .stderr(r#"Error: Unterminated string - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ a b= ''': ───╯ @@ -306,7 +306,7 @@ fn unterminated_indented_string() { "#, ) .stderr(r#"Error: Unterminated string - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ a b= """: ───╯ @@ -324,7 +324,7 @@ fn unterminated_indented_backtick() { ", ) .stderr(r#"Error: Unterminated backtick - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo a= ```echo blaaaaaah: ───╯ @@ -474,7 +474,7 @@ fn shebang_backtick() { ", ) .stderr(r#"Error: Backticks may not start with `#!` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := `#!/usr/bin/env sh` ───╯ @@ -515,7 +515,7 @@ fn unicode_escape_no_braces() { .justfile("x := \"\\u1234\"") .args(["--evaluate", "x"]) .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found `1` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u1234" ───╯ @@ -529,7 +529,7 @@ fn unicode_escape_empty() { .justfile("x := \"\\u{}\"") .args(["--evaluate", "x"]) .stderr(r#"Error: unicode escape sequences must not be empty - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u{}" ───╯ @@ -543,7 +543,7 @@ fn unicode_escape_requires_immediate_opening_brace() { .justfile("x := \"\\u {1f916}\"") .args(["--evaluate", "x"]) .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found ` ` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u {1f916}" ───╯ @@ -559,7 +559,7 @@ fn unicode_escape_non_hex() { .stderr( r#" Error: expected hex digit [0-9A-Fa-f] but found `o` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u{foo}" ───╯ @@ -574,7 +574,7 @@ fn unicode_escape_invalid_character() { .justfile("x := \"\\u{BadBad}\"") .args(["--evaluate", "x"]) .stderr(r#"Error: unicode escape sequence value `BadBad` greater than maximum valid code point `10FFFF` - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u{BadBad}" ───╯ @@ -590,7 +590,7 @@ fn unicode_escape_too_long() { .stderr( r#" Error: unicode escape sequence starting with `\u{FFFFFFF` longer than six hex digits - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u{FFFFFFFFFF}" ───╯ @@ -605,7 +605,7 @@ fn unicode_escape_unterminated() { .justfile("x := \"\\u{1f917\"") .args(["--evaluate", "x"]) .stderr(r#"Error: unterminated unicode escape sequence - ╭─[justfile:1:6] + ╭─[ justfile:1:6 ] │ 1 │ x := "\u{1f917" ───╯ diff --git a/tests/subsequents.rs b/tests/subsequents.rs index 94b3ef21a9..ff4276fb2b 100644 --- a/tests/subsequents.rs +++ b/tests/subsequents.rs @@ -64,7 +64,7 @@ fn circular_dependency() { ", ) .stderr(r#"Error: Recipe `foo` depends on itself - ╭─[justfile:1:9] + ╭─[ justfile:1:9 ] │ 1 │ foo: && foo ───╯ @@ -81,7 +81,7 @@ fn unknown() { ", ) .stderr(r#"Error: Recipe `foo` has unknown dependency `bar` - ╭─[justfile:1:9] + ╭─[ justfile:1:9 ] │ 1 │ foo: && bar ───╯ @@ -100,7 +100,7 @@ fn unknown_argument() { ", ) .stderr(r#"Error: Variable `y` not defined - ╭─[justfile:3:14] + ╭─[ justfile:3:14 ] │ 3 │ foo: && (bar y) ───╯ diff --git a/tests/undefined_variables.rs b/tests/undefined_variables.rs index e5198b7add..2f8ba5c6a3 100644 --- a/tests/undefined_variables.rs +++ b/tests/undefined_variables.rs @@ -5,7 +5,7 @@ fn parameter_default_unknown_variable_in_expression() { Test::new() .justfile("foo a=(b+''):") .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:8] + ╭─[ justfile:1:8 ] │ 1 │ foo a=(b+''): ───╯ @@ -22,7 +22,7 @@ fn unknown_variable_in_unary_call() { ", ) .stderr(r#"Error: Variable `a` not defined - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ foo x=env_var(a): ───╯ @@ -39,7 +39,7 @@ fn unknown_first_variable_in_binary_call() { ", ) .stderr(r#"Error: Variable `a` not defined - ╭─[justfile:1:26] + ╭─[ justfile:1:26 ] │ 1 │ foo x=env_var_or_default(a, b): ───╯ @@ -56,7 +56,7 @@ fn unknown_second_variable_in_binary_call() { ", ) .stderr(r#"Error: Variable `b` not defined - ╭─[justfile:1:30] + ╭─[ justfile:1:30 ] │ 1 │ foo x=env_var_or_default('', b): ───╯ @@ -73,7 +73,7 @@ fn unknown_variable_in_ternary_call() { ", ) .stderr(r#"Error: Variable `a` not defined - ╭─[justfile:1:15] + ╭─[ justfile:1:15 ] │ 1 │ foo x=replace(a, b, c): ───╯ diff --git a/tests/unexport.rs b/tests/unexport.rs index 34bad574b5..1ed48ed9c4 100644 --- a/tests/unexport.rs +++ b/tests/unexport.rs @@ -48,7 +48,7 @@ fn duplicate_unexport_fails() { ) .env("JUST_TEST_VARIABLE", "foo") .stderr(r#"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times - ╭─[justfile:6:10] + ╭─[ justfile:6:10 ] │ 6 │ unexport JUST_TEST_VARIABLE ───╯ @@ -70,7 +70,7 @@ fn export_unexport_conflict() { ", ) .stderr(r#"Error: Variable JUST_TEST_VARIABLE is both exported and unexported - ╭─[justfile:6:8] + ╭─[ justfile:6:8 ] │ 6 │ export JUST_TEST_VARIABLE := 'foo' ───╯ diff --git a/tests/working_directory.rs b/tests/working_directory.rs index 32c022e15c..f7ded0e7a5 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -343,7 +343,7 @@ fn attribute_duplicate() { ", ) .stderr(r#"Error: Duplicate attribute `working-directory` - ╭─[justfile:2:2] + ╭─[ justfile:2:2 ] │ 1 │ [working-directory('bar')] │ ─────────────┬───────────── @@ -384,7 +384,7 @@ fn attribute_with_nocd_is_forbidden() { .stderr( " Error: Recipe `bar` has both `[no-cd]` and `[working-directory]` attributes - ╭─[justfile:3:1] + ╭─[ justfile:3:1 ] │ 3 │ bar: ───╯ From 59e3f0dc033a5c3186b2326b66593dff144e9d5d Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 04:00:05 -0800 Subject: [PATCH 07/14] just fmt --- tests/alias.rs | 6 +- tests/allow_missing.rs | 6 +- tests/arg_attribute.rs | 48 +++++--- tests/assignment.rs | 18 ++- tests/attributes.rs | 60 ++++++---- tests/byte_order_mark.rs | 6 +- tests/conditional.rs | 42 ++++--- tests/confirm.rs | 6 +- tests/delimiters.rs | 12 +- tests/dependencies.rs | 18 ++- tests/error_messages.rs | 30 +++-- tests/fallback.rs | 6 +- tests/format_string.rs | 18 ++- tests/functions.rs | 18 ++- tests/ignore_comments.rs | 6 +- tests/imports.rs | 6 +- tests/interpolation.rs | 6 +- tests/misc.rs | 222 +++++++++++++++++++++++------------ tests/modules.rs | 30 +++-- tests/newline_escape.rs | 12 +- tests/no_exit_message.rs | 30 +++-- tests/options.rs | 66 +++++++---- tests/parameters.rs | 6 +- tests/parser.rs | 12 +- tests/settings.rs | 60 ++++++---- tests/show.rs | 6 +- tests/slash_operator.rs | 18 ++- tests/string.rs | 90 +++++++++----- tests/subsequents.rs | 18 ++- tests/test.rs | 10 +- tests/undefined_variables.rs | 30 +++-- tests/unexport.rs | 12 +- tests/working_directory.rs | 8 +- 33 files changed, 626 insertions(+), 316 deletions(-) diff --git a/tests/alias.rs b/tests/alias.rs index b1779d2369..d645d95f44 100644 --- a/tests/alias.rs +++ b/tests/alias.rs @@ -32,12 +32,14 @@ fn unknown_nested_alias() { ", ) .arg("b") - .stderr(r#"Error: Alias `b` has an unknown target `foo::bar::baz` + .stderr( + r#"Error: Alias `b` has an unknown target `foo::bar::baz` ╭─[ justfile:3:7 ] │ 3 │ alias b := foo::bar::baz ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/allow_missing.rs b/tests/allow_missing.rs index 4abc4a3ed1..70d98f26c4 100644 --- a/tests/allow_missing.rs +++ b/tests/allow_missing.rs @@ -25,12 +25,14 @@ fn allow_missing_does_not_apply_to_compilation_errors() { Test::new() .justfile("bar: foo") .args(["--allow-missing", "foo"]) - .stderr(r#"Error: Recipe `bar` has unknown dependency `foo` + .stderr( + r#"Error: Recipe `bar` has unknown dependency `foo` ╭─[ justfile:1:6 ] │ 1 │ bar: foo ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/arg_attribute.rs b/tests/arg_attribute.rs index 28de9d846c..3b5b93e25b 100644 --- a/tests/arg_attribute.rs +++ b/tests/arg_attribute.rs @@ -76,12 +76,14 @@ fn pattern_invalid_regex_error() { foo bar: ", ) - .stderr(r#"Error: Failed to parse argument pattern + .stderr( + r#"Error: Failed to parse argument pattern ╭─[ justfile:1:21 ] │ 1 │ [arg('bar', pattern='{')] ───╯ -"#) +"#, + ) .failure(); } @@ -115,12 +117,14 @@ fn duplicate_attribute_error() { ", ) .args(["foo", "BAR"]) - .stderr(r#"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 + .stderr( + r#"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 ╭─[ justfile:2:2 ] │ 2 │ [arg('bar', pattern='BAR')] ───╯ -"#) +"#, + ) .failure(); } @@ -134,12 +138,14 @@ fn extra_keyword_error() { ", ) .args(["foo", "BAR"]) - .stderr(r#"Error: Unknown keyword `foo` for `arg` attribute + .stderr( + r#"Error: Unknown keyword `foo` for `arg` attribute ╭─[ justfile:1:28 ] │ 1 │ [arg('bar', pattern='BAR', foo='foo')] ───╯ -"#) +"#, + ) .failure(); } @@ -153,12 +159,14 @@ fn unknown_argument_error() { ", ) .arg("foo") - .stderr(r#"Error: Argument attribute for undefined argument `bar` + .stderr( + r#"Error: Argument attribute for undefined argument `bar` ╭─[ justfile:1:6 ] │ 1 │ [arg('bar', pattern='BAR')] ───╯ -"#) +"#, + ) .failure(); } @@ -204,12 +212,14 @@ fn positional_arguments_cannot_follow_keyword_arguments() { ", ) .args(["foo", "BAR"]) - .stderr(r#"Error: Positional attribute arguments cannot follow keyword attribute arguments + .stderr( + r#"Error: Positional attribute arguments cannot follow keyword attribute arguments ╭─[ justfile:1:21 ] │ 1 │ [arg(pattern='BAR', 'bar')] ───╯ -"#) +"#, + ) .failure(); } @@ -332,12 +342,14 @@ fn pattern_requires_value() { foo bar: ", ) - .stderr(r#"Error: Attribute key `pattern` requires value + .stderr( + r#"Error: Attribute key `pattern` requires value ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', pattern)] ───╯ -"#) +"#, + ) .failure(); } @@ -350,12 +362,14 @@ fn short_requires_value() { foo bar: ", ) - .stderr(r#"Error: Attribute key `short` requires value + .stderr( + r#"Error: Attribute key `short` requires value ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', short)] ───╯ -"#) +"#, + ) .failure(); } @@ -368,11 +382,13 @@ fn value_requires_value() { foo bar: ", ) - .stderr(r#"Error: Attribute key `value` requires value + .stderr( + r#"Error: Attribute key `value` requires value ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', long, value)] ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/assignment.rs b/tests/assignment.rs index 4f7be9fa64..e221b3b0fa 100644 --- a/tests/assignment.rs +++ b/tests/assignment.rs @@ -8,12 +8,14 @@ fn set_export_parse_error() { set export := fals ", ) - .stderr(r#"Error: Expected keyword `true` or `false` but found identifier `fals` + .stderr( + r#"Error: Expected keyword `true` or `false` but found identifier `fals` ╭─[ justfile:1:15 ] │ 1 │ set export := fals ───╯ -"#) +"#, + ) .failure(); } @@ -25,12 +27,14 @@ fn set_export_parse_error_eol() { set export := ", ) - .stderr(r#"Error: Expected identifier, but found end of line + .stderr( + r#"Error: Expected identifier, but found end of line ╭─[ justfile:1:14 ] │ 1 │ set export := ───╯ -"#) +"#, + ) .failure(); } @@ -44,11 +48,13 @@ fn invalid_attributes_are_an_error() { ", ) .args(["--evaluate", "x"]) - .stderr(r#"Error: Assignment `x` has invalid attribute `group` + .stderr( + r#"Error: Assignment `x` has invalid attribute `group` ╭─[ justfile:2:1 ] │ 2 │ x := 'foo' ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/attributes.rs b/tests/attributes.rs index 55a72fb5a7..714984bead 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -30,7 +30,8 @@ fn duplicate_attributes_are_disallowed() { echo bar ", ) - .stderr(r#"Error: Duplicate attribute `no-exit-message` + .stderr( + r#"Error: Duplicate attribute `no-exit-message` ╭─[ justfile:2:2 ] │ 1 │ [no-exit-message] @@ -40,7 +41,8 @@ fn duplicate_attributes_are_disallowed() { │ ───────┬─────── │ ╰───────── duplicate ───╯ -"#) +"#, + ) .failure(); } @@ -70,12 +72,14 @@ fn multiple_attributes_one_line_error_message() { exit 1 ", ) - .stderr(r#"Error: Expected ']', ':', ',', or '(', but found identifier + .stderr( + r#"Error: Expected ']', ':', ',', or '(', but found identifier ╭─[ justfile:1:16 ] │ 1 │ [macos,windows linux,openbsd] ───╯ -"#) +"#, + ) .failure(); } @@ -90,7 +94,8 @@ fn multiple_attributes_one_line_duplicate_check() { exit 1 ", ) - .stderr(r#"Error: Duplicate attribute `linux` + .stderr( + r#"Error: Duplicate attribute `linux` ╭─[ justfile:2:2 ] │ 1 │ [macos, windows, linux, openbsd] @@ -100,7 +105,8 @@ fn multiple_attributes_one_line_duplicate_check() { │ ──┬── │ ╰──── duplicate ───╯ -"#) +"#, + ) .failure(); } @@ -114,7 +120,8 @@ fn unexpected_attribute_argument() { exit 1 ", ) - .stderr(r#"Error: Attribute argument count mismatch + .stderr( + r#"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [private('foo')] @@ -123,7 +130,8 @@ fn unexpected_attribute_argument() { │ │ Note: `private` takes 0 arguments ───╯ -"#) +"#, + ) .failure(); } @@ -169,7 +177,8 @@ fn expected_metadata_attribute_argument() { exit 1 ", ) - .stderr(r#"Error: Attribute argument count mismatch + .stderr( + r#"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [metadata] @@ -178,7 +187,8 @@ fn expected_metadata_attribute_argument() { │ │ Note: `metadata` takes between 1 and 18446744073709551615 arguments ───╯ -"#) +"#, + ) .failure(); } @@ -270,12 +280,14 @@ fn extension_on_linewise_error() { baz: ", ) - .stderr(r#"Error: Recipe `baz` has invalid attribute `extension` + .stderr( + r#"Error: Recipe `baz` has invalid attribute `extension` ╭─[ justfile:2:1 ] │ 2 │ baz: ───╯ -"#) +"#, + ) .failure(); } @@ -289,7 +301,8 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { baz: ", ) - .stderr(r#"Error: Duplicate attribute `confirm` + .stderr( + r#"Error: Duplicate attribute `confirm` ╭─[ justfile:2:2 ] │ 1 │ [confirm: 'yes'] @@ -299,7 +312,8 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { │ ───┬─── │ ╰───── duplicate ───╯ -"#) +"#, + ) .failure(); } @@ -393,7 +407,8 @@ fn env_attribute_too_few_arguments() { echo bar ", ) - .stderr(r#"Error: Attribute argument count mismatch + .stderr( + r#"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [env('MY_VAR')] @@ -402,7 +417,8 @@ fn env_attribute_too_few_arguments() { │ │ Note: `env` takes 2 arguments ───╯ -"#) +"#, + ) .failure(); } @@ -416,7 +432,8 @@ fn env_attribute_too_many_arguments() { echo bar ", ) - .stderr(r#"Error: Attribute argument count mismatch + .stderr( + r#"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [env('A', 'B', 'C')] @@ -425,7 +442,8 @@ fn env_attribute_too_many_arguments() { │ │ Note: `env` takes 2 arguments ───╯ -"#) +"#, + ) .failure(); } @@ -440,11 +458,13 @@ fn env_attribute_duplicate_error() { @echo $VAR1 ", ) - .stderr(r#"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 + .stderr( + r#"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 ╭─[ justfile:2:2 ] │ 2 │ [env('VAR1', 'value 2')] ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/byte_order_mark.rs b/tests/byte_order_mark.rs index 6c61c0708c..859e913e23 100644 --- a/tests/byte_order_mark.rs +++ b/tests/byte_order_mark.rs @@ -37,11 +37,13 @@ fn non_leading_byte_order_mark_produces_error() { fn dont_mention_byte_order_mark_in_errors() { Test::new() .justfile("{") - .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' + .stderr( + r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' ╭─[ justfile:1:1 ] │ 1 │ { ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/conditional.rs b/tests/conditional.rs index d84e6462b6..28a2a7a10b 100644 --- a/tests/conditional.rs +++ b/tests/conditional.rs @@ -81,12 +81,14 @@ fn undefined_lhs() { echo {{ a }} ", ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:9 ] │ 1 │ a := if b == '' { '' } else { '' } ───╯ -"#) +"#, + ) .failure(); } @@ -101,12 +103,14 @@ fn undefined_rhs() { echo {{ a }} ", ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:15 ] │ 1 │ a := if '' == b { '' } else { '' } ───╯ -"#) +"#, + ) .failure(); } @@ -121,12 +125,14 @@ fn undefined_then() { echo {{ a }} ", ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:20 ] │ 1 │ a := if '' == '' { b } else { '' } ───╯ -"#) +"#, + ) .failure(); } @@ -141,12 +147,14 @@ fn undefined_otherwise() { echo {{ a }} ", ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:32 ] │ 1 │ a := if '' == '' { '' } else { b } ───╯ -"#) +"#, + ) .failure(); } @@ -161,12 +169,14 @@ fn unexpected_op() { echo {{ a }} ", ) - .stderr(r#"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier + .stderr( + r#"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier ╭─[ justfile:1:12 ] │ 1 │ a := if '' a '' { '' } else { b } ───╯ -"#) +"#, + ) .failure(); } @@ -217,12 +227,14 @@ fn missing_else() { TEST := if path_exists('/bin/bash') == 'true' {'yes'} ", ) - .stderr(r#"Error: Expected keyword `else` but found `end of line` + .stderr( + r#"Error: Expected keyword `else` but found `end of line` ╭─[ justfile:1:54 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} ───╯ -"#) +"#, + ) .failure(); } @@ -234,11 +246,13 @@ fn incorrect_else_identifier() { TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} ", ) - .stderr(r#"Error: Expected keyword `else` but found identifier `els` + .stderr( + r#"Error: Expected keyword `else` but found identifier `els` ╭─[ justfile:1:55 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/confirm.rs b/tests/confirm.rs index b194acfd0b..e914eb1b2e 100644 --- a/tests/confirm.rs +++ b/tests/confirm.rs @@ -127,7 +127,8 @@ fn confirm_recipe_with_prompt_too_many_args() { echo confirmed "#, ) - .stderr(r#"Error: Attribute argument count mismatch + .stderr( + r#"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [confirm("PROMPT","EXTRA")] @@ -136,7 +137,8 @@ fn confirm_recipe_with_prompt_too_many_args() { │ │ Note: `confirm` takes between 0 and 1 arguments ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/delimiters.rs b/tests/delimiters.rs index a7570612c4..01c3b2e4b6 100644 --- a/tests/delimiters.rs +++ b/tests/delimiters.rs @@ -4,12 +4,14 @@ use super::*; fn mismatched_delimiter() { Test::new() .justfile("(]") - .stderr(r#"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) + .stderr( + r#"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) ╭─[ justfile:1:2 ] │ 1 │ (] ───╯ -"#) +"#, + ) .failure(); } @@ -17,12 +19,14 @@ fn mismatched_delimiter() { fn unexpected_delimiter() { Test::new() .justfile("]") - .stderr(r#"Error: Unexpected closing delimiter `]` + .stderr( + r#"Error: Unexpected closing delimiter `]` ╭─[ justfile:1:1 ] │ 1 │ ] ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/dependencies.rs b/tests/dependencies.rs index 163d48392c..546dea3c6e 100644 --- a/tests/dependencies.rs +++ b/tests/dependencies.rs @@ -44,12 +44,14 @@ fn dependency_not_in_submodule() { ", ) .arg("baz") - .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::baz` + .stderr( + r#"Error: Recipe `baz` has unknown dependency `foo::baz` ╭─[ justfile:2:11 ] │ 2 │ baz: foo::baz ───╯ -"#) +"#, + ) .failure(); } @@ -66,12 +68,14 @@ fn dependency_submodule_missing() { ", ) .arg("baz") - .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` + .stderr( + r#"Error: Recipe `baz` has unknown dependency `foo::bar` ╭─[ justfile:5:11 ] │ 5 │ baz: foo::bar ───╯ -"#) +"#, + ) .failure(); } @@ -87,12 +91,14 @@ fn recipe_dependency_on_module_fails() { ", ) .arg("baz") - .stderr(r#"Error: Recipe `baz` has unknown dependency `foo::bar` + .stderr( + r#"Error: Recipe `baz` has unknown dependency `foo::bar` ╭─[ justfile:2:11 ] │ 2 │ baz: foo::bar ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/error_messages.rs b/tests/error_messages.rs index 859514bf3f..bd90094470 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -4,12 +4,14 @@ use super::*; fn invalid_alias_attribute() { Test::new() .justfile("[private]\n[linux]\nalias t := test\n\ntest:\n") - .stderr(r#"Error: Alias `t` has invalid attribute `linux` + .stderr( + r#"Error: Alias `t` has invalid attribute `linux` ╭─[ justfile:3:7 ] │ 3 │ alias t := test ───╯ -"#) +"#, + ) .failure(); } @@ -17,12 +19,14 @@ fn invalid_alias_attribute() { fn expected_keyword() { Test::new() .justfile("foo := if '' == '' { '' } arlo { '' }") - .stderr(r#"Error: Expected keyword `else` but found identifier `arlo` + .stderr( + r#"Error: Expected keyword `else` but found identifier `arlo` ╭─[ justfile:1:27 ] │ 1 │ foo := if '' == '' { '' } arlo { '' } ───╯ -"#) +"#, + ) .failure(); } @@ -30,12 +34,14 @@ fn expected_keyword() { fn unexpected_character() { Test::new() .justfile("&~") - .stderr(r#"Error: Expected character `&` + .stderr( + r#"Error: Expected character `&` ╭─[ justfile:1:2 ] │ 1 │ &~ ───╯ -"#) +"#, + ) .failure(); } @@ -58,12 +64,14 @@ fn argument_count_mismatch() { 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") - .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found end of file + .stderr( + r#"Error: Expected '*', ':', '$', identifier, or '+', but found end of file ╭─[ justfile:20:4 ] │ 20 │ foo ────╯ -"#) +"#, + ) .failure(); } @@ -109,11 +117,13 @@ fn redefinition_errors_properly_swap_types() { Test::new() .write("foo.just", "foo:") .justfile("foo:\n echo foo\n\nmod foo 'foo.just'") - .stderr(r#"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 + .stderr( + r#"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 ╭─[ justfile:4:5 ] │ 4 │ mod foo 'foo.just' ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/fallback.rs b/tests/fallback.rs index 30899aa90e..67bf1d932c 100644 --- a/tests/fallback.rs +++ b/tests/fallback.rs @@ -143,12 +143,14 @@ fn print_error_from_parent_if_recipe_not_found_in_current() { .justfile("foo:\n echo {{bar}}") .args(["foo"]) .current_dir("bar") - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:2:9 ] │ 2 │ echo {{bar}} ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/format_string.rs b/tests/format_string.rs index 098cc3628d..c6e7359e30 100644 --- a/tests/format_string.rs +++ b/tests/format_string.rs @@ -147,12 +147,14 @@ fn recipe_body() { fn unclosed() { Test::new() .justfile("foo := f'FOO{{") - .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + .stderr( + r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file ╭─[ justfile:1:15 ] │ 1 │ foo := f'FOO{{ ───╯ -"#) +"#, + ) .failure(); } @@ -233,12 +235,14 @@ fn escaped_delimiter_in_double_quoted_format_string() { "#, ) .args(["--evaluate", "foo"]) - .stderr(r#"Error: `\{` is not a valid escape sequence + .stderr( + r#"Error: `\{` is not a valid escape sequence ╭─[ justfile:1:9 ] │ 1 │ foo := f"\{{{{" ───╯ -"#) +"#, + ) .failure(); } @@ -334,12 +338,14 @@ fn undefined_variable_error() { foo := f'{{bar}}' ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:1:12 ] │ 1 │ foo := f'{{bar}}' ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/functions.rs b/tests/functions.rs index 3b4831d173..0aa517e189 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -770,12 +770,14 @@ fn join_argument_count_error() { Test::new() .justfile("x := join('a')") .args(["--evaluate"]) - .stderr(r#"Error: Function `join` called with 1 argument but takes 2 or more + .stderr( + r#"Error: Function `join` called with 1 argument but takes 2 or more ╭─[ justfile:1:6 ] │ 1 │ x := join('a') ───╯ -"#) +"#, + ) .failure(); } @@ -989,12 +991,14 @@ fn shell_no_argument() { Test::new() .justfile("var := shell()") .args(["--evaluate"]) - .stderr(r#"Error: Function `shell` called with 0 arguments but takes 1 or more + .stderr( + r#"Error: Function `shell` called with 0 arguments but takes 1 or more ╭─[ justfile:1:8 ] │ 1 │ var := shell() ───╯ -"#) +"#, + ) .failure(); } @@ -1271,12 +1275,14 @@ fn unary_argument_count_mismamatch_error_message() { Test::new() .justfile("x := datetime()") .args(["--evaluate"]) - .stderr(r#"Error: Function `datetime` called with 0 arguments but takes 1 + .stderr( + r#"Error: Function `datetime` called with 0 arguments but takes 1 ╭─[ justfile:1:6 ] │ 1 │ x := datetime() ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/ignore_comments.rs b/tests/ignore_comments.rs index 33722218a5..162ce20cce 100644 --- a/tests/ignore_comments.rs +++ b/tests/ignore_comments.rs @@ -122,11 +122,13 @@ fn comments_still_must_be_parsable_when_ignored() { # {{ foo bar }} ", ) - .stderr(r#"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier + .stderr( + r#"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier ╭─[ justfile:4:12 ] │ 4 │ # {{ foo bar }} ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/imports.rs b/tests/imports.rs index f7b8d46b80..804605faf5 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -148,12 +148,14 @@ fn listed_recipes_in_imports_are_in_load_order() { fn include_error() { Test::new() .justfile("!include foo") - .stderr(r#"Error: The `!include` directive has been stabilized as `import` + .stderr( + r#"Error: The `!include` directive has been stabilized as `import` ╭─[ justfile:1:1 ] │ 1 │ !include foo ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/interpolation.rs b/tests/interpolation.rs index 9b3020972a..d23c565482 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -57,12 +57,14 @@ fn comment_in_interopolation() { }} ", ) - .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found comment + .stderr( + r#"Error: Expected backtick, identifier, '(', '/', or string, but found comment ╭─[ justfile:2:11 ] │ 2 │ echo {{ # hello ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/misc.rs b/tests/misc.rs index fe3147f68d..dcecc4c4c3 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -114,12 +114,14 @@ fn bad_setting() { set foo ", ) - .stderr(r#"Error: Unknown setting `foo` + .stderr( + r#"Error: Unknown setting `foo` ╭─[ justfile:1:5 ] │ 1 │ set foo ───╯ -"#) +"#, + ) .failure(); } @@ -131,12 +133,14 @@ fn bad_setting_with_keyword_name() { set if := 'foo' ", ) - .stderr(r#"Error: Unknown setting `if` + .stderr( + r#"Error: Unknown setting `if` ╭─[ justfile:1:5 ] │ 1 │ set if := 'foo' ───╯ -"#) +"#, + ) .failure(); } @@ -154,12 +158,14 @@ fn alias_with_dependencies() { fn duplicate_alias() { Test::new() .justfile("alias foo := bar\nalias foo := baz\n") - .stderr(r#"Error: Alias `foo` first defined on line 1 is redefined on line 2 + .stderr( + r#"Error: Alias `foo` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:7 ] │ 2 │ alias foo := baz ───╯ -"#) +"#, + ) .failure(); } @@ -167,12 +173,14 @@ fn duplicate_alias() { fn unknown_alias_target() { Test::new() .justfile("alias foo := bar\n") - .stderr(r#"Error: Alias `foo` has an unknown target `bar` + .stderr( + r#"Error: Alias `foo` has an unknown target `bar` ╭─[ justfile:1:7 ] │ 1 │ alias foo := bar ───╯ -"#) +"#, + ) .failure(); } @@ -180,12 +188,14 @@ fn unknown_alias_target() { fn alias_shadows_recipe() { Test::new() .justfile("bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo") - .stderr(r#"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 + .stderr( + r#"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 ╭─[ justfile:4:1 ] │ 4 │ foo: ───╯ -"#) +"#, + ) .failure(); } @@ -286,12 +296,14 @@ recipe: fn unknown_dependency() { Test::new() .justfile("bar:\nhello:\nfoo: bar baaaaaaaz hello") - .stderr(r#"Error: Recipe `foo` has unknown dependency `baaaaaaaz` + .stderr( + r#"Error: Recipe `foo` has unknown dependency `baaaaaaaz` ╭─[ justfile:3:10 ] │ 3 │ foo: bar baaaaaaaz hello ───╯ -"#) +"#, + ) .failure(); } @@ -717,12 +729,14 @@ fn line_error_spacing() { ^^^ ", ) - .stderr(r#"Error: Unknown start of token '^' + .stderr( + r#"Error: Unknown start of token '^' ╭─[ justfile:10:1 ] │ 10 │ ^^^ ────╯ -"#) +"#, + ) .failure(); } @@ -931,13 +945,15 @@ recipe a b +d: fn mixed_whitespace() { Test::new() .justfile("bar:\n\t echo hello") - .stderr(r#"Error: Found a mix of tabs and spaces in leading whitespace: `␉␠` + .stderr( + r#"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 ───╯ -"#) +"#, + ) .failure(); } @@ -945,12 +961,14 @@ Leading whitespace may consist of tabs or spaces, but not both fn extra_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t\t\techo goodbye") - .stderr(r#"Error: Recipe line has extra leading whitespace + .stderr( + r#"Error: Recipe line has extra leading whitespace ╭─[ justfile:3:3 ] │ 3 │ echo goodbye ───╯ -"#) +"#, + ) .failure(); } @@ -971,12 +989,14 @@ fn inconsistent_leading_whitespace() { fn required_after_default() { Test::new() .justfile("bar:\nhello baz arg='foo' bar:") - .stderr(r#"Error: Non-default parameter `bar` follows default parameter + .stderr( + r#"Error: Non-default parameter `bar` follows default parameter ╭─[ justfile:2:21 ] │ 2 │ hello baz arg='foo' bar: ───╯ -"#) +"#, + ) .failure(); } @@ -984,12 +1004,14 @@ fn required_after_default() { fn required_after_plus_variadic() { Test::new() .justfile("bar:\nhello baz +arg bar:") - .stderr(r#"Error: Parameter `bar` follows variadic parameter + .stderr( + r#"Error: Parameter `bar` follows variadic parameter ╭─[ justfile:2:16 ] │ 2 │ hello baz +arg bar: ───╯ -"#) +"#, + ) .failure(); } @@ -997,12 +1019,14 @@ fn required_after_plus_variadic() { fn required_after_star_variadic() { Test::new() .justfile("bar:\nhello baz *arg bar:") - .stderr(r#"Error: Parameter `bar` follows variadic parameter + .stderr( + r#"Error: Parameter `bar` follows variadic parameter ╭─[ justfile:2:16 ] │ 2 │ hello baz *arg bar: ───╯ -"#) +"#, + ) .failure(); } @@ -1464,12 +1488,14 @@ fn unknown_function_in_assignment() { r#"foo := foo() + "hello" bar:"#, ) - .stderr(r#"Error: Call to unknown function `foo` + .stderr( + r#"Error: Call to unknown function `foo` ╭─[ justfile:1:8 ] │ 1 │ foo := foo() + "hello" ───╯ -"#) +"#, + ) .failure(); } @@ -1483,12 +1509,14 @@ fn dependency_takes_arguments_exact() { b: a ", ) - .stderr(r#"Error: Dependency `a` got 0 arguments but takes 1 argument + .stderr( + r#"Error: Dependency `a` got 0 arguments but takes 1 argument ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ -"#) +"#, + ) .failure(); } @@ -1502,12 +1530,14 @@ fn dependency_takes_arguments_at_least() { b: a ", ) - .stderr(r#"Error: Dependency `a` got 0 arguments but takes at least 1 argument + .stderr( + r#"Error: Dependency `a` got 0 arguments but takes at least 1 argument ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ -"#) +"#, + ) .failure(); } @@ -1521,12 +1551,14 @@ fn dependency_takes_arguments_at_most() { b: (a '0' '1' '2') ", ) - .stderr(r#"Error: Dependency `a` got 3 arguments but takes at most 2 arguments + .stderr( + r#"Error: Dependency `a` got 3 arguments but takes at most 2 arguments ╭─[ justfile:2:5 ] │ 2 │ b: (a '0' '1' '2') ───╯ -"#) +"#, + ) .failure(); } @@ -1535,12 +1567,14 @@ fn duplicate_parameter() { Test::new() .arg("a") .justfile("a foo foo:") - .stderr(r#"Error: Recipe `a` has duplicate parameter `foo` + .stderr( + r#"Error: Recipe `a` has duplicate parameter `foo` ╭─[ justfile:1:7 ] │ 1 │ a foo foo: ───╯ -"#) +"#, + ) .failure(); } @@ -1549,12 +1583,14 @@ fn duplicate_recipe() { Test::new() .arg("b") .justfile("b:\nb:") - .stderr(r#"Error: Recipe `b` first defined on line 1 is redefined on line 2 + .stderr( + r#"Error: Recipe `b` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:1 ] │ 2 │ b: ───╯ -"#) +"#, + ) .failure(); } @@ -1563,12 +1599,14 @@ fn duplicate_variable() { Test::new() .arg("foo") .justfile("a := 'hello'\na := 'hello'\nfoo:") - .stderr(r#"Error: Variable `a` has multiple definitions + .stderr( + r#"Error: Variable `a` has multiple definitions ╭─[ justfile:2:1 ] │ 2 │ a := 'hello' ───╯ -"#) +"#, + ) .failure(); } @@ -1591,12 +1629,14 @@ fn unexpected_token_after_name() { Test::new() .arg("foo") .justfile("foo 'bar'") - .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found string + .stderr( + r#"Error: Expected '*', ':', '$', identifier, or '+', but found string ╭─[ justfile:1:5 ] │ 1 │ foo 'bar' ───╯ -"#) +"#, + ) .failure(); } @@ -1605,12 +1645,14 @@ fn self_dependency() { Test::new() .arg("a") .justfile("a: a") - .stderr(r#"Error: Recipe `a` depends on itself + .stderr( + r#"Error: Recipe `a` depends on itself ╭─[ justfile:1:4 ] │ 1 │ a: a ───╯ -"#) +"#, + ) .failure(); } @@ -1619,12 +1661,14 @@ fn long_circular_recipe_dependency() { Test::new() .arg("a") .justfile("a: b\nb: c\nc: d\nd: a") - .stderr(r#"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` + .stderr( + r#"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` ╭─[ justfile:4:4 ] │ 4 │ d: a ───╯ -"#) +"#, + ) .failure(); } @@ -1633,12 +1677,14 @@ fn variable_self_dependency() { Test::new() .arg("a") .justfile("z := z\na:") - .stderr(r#"Error: Variable `z` is defined in terms of itself + .stderr( + r#"Error: Variable `z` is defined in terms of itself ╭─[ justfile:1:1 ] │ 1 │ z := z ───╯ -"#) +"#, + ) .failure(); } @@ -1647,12 +1693,14 @@ fn variable_circular_dependency() { Test::new() .arg("a") .justfile("x := y\ny := z\nz := x\na:") - .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> z -> x` + .stderr( + r#"Error: Variable `x` depends on its own value: `x -> y -> z -> x` ╭─[ justfile:1:1 ] │ 1 │ x := y ───╯ -"#) +"#, + ) .failure(); } @@ -1669,12 +1717,14 @@ fn variable_circular_dependency_with_additional_variable() { a: ", ) - .stderr(r#"Error: Variable `x` depends on its own value: `x -> y -> x` + .stderr( + r#"Error: Variable `x` depends on its own value: `x -> y -> x` ╭─[ justfile:2:1 ] │ 2 │ x := y ───╯ -"#) +"#, + ) .failure(); } @@ -1840,12 +1890,14 @@ foo *a +b: echo {{a}} {{b}} ", ) - .stderr(r#"Error: Expected ':' or '=', but found '+' + .stderr( + r#"Error: Expected ':' or '=', but found '+' ╭─[ justfile:1:8 ] │ 1 │ foo *a +b: ───╯ -"#) +"#, + ) .failure(); } @@ -1858,12 +1910,14 @@ foo +a *b: echo {{a}} {{b}} ", ) - .stderr(r#"Error: Expected ':' or '=', but found '*' + .stderr( + r#"Error: Expected ':' or '=', but found '*' ╭─[ justfile:1:8 ] │ 1 │ foo +a *b: ───╯ -"#) +"#, + ) .failure(); } @@ -1906,12 +1960,14 @@ x: a: x y ", ) - .stderr(r#"Error: Recipe `a` has unknown dependency `y` + .stderr( + r#"Error: Recipe `a` has unknown dependency `y` ╭─[ justfile:3:6 ] │ 3 │ a: x y ───╯ -"#) +"#, + ) .failure(); } @@ -2022,12 +2078,14 @@ fn invalid_escape_sequence_message() { X := "\'" "#, ) - .stderr(r#"Error: `\'` is not a valid escape sequence + .stderr( + r#"Error: `\'` is not a valid escape sequence ╭─[ justfile:1:6 ] │ 1 │ X := "\'" ───╯ -"#) +"#, + ) .failure(); } @@ -2039,12 +2097,14 @@ fn unknown_variable_in_default() { foo x=bar: ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:1:7 ] │ 1 │ foo x=bar: ───╯ -"#) +"#, + ) .failure(); } @@ -2056,12 +2116,14 @@ fn unknown_function_in_default() { foo x=bar(): ", ) - .stderr(r#"Error: Call to unknown function `bar` + .stderr( + r#"Error: Call to unknown function `bar` ╭─[ justfile:1:7 ] │ 1 │ foo x=bar(): ───╯ -"#) +"#, + ) .failure(); } @@ -2131,12 +2193,14 @@ fn unterminated_interpolation_eol() { echo {{ ", ) - .stderr(r#"Error: Unterminated interpolation + .stderr( + r#"Error: Unterminated interpolation ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ -"#) +"#, + ) .failure(); } @@ -2149,12 +2213,14 @@ fn unterminated_interpolation_eof() { echo {{ ", ) - .stderr(r#"Error: Unterminated interpolation + .stderr( + r#"Error: Unterminated interpolation ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ -"#) +"#, + ) .failure(); } @@ -2166,12 +2232,14 @@ fn unknown_start_of_token() { assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ", ) - .stderr(r#"Error: Unknown start of token '%' + .stderr( + r#"Error: Unknown start of token '%' ╭─[ justfile:1:25 ] │ 1 │ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ───╯ -"#) +"#, + ) .failure(); } @@ -2183,12 +2251,14 @@ fn unknown_start_of_token_invisible_unicode() { \u{200b}foo := 'bar' ", ) - .stderr(r#"Error: Unknown start of token '​' (U+200B) + .stderr( + r#"Error: Unknown start of token '​' (U+200B) ╭─[ justfile:1:1 ] │ 1 │ ​foo := 'bar' ───╯ -"#) +"#, + ) .failure(); } @@ -2200,12 +2270,14 @@ fn unknown_start_of_token_ascii_control_char() { \0foo := 'bar' ", ) - .stderr(r#"Error: Unknown start of token '' (U+0000) + .stderr( + r#"Error: Unknown start of token '' (U+0000) ╭─[ justfile:1:1 ] │ 1 │ foo := 'bar' ───╯ -"#) +"#, + ) .failure(); } @@ -2329,12 +2401,14 @@ fn old_equals_assignment_syntax_produces_error() { echo {{foo}} ", ) - .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '=' + .stderr( + r#"Error: Expected '*', ':', '$', identifier, or '+', but found '=' ╭─[ justfile:1:5 ] │ 1 │ foo = 'bar' ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/modules.rs b/tests/modules.rs index f65d0a1959..19e2ccbd0b 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -203,12 +203,14 @@ foo: ) .arg("foo") .arg("foo") - .stderr(r#"Error: Recipe `foo` first defined on line 1 is redefined on line 2 + .stderr( + r#"Error: Recipe `foo` first defined on line 1 is redefined on line 2 ╭─[ foo.just:2:1 ] │ 2 │ foo: ───╯ -"#) +"#, + ) .failure(); } @@ -222,12 +224,14 @@ fn modules_conflict_with_recipes() { foo: ", ) - .stderr(r#"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 + .stderr( + r#"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 ╭─[ justfile:2:1 ] │ 2 │ foo: ───╯ -"#) +"#, + ) .failure(); } @@ -242,12 +246,14 @@ fn modules_conflict_with_aliases() { alias foo := bar ", ) - .stderr(r#"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 + .stderr( + r#"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 ╭─[ justfile:3:7 ] │ 3 │ alias foo := bar ───╯ -"#) +"#, + ) .failure(); } @@ -263,12 +269,14 @@ fn modules_conflict_with_other_modules() { bar: ", ) - .stderr(r#"Error: Module `foo` first defined on line 1 is redefined on line 2 + .stderr( + r#"Error: Module `foo` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ -"#) +"#, + ) .failure(); } @@ -1007,12 +1015,14 @@ fn bad_module_attribute_fails() { ) .test_round_trip(false) .arg("--list") - .stderr(r#"Error: Module `foo` has invalid attribute `no-cd` + .stderr( + r#"Error: Module `foo` has invalid attribute `no-cd` ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/newline_escape.rs b/tests/newline_escape.rs index 698eb31417..0376b0af02 100644 --- a/tests/newline_escape.rs +++ b/tests/newline_escape.rs @@ -68,12 +68,14 @@ fn newline_escape_deps_invalid_esc() { default: a\\ b ", ) - .stderr(r#"Error: `\ ` is not a valid escape sequence + .stderr( + r#"Error: `\ ` is not a valid escape sequence ╭─[ justfile:1:11 ] │ 1 │ default: a\ b ───╯ -"#) +"#, + ) .failure(); } @@ -84,11 +86,13 @@ fn newline_escape_unpaired_linefeed() { " default:\\\ra", ) - .stderr(r#"Error: Unpaired carriage return + .stderr( + r#"Error: Unpaired carriage return ╭─[ justfile:1:9 ] │ 1 │ default:\ ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/no_exit_message.rs b/tests/no_exit_message.rs index 5c6820662a..744923e8af 100644 --- a/tests/no_exit_message.rs +++ b/tests/no_exit_message.rs @@ -64,12 +64,14 @@ fn unknown_attribute() { @exit 100 ", ) - .stderr(r#"Error: Unknown attribute `unknown-attribute` + .stderr( + r#"Error: Unknown attribute `unknown-attribute` ╭─[ justfile:2:2 ] │ 2 │ [unknown-attribute] ───╯ -"#) +"#, + ) .failure(); } @@ -84,12 +86,14 @@ fn empty_attribute() { @exit 100 ", ) - .stderr(r#"Error: Expected identifier, but found ']' + .stderr( + r#"Error: Expected identifier, but found ']' ╭─[ justfile:2:2 ] │ 2 │ [] ───╯ -"#) +"#, + ) .failure(); } @@ -104,12 +108,14 @@ fn extraneous_attribute_before_comment() { @exit 100 ", ) - .stderr(r#"Error: Extraneous attribute + .stderr( + r#"Error: Extraneous attribute ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ -"#) +"#, + ) .failure(); } @@ -124,12 +130,14 @@ fn extraneous_attribute_before_empty_line() { @exit 100 ", ) - .stderr(r#"Error: Extraneous attribute + .stderr( + r#"Error: Extraneous attribute ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ -"#) +"#, + ) .failure(); } @@ -239,11 +247,13 @@ fn exit_message_and_no_exit_message_compile_forbidden() { bar: ", ) - .stderr(r#"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes + .stderr( + r#"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes ╭─[ justfile:2:1 ] │ 2 │ bar: ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/options.rs b/tests/options.rs index 4c36c8eb35..9d399a02a7 100644 --- a/tests/options.rs +++ b/tests/options.rs @@ -10,12 +10,14 @@ fn long_options_may_not_be_empty() { echo bar={{bar}} ", ) - .stderr(r#"Error: Option name for parameter `bar` is empty + .stderr( + r#"Error: Option name for parameter `bar` is empty ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='')] ───╯ -"#) +"#, + ) .failure(); } @@ -29,12 +31,14 @@ fn short_options_may_not_be_empty() { echo bar={{bar}} ", ) - .stderr(r#"Error: Option name for parameter `bar` is empty + .stderr( + r#"Error: Option name for parameter `bar` is empty ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='')] ───╯ -"#) +"#, + ) .failure(); } @@ -48,12 +52,14 @@ fn short_options_may_not_have_multiple_characters() { echo bar={{bar}} ", ) - .stderr(r#"Error: Short option name for parameter `bar` contains multiple characters + .stderr( + r#"Error: Short option name for parameter `bar` contains multiple characters ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='abc')] ───╯ -"#) +"#, + ) .failure(); } @@ -160,12 +166,14 @@ fn duplicate_long_option_attributes_are_forbidden() { foo bar baz: ", ) - .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times + .stderr( + r#"Error: Recipe `foo` defines option `--bar` multiple times ╭─[ justfile:2:18 ] │ 2 │ [arg('baz', long='bar')] ───╯ -"#) +"#, + ) .failure(); } @@ -182,12 +190,14 @@ fn defaulted_duplicate_long_option() { foo aaa bar: ", ) - .stderr(r#"Error: Recipe `foo` defines option `--bar` multiple times + .stderr( + r#"Error: Recipe `foo` defines option `--bar` multiple times ╭─[ justfile:5:19 ] │ 5 │ [arg( 'bar', long)] ───╯ -"#) +"#, + ) .failure(); } @@ -201,12 +211,14 @@ fn duplicate_short_option_attributes_are_forbidden() { foo bar baz: ", ) - .stderr(r#"Error: Recipe `foo` defines option `-b` multiple times + .stderr( + r#"Error: Recipe `foo` defines option `-b` multiple times ╭─[ justfile:2:19 ] │ 2 │ [arg('baz', short='b')] ───╯ -"#) +"#, + ) .failure(); } @@ -219,12 +231,14 @@ fn variadics_with_long_options_are_forbidden() { foo +bar: ", ) - .stderr(r#"Error: Variadic parameters may not be options + .stderr( + r#"Error: Variadic parameters may not be options ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ -"#) +"#, + ) .failure(); } @@ -237,12 +251,14 @@ fn variadics_with_short_options_are_forbidden() { foo +bar: ", ) - .stderr(r#"Error: Variadic parameters may not be options + .stderr( + r#"Error: Variadic parameters may not be options ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ -"#) +"#, + ) .failure(); } @@ -255,12 +271,14 @@ fn long_option_names_may_not_contain_equal_sign() { foo bar: ", ) - .stderr(r#"Error: Option name for parameter `bar` contains equal sign + .stderr( + r#"Error: Option name for parameter `bar` contains equal sign ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='bar=baz')] ───╯ -"#) +"#, + ) .failure(); } @@ -273,12 +291,14 @@ fn short_option_names_may_not_contain_equal_sign() { foo bar: ", ) - .stderr(r#"Error: Option name for parameter `bar` contains equal sign + .stderr( + r#"Error: Option name for parameter `bar` contains equal sign ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='=')] ───╯ -"#) +"#, + ) .failure(); } @@ -639,12 +659,14 @@ fn value_requires_long_or_short() { ", ) .args(["foo", "-b=hello"]) - .stderr(r#"Error: Argument attribute `value` only valid with `long` or `short` + .stderr( + r#"Error: Argument attribute `value` only valid with `long` or `short` ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', value='baz')] ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/parameters.rs b/tests/parameters.rs index 51b6731402..d86f80cb51 100644 --- a/tests/parameters.rs +++ b/tests/parameters.rs @@ -24,12 +24,14 @@ fn parameter_default_values_may_not_use_later_parameters() { ", ) .args(["foo", "bar"]) - .stderr(r#"Error: Variable `c` not defined + .stderr( + r#"Error: Variable `c` not defined ╭─[ justfile:1:10 ] │ 1 │ @foo a b=c c='': ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/parser.rs b/tests/parser.rs index 35cb11df37..be36a3d280 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -20,12 +20,14 @@ fn invalid_bang_operator() { x := if '' !! '' { '' } else { '' } ", ) - .stderr(r#"Error: Expected character `=` or `~` + .stderr( + r#"Error: Expected character `=` or `~` ╭─[ justfile:1:13 ] │ 1 │ x := if '' !! '' { '' } else { '' } ───╯ -"#) +"#, + ) .failure(); } @@ -33,11 +35,13 @@ fn invalid_bang_operator() { fn truncated_bang_operator() { Test::new() .justfile("x := if '' !") - .stderr(r#"Error: Expected character `=` or `~` but found end-of-file + .stderr( + r#"Error: Expected character `=` or `~` but found end-of-file ╭─[ justfile:1:13 ] │ 1 │ x := if '' ! ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/settings.rs b/tests/settings.rs index 3171c341cf..81ce9436a8 100644 --- a/tests/settings.rs +++ b/tests/settings.rs @@ -34,12 +34,14 @@ fn undefined_variable_in_working_directory() { set working-directory := foo ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:26 ] │ 1 │ set working-directory := foo ───╯ -"#) +"#, + ) .failure(); } @@ -51,12 +53,14 @@ fn undefined_variable_in_dotenv_filename() { set dotenv-filename := foo ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:24 ] │ 1 │ set dotenv-filename := foo ───╯ -"#) +"#, + ) .failure(); } @@ -68,12 +72,14 @@ fn undefined_variable_in_dotenv_path() { set dotenv-path := foo ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:20 ] │ 1 │ set dotenv-path := foo ───╯ -"#) +"#, + ) .failure(); } @@ -85,12 +91,14 @@ fn undefined_variable_in_tempdir() { set tempdir := foo ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:16 ] │ 1 │ set tempdir := foo ───╯ -"#) +"#, + ) .failure(); } @@ -102,12 +110,14 @@ fn undefined_variable_in_script_interpreter_command() { set script-interpreter := [foo] ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:28 ] │ 1 │ set script-interpreter := [foo] ───╯ -"#) +"#, + ) .failure(); } @@ -119,12 +129,14 @@ fn undefined_variable_in_script_interpreter_argument() { set script-interpreter := ['foo', bar] ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:1:35 ] │ 1 │ set script-interpreter := ['foo', bar] ───╯ -"#) +"#, + ) .failure(); } @@ -136,12 +148,14 @@ fn undefined_variable_in_shell_command() { set shell := [foo] ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:15 ] │ 1 │ set shell := [foo] ───╯ -"#) +"#, + ) .failure(); } @@ -153,12 +167,14 @@ fn undefined_variable_in_shell_argument() { set shell := ['foo', bar] ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:1:22 ] │ 1 │ set shell := ['foo', bar] ───╯ -"#) +"#, + ) .failure(); } @@ -170,12 +186,14 @@ fn undefined_variable_in_windows_shell_command() { set windows-shell := [foo] ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:1:23 ] │ 1 │ set windows-shell := [foo] ───╯ -"#) +"#, + ) .failure(); } @@ -187,12 +205,14 @@ fn undefined_variable_in_windows_shell_argument() { set windows-shell := ['foo', bar] ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:1:30 ] │ 1 │ set windows-shell := ['foo', bar] ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/show.rs b/tests/show.rs index fef6aca7f7..b7f876a811 100644 --- a/tests/show.rs +++ b/tests/show.rs @@ -42,12 +42,14 @@ fn alias_show_missing_target() { .arg("--show") .arg("f") .justfile("alias f := foo") - .stderr(r#"Error: Alias `f` has an unknown target `foo` + .stderr( + r#"Error: Alias `f` has an unknown target `foo` ╭─[ justfile:1:7 ] │ 1 │ alias f := foo ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/slash_operator.rs b/tests/slash_operator.rs index cd33b5c361..804cf2ac3d 100644 --- a/tests/slash_operator.rs +++ b/tests/slash_operator.rs @@ -45,12 +45,14 @@ fn no_lhs_twice() { fn no_rhs_once() { Test::new() .justfile("x := 'a' /") - .stderr(r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + .stderr( + r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file ╭─[ justfile:1:11 ] │ 1 │ x := 'a' / ───╯ -"#) +"#, + ) .failure(); } @@ -63,12 +65,14 @@ fn default_un_parenthesized() { echo {{x}} ", ) - .stderr(r#"Error: Expected '*', ':', '$', identifier, or '+', but found '/' + .stderr( + r#"Error: Expected '*', ':', '$', identifier, or '+', but found '/' ╭─[ justfile:1:11 ] │ 1 │ foo x='a' / 'b': ───╯ -"#) +"#, + ) .failure(); } @@ -81,12 +85,14 @@ fn no_lhs_un_parenthesized() { echo {{x}} ", ) - .stderr(r#"Error: Expected backtick, identifier, '(', or string, but found '/' + .stderr( + r#"Error: Expected backtick, identifier, '(', or string, but found '/' ╭─[ justfile:1:7 ] │ 1 │ foo x=/ 'a' / 'b': ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/string.rs b/tests/string.rs index 8d62561a7e..08807d41a7 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -121,12 +121,14 @@ fn invalid_escape_sequence() { r#"x := "\q" a:"#, ) - .stderr(r#"Error: `\q` is not a valid escape sequence + .stderr( + r#"Error: `\q` is not a valid escape sequence ╭─[ justfile:1:6 ] │ 1 │ x := "\q" ───╯ -"#) +"#, + ) .failure(); } @@ -144,12 +146,14 @@ a: echo '{{foo}}' ", ) - .stderr(r#"Error: Variable `foo` not defined + .stderr( + r#"Error: Variable `foo` not defined ╭─[ justfile:6:11 ] │ 6 │ echo '{{foo}}' ───╯ -"#) +"#, + ) .failure(); } @@ -167,12 +171,14 @@ a: echo '{{string}}' ", ) - .stderr(r#"Error: Variable `bar` not defined + .stderr( + r#"Error: Variable `bar` not defined ╭─[ justfile:3:13 ] │ 3 │ whatever' + bar ───╯ -"#) +"#, + ) .failure(); } @@ -215,12 +221,14 @@ a: echo {{b}} "#, ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:5:10 ] │ 5 │ echo {{b}} ───╯ -"#) +"#, + ) .failure(); } @@ -233,12 +241,14 @@ fn unterminated_raw_string() { a b= ': ", ) - .stderr(r#"Error: Unterminated string + .stderr( + r#"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= ': ───╯ -"#) +"#, + ) .failure(); } @@ -251,12 +261,14 @@ fn unterminated_string() { a b= ": "#, ) - .stderr(r#"Error: Unterminated string + .stderr( + r#"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= ": ───╯ -"#) +"#, + ) .failure(); } @@ -269,12 +281,14 @@ fn unterminated_backtick() { echo {{a}} ", ) - .stderr(r#"Error: Unterminated backtick + .stderr( + r#"Error: Unterminated backtick ╭─[ justfile:1:8 ] │ 1 │ foo a= `echo blaaaaaah: ───╯ -"#) +"#, + ) .failure(); } @@ -287,12 +301,14 @@ fn unterminated_indented_raw_string() { a b= ''': ", ) - .stderr(r#"Error: Unterminated string + .stderr( + r#"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= ''': ───╯ -"#) +"#, + ) .failure(); } @@ -305,12 +321,14 @@ fn unterminated_indented_string() { a b= """: "#, ) - .stderr(r#"Error: Unterminated string + .stderr( + r#"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= """: ───╯ -"#) +"#, + ) .failure(); } @@ -323,12 +341,14 @@ fn unterminated_indented_backtick() { echo {{a}} ", ) - .stderr(r#"Error: Unterminated backtick + .stderr( + r#"Error: Unterminated backtick ╭─[ justfile:1:8 ] │ 1 │ foo a= ```echo blaaaaaah: ───╯ -"#) +"#, + ) .failure(); } @@ -473,12 +493,14 @@ fn shebang_backtick() { x := `#!/usr/bin/env sh` ", ) - .stderr(r#"Error: Backticks may not start with `#!` + .stderr( + r#"Error: Backticks may not start with `#!` ╭─[ justfile:1:6 ] │ 1 │ x := `#!/usr/bin/env sh` ───╯ -"#) +"#, + ) .failure(); } @@ -514,12 +536,14 @@ fn unicode_escape_no_braces() { Test::new() .justfile("x := \"\\u1234\"") .args(["--evaluate", "x"]) - .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found `1` + .stderr( + r#"Error: expected unicode escape sequence delimiter `{` but found `1` ╭─[ justfile:1:6 ] │ 1 │ x := "\u1234" ───╯ -"#) +"#, + ) .failure(); } @@ -528,12 +552,14 @@ fn unicode_escape_empty() { Test::new() .justfile("x := \"\\u{}\"") .args(["--evaluate", "x"]) - .stderr(r#"Error: unicode escape sequences must not be empty + .stderr( + r#"Error: unicode escape sequences must not be empty ╭─[ justfile:1:6 ] │ 1 │ x := "\u{}" ───╯ -"#) +"#, + ) .failure(); } @@ -542,12 +568,14 @@ fn unicode_escape_requires_immediate_opening_brace() { Test::new() .justfile("x := \"\\u {1f916}\"") .args(["--evaluate", "x"]) - .stderr(r#"Error: expected unicode escape sequence delimiter `{` but found ` ` + .stderr( + r#"Error: expected unicode escape sequence delimiter `{` but found ` ` ╭─[ justfile:1:6 ] │ 1 │ x := "\u {1f916}" ───╯ -"#) +"#, + ) .failure(); } @@ -604,11 +632,13 @@ fn unicode_escape_unterminated() { Test::new() .justfile("x := \"\\u{1f917\"") .args(["--evaluate", "x"]) - .stderr(r#"Error: unterminated unicode escape sequence + .stderr( + r#"Error: unterminated unicode escape sequence ╭─[ justfile:1:6 ] │ 1 │ x := "\u{1f917" ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/subsequents.rs b/tests/subsequents.rs index ff4276fb2b..868aa91176 100644 --- a/tests/subsequents.rs +++ b/tests/subsequents.rs @@ -63,12 +63,14 @@ fn circular_dependency() { foo: && foo ", ) - .stderr(r#"Error: Recipe `foo` depends on itself + .stderr( + r#"Error: Recipe `foo` depends on itself ╭─[ justfile:1:9 ] │ 1 │ foo: && foo ───╯ -"#) +"#, + ) .failure(); } @@ -80,12 +82,14 @@ fn unknown() { foo: && bar ", ) - .stderr(r#"Error: Recipe `foo` has unknown dependency `bar` + .stderr( + r#"Error: Recipe `foo` has unknown dependency `bar` ╭─[ justfile:1:9 ] │ 1 │ foo: && bar ───╯ -"#) +"#, + ) .failure(); } @@ -99,12 +103,14 @@ fn unknown_argument() { foo: && (bar y) ", ) - .stderr(r#"Error: Variable `y` not defined + .stderr( + r#"Error: Variable `y` not defined ╭─[ justfile:3:14 ] │ 3 │ foo: && (bar y) ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/test.rs b/tests/test.rs index e416515798..3d57e3cfe7 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,7 +1,4 @@ -use { - super::*, - pretty_assertions::assert_eq, -}; +use {super::*, pretty_assertions::assert_eq}; pub(crate) struct Output { pub(crate) pid: u32, @@ -219,7 +216,10 @@ impl Test { let equal = have == want; if !equal { //eprintln!("Bad {name}: {}", StrComparison::new(&have, &want)); - eprintln!("Bad {name}:\n{}||\n-------------\n{}||\n=========", &have, &want); + eprintln!( + "Bad {name}:\n{}||\n-------------\n{}||\n=========", + &have, &want + ); } equal } diff --git a/tests/undefined_variables.rs b/tests/undefined_variables.rs index 2f8ba5c6a3..fe16c6e746 100644 --- a/tests/undefined_variables.rs +++ b/tests/undefined_variables.rs @@ -4,12 +4,14 @@ use super::*; fn parameter_default_unknown_variable_in_expression() { Test::new() .justfile("foo a=(b+''):") - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:8 ] │ 1 │ foo a=(b+''): ───╯ -"#) +"#, + ) .failure(); } @@ -21,12 +23,14 @@ fn unknown_variable_in_unary_call() { foo x=env_var(a): ", ) - .stderr(r#"Error: Variable `a` not defined + .stderr( + r#"Error: Variable `a` not defined ╭─[ justfile:1:15 ] │ 1 │ foo x=env_var(a): ───╯ -"#) +"#, + ) .failure(); } @@ -38,12 +42,14 @@ fn unknown_first_variable_in_binary_call() { foo x=env_var_or_default(a, b): ", ) - .stderr(r#"Error: Variable `a` not defined + .stderr( + r#"Error: Variable `a` not defined ╭─[ justfile:1:26 ] │ 1 │ foo x=env_var_or_default(a, b): ───╯ -"#) +"#, + ) .failure(); } @@ -55,12 +61,14 @@ fn unknown_second_variable_in_binary_call() { foo x=env_var_or_default('', b): ", ) - .stderr(r#"Error: Variable `b` not defined + .stderr( + r#"Error: Variable `b` not defined ╭─[ justfile:1:30 ] │ 1 │ foo x=env_var_or_default('', b): ───╯ -"#) +"#, + ) .failure(); } @@ -72,11 +80,13 @@ fn unknown_variable_in_ternary_call() { foo x=replace(a, b, c): ", ) - .stderr(r#"Error: Variable `a` not defined + .stderr( + r#"Error: Variable `a` not defined ╭─[ justfile:1:15 ] │ 1 │ foo x=replace(a, b, c): ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/unexport.rs b/tests/unexport.rs index 1ed48ed9c4..79ba8233a9 100644 --- a/tests/unexport.rs +++ b/tests/unexport.rs @@ -47,12 +47,14 @@ fn duplicate_unexport_fails() { ", ) .env("JUST_TEST_VARIABLE", "foo") - .stderr(r#"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times + .stderr( + r#"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times ╭─[ justfile:6:10 ] │ 6 │ unexport JUST_TEST_VARIABLE ───╯ -"#) +"#, + ) .failure(); } @@ -69,12 +71,14 @@ fn export_unexport_conflict() { export JUST_TEST_VARIABLE := 'foo' ", ) - .stderr(r#"Error: Variable JUST_TEST_VARIABLE is both exported and unexported + .stderr( + r#"Error: Variable JUST_TEST_VARIABLE is both exported and unexported ╭─[ justfile:6:8 ] │ 6 │ export JUST_TEST_VARIABLE := 'foo' ───╯ -"#) +"#, + ) .failure(); } diff --git a/tests/working_directory.rs b/tests/working_directory.rs index f7ded0e7a5..43030057b1 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -342,7 +342,8 @@ fn attribute_duplicate() { foo: ", ) - .stderr(r#"Error: Duplicate attribute `working-directory` + .stderr( + r#"Error: Duplicate attribute `working-directory` ╭─[ justfile:2:2 ] │ 1 │ [working-directory('bar')] @@ -352,7 +353,8 @@ fn attribute_duplicate() { │ ────────┬──────── │ ╰────────── duplicate ───╯ -"#) +"#, + ) .failure(); } @@ -388,7 +390,7 @@ Error: Recipe `bar` has both `[no-cd]` and `[working-directory]` attributes │ 3 │ bar: ───╯ -" +", ) .failure(); } From 616be6996a670f75a9a69fcfa6e839df38883a87 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 04:13:43 -0800 Subject: [PATCH 08/14] Use human-readable note when attribute takes unbounded arguments When the max argument count is usize::MAX (representing no upper bound), display "takes at least N argument(s)" instead of the literal "takes between N and 18446744073709551615 arguments". Co-Authored-By: Claude Sonnet 4.6 --- src/compile_error.rs | 5 +++++ tests/attributes.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compile_error.rs b/src/compile_error.rs index 6cbd31e932..abae2f9341 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -52,6 +52,11 @@ pub(crate) fn render_compile_error(error: &CompileError, color: Color) { let note = if min == max { format!("`{attribute}` takes {min} {}", Count("argument", *min)) + } else if *max == usize::MAX { + format!( + "`{attribute}` takes at least {min} {}", + Count("argument", *min) + ) } else { format!("`{attribute}` takes between {min} and {max} arguments") }; diff --git a/tests/attributes.rs b/tests/attributes.rs index 714984bead..fca84e8db1 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -185,7 +185,7 @@ fn expected_metadata_attribute_argument() { │ ────┬─── │ ╰───── Found 0 arguments │ - │ Note: `metadata` takes between 1 and 18446744073709551615 arguments + │ Note: `metadata` takes at least 1 argument ───╯ "#, ) From 9274091fc909a4229b233040942b1a451b7e15e4 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 04:17:02 -0800 Subject: [PATCH 09/14] clippy --- tests/alias.rs | 4 +- tests/allow_missing.rs | 4 +- tests/arg_attribute.rs | 32 ++++---- tests/assignment.rs | 12 +-- tests/attributes.rs | 40 +++++----- tests/byte_order_mark.rs | 8 +- tests/conditional.rs | 28 +++---- tests/default.rs | 4 +- tests/delimiters.rs | 8 +- tests/dependencies.rs | 12 +-- tests/error_messages.rs | 20 ++--- tests/fallback.rs | 4 +- tests/format_string.rs | 8 +- tests/functions.rs | 12 +-- tests/ignore_comments.rs | 4 +- tests/imports.rs | 4 +- tests/interpolation.rs | 4 +- tests/misc.rs | 150 +++++++++++++++++------------------ tests/modules.rs | 20 ++--- tests/newline_escape.rs | 8 +- tests/no_exit_message.rs | 20 ++--- tests/options.rs | 44 +++++----- tests/parameters.rs | 4 +- tests/parser.rs | 8 +- tests/recursion_limit.rs | 4 +- tests/settings.rs | 40 +++++----- tests/shell_expansion.rs | 8 +- tests/show.rs | 4 +- tests/slash_operator.rs | 12 +-- tests/string.rs | 32 ++++---- tests/subsequents.rs | 12 +-- tests/undefined_variables.rs | 20 ++--- tests/unexport.rs | 8 +- tests/working_directory.rs | 4 +- 34 files changed, 303 insertions(+), 303 deletions(-) diff --git a/tests/alias.rs b/tests/alias.rs index d645d95f44..05b1ae429c 100644 --- a/tests/alias.rs +++ b/tests/alias.rs @@ -33,12 +33,12 @@ fn unknown_nested_alias() { ) .arg("b") .stderr( - r#"Error: Alias `b` has an unknown target `foo::bar::baz` + r"Error: Alias `b` has an unknown target `foo::bar::baz` ╭─[ justfile:3:7 ] │ 3 │ alias b := foo::bar::baz ───╯ -"#, +", ) .failure(); } diff --git a/tests/allow_missing.rs b/tests/allow_missing.rs index 70d98f26c4..1bd151b688 100644 --- a/tests/allow_missing.rs +++ b/tests/allow_missing.rs @@ -26,12 +26,12 @@ fn allow_missing_does_not_apply_to_compilation_errors() { .justfile("bar: foo") .args(["--allow-missing", "foo"]) .stderr( - r#"Error: Recipe `bar` has unknown dependency `foo` + r"Error: Recipe `bar` has unknown dependency `foo` ╭─[ justfile:1:6 ] │ 1 │ bar: foo ───╯ -"#, +", ) .failure(); } diff --git a/tests/arg_attribute.rs b/tests/arg_attribute.rs index 3b5b93e25b..f024c1b095 100644 --- a/tests/arg_attribute.rs +++ b/tests/arg_attribute.rs @@ -77,12 +77,12 @@ fn pattern_invalid_regex_error() { ", ) .stderr( - r#"Error: Failed to parse argument pattern + r"Error: Failed to parse argument pattern ╭─[ justfile:1:21 ] │ 1 │ [arg('bar', pattern='{')] ───╯ -"#, +", ) .failure(); } @@ -118,12 +118,12 @@ fn duplicate_attribute_error() { ) .args(["foo", "BAR"]) .stderr( - r#"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 + r"Error: Recipe attribute for argument `bar` first used on line 1 is duplicated on line 2 ╭─[ justfile:2:2 ] │ 2 │ [arg('bar', pattern='BAR')] ───╯ -"#, +", ) .failure(); } @@ -139,12 +139,12 @@ fn extra_keyword_error() { ) .args(["foo", "BAR"]) .stderr( - r#"Error: Unknown keyword `foo` for `arg` attribute + r"Error: Unknown keyword `foo` for `arg` attribute ╭─[ justfile:1:28 ] │ 1 │ [arg('bar', pattern='BAR', foo='foo')] ───╯ -"#, +", ) .failure(); } @@ -160,12 +160,12 @@ fn unknown_argument_error() { ) .arg("foo") .stderr( - r#"Error: Argument attribute for undefined argument `bar` + r"Error: Argument attribute for undefined argument `bar` ╭─[ justfile:1:6 ] │ 1 │ [arg('bar', pattern='BAR')] ───╯ -"#, +", ) .failure(); } @@ -213,12 +213,12 @@ fn positional_arguments_cannot_follow_keyword_arguments() { ) .args(["foo", "BAR"]) .stderr( - r#"Error: Positional attribute arguments cannot follow keyword attribute arguments + r"Error: Positional attribute arguments cannot follow keyword attribute arguments ╭─[ justfile:1:21 ] │ 1 │ [arg(pattern='BAR', 'bar')] ───╯ -"#, +", ) .failure(); } @@ -343,12 +343,12 @@ fn pattern_requires_value() { ", ) .stderr( - r#"Error: Attribute key `pattern` requires value + r"Error: Attribute key `pattern` requires value ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', pattern)] ───╯ -"#, +", ) .failure(); } @@ -363,12 +363,12 @@ fn short_requires_value() { ", ) .stderr( - r#"Error: Attribute key `short` requires value + r"Error: Attribute key `short` requires value ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', short)] ───╯ -"#, +", ) .failure(); } @@ -383,12 +383,12 @@ fn value_requires_value() { ", ) .stderr( - r#"Error: Attribute key `value` requires value + r"Error: Attribute key `value` requires value ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', long, value)] ───╯ -"#, +", ) .failure(); } diff --git a/tests/assignment.rs b/tests/assignment.rs index e221b3b0fa..2c3bec9215 100644 --- a/tests/assignment.rs +++ b/tests/assignment.rs @@ -9,12 +9,12 @@ fn set_export_parse_error() { ", ) .stderr( - r#"Error: Expected keyword `true` or `false` but found identifier `fals` + r"Error: Expected keyword `true` or `false` but found identifier `fals` ╭─[ justfile:1:15 ] │ 1 │ set export := fals ───╯ -"#, +", ) .failure(); } @@ -28,12 +28,12 @@ fn set_export_parse_error_eol() { ", ) .stderr( - r#"Error: Expected identifier, but found end of line + r"Error: Expected identifier, but found end of line ╭─[ justfile:1:14 ] │ 1 │ set export := ───╯ -"#, +", ) .failure(); } @@ -49,12 +49,12 @@ fn invalid_attributes_are_an_error() { ) .args(["--evaluate", "x"]) .stderr( - r#"Error: Assignment `x` has invalid attribute `group` + r"Error: Assignment `x` has invalid attribute `group` ╭─[ justfile:2:1 ] │ 2 │ x := 'foo' ───╯ -"#, +", ) .failure(); } diff --git a/tests/attributes.rs b/tests/attributes.rs index fca84e8db1..0fe62fbec9 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -31,7 +31,7 @@ fn duplicate_attributes_are_disallowed() { ", ) .stderr( - r#"Error: Duplicate attribute `no-exit-message` + r"Error: Duplicate attribute `no-exit-message` ╭─[ justfile:2:2 ] │ 1 │ [no-exit-message] @@ -41,7 +41,7 @@ fn duplicate_attributes_are_disallowed() { │ ───────┬─────── │ ╰───────── duplicate ───╯ -"#, +", ) .failure(); } @@ -73,12 +73,12 @@ fn multiple_attributes_one_line_error_message() { ", ) .stderr( - r#"Error: Expected ']', ':', ',', or '(', but found identifier + r"Error: Expected ']', ':', ',', or '(', but found identifier ╭─[ justfile:1:16 ] │ 1 │ [macos,windows linux,openbsd] ───╯ -"#, +", ) .failure(); } @@ -95,7 +95,7 @@ fn multiple_attributes_one_line_duplicate_check() { ", ) .stderr( - r#"Error: Duplicate attribute `linux` + r"Error: Duplicate attribute `linux` ╭─[ justfile:2:2 ] │ 1 │ [macos, windows, linux, openbsd] @@ -105,7 +105,7 @@ fn multiple_attributes_one_line_duplicate_check() { │ ──┬── │ ╰──── duplicate ───╯ -"#, +", ) .failure(); } @@ -121,7 +121,7 @@ fn unexpected_attribute_argument() { ", ) .stderr( - r#"Error: Attribute argument count mismatch + r"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [private('foo')] @@ -130,7 +130,7 @@ fn unexpected_attribute_argument() { │ │ Note: `private` takes 0 arguments ───╯ -"#, +", ) .failure(); } @@ -178,7 +178,7 @@ fn expected_metadata_attribute_argument() { ", ) .stderr( - r#"Error: Attribute argument count mismatch + r"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [metadata] @@ -187,7 +187,7 @@ fn expected_metadata_attribute_argument() { │ │ Note: `metadata` takes at least 1 argument ───╯ -"#, +", ) .failure(); } @@ -281,12 +281,12 @@ fn extension_on_linewise_error() { ", ) .stderr( - r#"Error: Recipe `baz` has invalid attribute `extension` + r"Error: Recipe `baz` has invalid attribute `extension` ╭─[ justfile:2:1 ] │ 2 │ baz: ───╯ -"#, +", ) .failure(); } @@ -302,7 +302,7 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { ", ) .stderr( - r#"Error: Duplicate attribute `confirm` + r"Error: Duplicate attribute `confirm` ╭─[ justfile:2:2 ] │ 1 │ [confirm: 'yes'] @@ -312,7 +312,7 @@ fn duplicate_non_repeatable_attributes_are_forbidden() { │ ───┬─── │ ╰───── duplicate ───╯ -"#, +", ) .failure(); } @@ -408,7 +408,7 @@ fn env_attribute_too_few_arguments() { ", ) .stderr( - r#"Error: Attribute argument count mismatch + r"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [env('MY_VAR')] @@ -417,7 +417,7 @@ fn env_attribute_too_few_arguments() { │ │ Note: `env` takes 2 arguments ───╯ -"#, +", ) .failure(); } @@ -433,7 +433,7 @@ fn env_attribute_too_many_arguments() { ", ) .stderr( - r#"Error: Attribute argument count mismatch + r"Error: Attribute argument count mismatch ╭─[ justfile:1:2 ] │ 1 │ [env('A', 'B', 'C')] @@ -442,7 +442,7 @@ fn env_attribute_too_many_arguments() { │ │ Note: `env` takes 2 arguments ───╯ -"#, +", ) .failure(); } @@ -459,12 +459,12 @@ fn env_attribute_duplicate_error() { ", ) .stderr( - r#"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 + r"Error: Environment variable `VAR1` first set on line 1 is set again on line 2 ╭─[ justfile:2:2 ] │ 2 │ [env('VAR1', 'value 2')] ───╯ -"#, +", ) .failure(); } diff --git a/tests/byte_order_mark.rs b/tests/byte_order_mark.rs index 859e913e23..1077ffdaaa 100644 --- a/tests/byte_order_mark.rs +++ b/tests/byte_order_mark.rs @@ -24,12 +24,12 @@ fn non_leading_byte_order_mark_produces_error() { \u{feff} ", ) - .stderr(r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found byte order mark + .stderr(r"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found byte order mark ╭─[ justfile:3:1 ] │ │ ───╯ -"#) +") .failure(); } @@ -38,12 +38,12 @@ fn dont_mention_byte_order_mark_in_errors() { Test::new() .justfile("{") .stderr( - r#"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' + r"Error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{' ╭─[ justfile:1:1 ] │ 1 │ { ───╯ -"#, +", ) .failure(); } diff --git a/tests/conditional.rs b/tests/conditional.rs index 28a2a7a10b..ff2a833df4 100644 --- a/tests/conditional.rs +++ b/tests/conditional.rs @@ -82,12 +82,12 @@ fn undefined_lhs() { ", ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:9 ] │ 1 │ a := if b == '' { '' } else { '' } ───╯ -"#, +", ) .failure(); } @@ -104,12 +104,12 @@ fn undefined_rhs() { ", ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:15 ] │ 1 │ a := if '' == b { '' } else { '' } ───╯ -"#, +", ) .failure(); } @@ -126,12 +126,12 @@ fn undefined_then() { ", ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:20 ] │ 1 │ a := if '' == '' { b } else { '' } ───╯ -"#, +", ) .failure(); } @@ -148,12 +148,12 @@ fn undefined_otherwise() { ", ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:32 ] │ 1 │ a := if '' == '' { '' } else { b } ───╯ -"#, +", ) .failure(); } @@ -170,12 +170,12 @@ fn unexpected_op() { ", ) .stderr( - r#"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier + r"Error: Expected '&&', '!=', '!~', '||', '==', '=~', '+', or '/', but found identifier ╭─[ justfile:1:12 ] │ 1 │ a := if '' a '' { '' } else { b } ───╯ -"#, +", ) .failure(); } @@ -228,12 +228,12 @@ fn missing_else() { ", ) .stderr( - r#"Error: Expected keyword `else` but found `end of line` + r"Error: Expected keyword `else` but found `end of line` ╭─[ justfile:1:54 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} ───╯ -"#, +", ) .failure(); } @@ -247,12 +247,12 @@ fn incorrect_else_identifier() { ", ) .stderr( - r#"Error: Expected keyword `else` but found identifier `els` + r"Error: Expected keyword `else` but found identifier `els` ╭─[ justfile:1:55 ] │ 1 │ TEST := if path_exists('/bin/bash') == 'true' {'yes'} els {'no'} ───╯ -"#, +", ) .failure(); } diff --git a/tests/default.rs b/tests/default.rs index bab9e0ec08..dfcab5f16c 100644 --- a/tests/default.rs +++ b/tests/default.rs @@ -29,11 +29,11 @@ fn default_attribute_may_only_appear_once_per_justfile() { bar: ", ) - .stderr(r#"Error: Recipe `foo` has duplicate `[default]` attribute, which may only appear once per module + .stderr(r"Error: Recipe `foo` has duplicate `[default]` attribute, which may only appear once per module ╭─[ justfile:2:1 ] │ 2 │ foo: ───╯ -"#) +") .failure(); } diff --git a/tests/delimiters.rs b/tests/delimiters.rs index 01c3b2e4b6..384f4bd633 100644 --- a/tests/delimiters.rs +++ b/tests/delimiters.rs @@ -5,12 +5,12 @@ fn mismatched_delimiter() { Test::new() .justfile("(]") .stderr( - r#"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) + r"Error: Mismatched closing delimiter `]`. (Did you mean to close the `(` on line 1?) ╭─[ justfile:1:2 ] │ 1 │ (] ───╯ -"#, +", ) .failure(); } @@ -20,12 +20,12 @@ fn unexpected_delimiter() { Test::new() .justfile("]") .stderr( - r#"Error: Unexpected closing delimiter `]` + r"Error: Unexpected closing delimiter `]` ╭─[ justfile:1:1 ] │ 1 │ ] ───╯ -"#, +", ) .failure(); } diff --git a/tests/dependencies.rs b/tests/dependencies.rs index 546dea3c6e..e70476cda8 100644 --- a/tests/dependencies.rs +++ b/tests/dependencies.rs @@ -45,12 +45,12 @@ fn dependency_not_in_submodule() { ) .arg("baz") .stderr( - r#"Error: Recipe `baz` has unknown dependency `foo::baz` + r"Error: Recipe `baz` has unknown dependency `foo::baz` ╭─[ justfile:2:11 ] │ 2 │ baz: foo::baz ───╯ -"#, +", ) .failure(); } @@ -69,12 +69,12 @@ fn dependency_submodule_missing() { ) .arg("baz") .stderr( - r#"Error: Recipe `baz` has unknown dependency `foo::bar` + r"Error: Recipe `baz` has unknown dependency `foo::bar` ╭─[ justfile:5:11 ] │ 5 │ baz: foo::bar ───╯ -"#, +", ) .failure(); } @@ -92,12 +92,12 @@ fn recipe_dependency_on_module_fails() { ) .arg("baz") .stderr( - r#"Error: Recipe `baz` has unknown dependency `foo::bar` + r"Error: Recipe `baz` has unknown dependency `foo::bar` ╭─[ justfile:2:11 ] │ 2 │ baz: foo::bar ───╯ -"#, +", ) .failure(); } diff --git a/tests/error_messages.rs b/tests/error_messages.rs index bd90094470..b760c90342 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -5,12 +5,12 @@ fn invalid_alias_attribute() { Test::new() .justfile("[private]\n[linux]\nalias t := test\n\ntest:\n") .stderr( - r#"Error: Alias `t` has invalid attribute `linux` + r"Error: Alias `t` has invalid attribute `linux` ╭─[ justfile:3:7 ] │ 3 │ alias t := test ───╯ -"#, +", ) .failure(); } @@ -20,12 +20,12 @@ fn expected_keyword() { Test::new() .justfile("foo := if '' == '' { '' } arlo { '' }") .stderr( - r#"Error: Expected keyword `else` but found identifier `arlo` + r"Error: Expected keyword `else` but found identifier `arlo` ╭─[ justfile:1:27 ] │ 1 │ foo := if '' == '' { '' } arlo { '' } ───╯ -"#, +", ) .failure(); } @@ -35,12 +35,12 @@ fn unexpected_character() { Test::new() .justfile("&~") .stderr( - r#"Error: Expected character `&` + r"Error: Expected character `&` ╭─[ justfile:1:2 ] │ 1 │ &~ ───╯ -"#, +", ) .failure(); } @@ -65,12 +65,12 @@ 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") .stderr( - r#"Error: Expected '*', ':', '$', identifier, or '+', but found end of file + r"Error: Expected '*', ':', '$', identifier, or '+', but found end of file ╭─[ justfile:20:4 ] │ 20 │ foo ────╯ -"#, +", ) .failure(); } @@ -118,12 +118,12 @@ fn redefinition_errors_properly_swap_types() { .write("foo.just", "foo:") .justfile("foo:\n echo foo\n\nmod foo 'foo.just'") .stderr( - r#"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 + r"Error: Recipe `foo` defined on line 1 is redefined as a module on line 4 ╭─[ justfile:4:5 ] │ 4 │ mod foo 'foo.just' ───╯ -"#, +", ) .failure(); } diff --git a/tests/fallback.rs b/tests/fallback.rs index 67bf1d932c..519a47ae26 100644 --- a/tests/fallback.rs +++ b/tests/fallback.rs @@ -144,12 +144,12 @@ fn print_error_from_parent_if_recipe_not_found_in_current() { .args(["foo"]) .current_dir("bar") .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:2:9 ] │ 2 │ echo {{bar}} ───╯ -"#, +", ) .failure(); } diff --git a/tests/format_string.rs b/tests/format_string.rs index c6e7359e30..973bf2a339 100644 --- a/tests/format_string.rs +++ b/tests/format_string.rs @@ -148,12 +148,12 @@ fn unclosed() { Test::new() .justfile("foo := f'FOO{{") .stderr( - r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + r"Error: Expected backtick, identifier, '(', '/', or string, but found end of file ╭─[ justfile:1:15 ] │ 1 │ foo := f'FOO{{ ───╯ -"#, +", ) .failure(); } @@ -339,12 +339,12 @@ fn undefined_variable_error() { ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:1:12 ] │ 1 │ foo := f'{{bar}}' ───╯ -"#, +", ) .failure(); } diff --git a/tests/functions.rs b/tests/functions.rs index 0aa517e189..2553d7e84a 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -771,12 +771,12 @@ fn join_argument_count_error() { .justfile("x := join('a')") .args(["--evaluate"]) .stderr( - r#"Error: Function `join` called with 1 argument but takes 2 or more + r"Error: Function `join` called with 1 argument but takes 2 or more ╭─[ justfile:1:6 ] │ 1 │ x := join('a') ───╯ -"#, +", ) .failure(); } @@ -992,12 +992,12 @@ fn shell_no_argument() { .justfile("var := shell()") .args(["--evaluate"]) .stderr( - r#"Error: Function `shell` called with 0 arguments but takes 1 or more + r"Error: Function `shell` called with 0 arguments but takes 1 or more ╭─[ justfile:1:8 ] │ 1 │ var := shell() ───╯ -"#, +", ) .failure(); } @@ -1276,12 +1276,12 @@ fn unary_argument_count_mismamatch_error_message() { .justfile("x := datetime()") .args(["--evaluate"]) .stderr( - r#"Error: Function `datetime` called with 0 arguments but takes 1 + r"Error: Function `datetime` called with 0 arguments but takes 1 ╭─[ justfile:1:6 ] │ 1 │ x := datetime() ───╯ -"#, +", ) .failure(); } diff --git a/tests/ignore_comments.rs b/tests/ignore_comments.rs index 162ce20cce..8a81907c90 100644 --- a/tests/ignore_comments.rs +++ b/tests/ignore_comments.rs @@ -123,12 +123,12 @@ fn comments_still_must_be_parsable_when_ignored() { ", ) .stderr( - r#"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier + r"Error: Expected '&&', '||', '}}', '(', '+', or '/', but found identifier ╭─[ justfile:4:12 ] │ 4 │ # {{ foo bar }} ───╯ -"#, +", ) .failure(); } diff --git a/tests/imports.rs b/tests/imports.rs index 804605faf5..dcaed69aff 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -149,12 +149,12 @@ fn include_error() { Test::new() .justfile("!include foo") .stderr( - r#"Error: The `!include` directive has been stabilized as `import` + r"Error: The `!include` directive has been stabilized as `import` ╭─[ justfile:1:1 ] │ 1 │ !include foo ───╯ -"#, +", ) .failure(); } diff --git a/tests/interpolation.rs b/tests/interpolation.rs index d23c565482..246c6e5d6a 100644 --- a/tests/interpolation.rs +++ b/tests/interpolation.rs @@ -58,12 +58,12 @@ fn comment_in_interopolation() { ", ) .stderr( - r#"Error: Expected backtick, identifier, '(', '/', or string, but found comment + r"Error: Expected backtick, identifier, '(', '/', or string, but found comment ╭─[ justfile:2:11 ] │ 2 │ echo {{ # hello ───╯ -"#, +", ) .failure(); } diff --git a/tests/misc.rs b/tests/misc.rs index dcecc4c4c3..d7ddd35443 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -115,12 +115,12 @@ fn bad_setting() { ", ) .stderr( - r#"Error: Unknown setting `foo` + r"Error: Unknown setting `foo` ╭─[ justfile:1:5 ] │ 1 │ set foo ───╯ -"#, +", ) .failure(); } @@ -134,12 +134,12 @@ fn bad_setting_with_keyword_name() { ", ) .stderr( - r#"Error: Unknown setting `if` + r"Error: Unknown setting `if` ╭─[ justfile:1:5 ] │ 1 │ set if := 'foo' ───╯ -"#, +", ) .failure(); } @@ -159,12 +159,12 @@ fn duplicate_alias() { Test::new() .justfile("alias foo := bar\nalias foo := baz\n") .stderr( - r#"Error: Alias `foo` first defined on line 1 is redefined on line 2 + r"Error: Alias `foo` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:7 ] │ 2 │ alias foo := baz ───╯ -"#, +", ) .failure(); } @@ -174,12 +174,12 @@ fn unknown_alias_target() { Test::new() .justfile("alias foo := bar\n") .stderr( - r#"Error: Alias `foo` has an unknown target `bar` + r"Error: Alias `foo` has an unknown target `bar` ╭─[ justfile:1:7 ] │ 1 │ alias foo := bar ───╯ -"#, +", ) .failure(); } @@ -189,12 +189,12 @@ fn alias_shadows_recipe() { Test::new() .justfile("bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo") .stderr( - r#"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 + r"Error: Alias `foo` defined on line 3 is redefined as a recipe on line 4 ╭─[ justfile:4:1 ] │ 4 │ foo: ───╯ -"#, +", ) .failure(); } @@ -297,12 +297,12 @@ fn unknown_dependency() { Test::new() .justfile("bar:\nhello:\nfoo: bar baaaaaaaz hello") .stderr( - r#"Error: Recipe `foo` has unknown dependency `baaaaaaaz` + r"Error: Recipe `foo` has unknown dependency `baaaaaaaz` ╭─[ justfile:3:10 ] │ 3 │ foo: bar baaaaaaaz hello ───╯ -"#, +", ) .failure(); } @@ -730,12 +730,12 @@ fn line_error_spacing() { ", ) .stderr( - r#"Error: Unknown start of token '^' + r"Error: Unknown start of token '^' ╭─[ justfile:10:1 ] │ 10 │ ^^^ ────╯ -"#, +", ) .failure(); } @@ -946,13 +946,13 @@ fn mixed_whitespace() { Test::new() .justfile("bar:\n\t echo hello") .stderr( - r#"Error: Found a mix of tabs and spaces in leading whitespace: `␉␠` + r"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 ───╯ -"#, +", ) .failure(); } @@ -962,12 +962,12 @@ fn extra_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t\t\techo goodbye") .stderr( - r#"Error: Recipe line has extra leading whitespace + r"Error: Recipe line has extra leading whitespace ╭─[ justfile:3:3 ] │ 3 │ echo goodbye ───╯ -"#, +", ) .failure(); } @@ -976,12 +976,12 @@ fn extra_leading_whitespace() { fn inconsistent_leading_whitespace() { Test::new() .justfile("bar:\n\t\techo hello\n\t echo goodbye") - .stderr(r#"Error: Recipe line has inconsistent leading whitespace. Recipe started with `␉␉` but found line with `␉␠` + .stderr(r"Error: Recipe line has inconsistent leading whitespace. Recipe started with `␉␉` but found line with `␉␠` ╭─[ justfile:3:1 ] │ 3 │ echo goodbye ───╯ -"#) +") .failure(); } @@ -990,12 +990,12 @@ fn required_after_default() { Test::new() .justfile("bar:\nhello baz arg='foo' bar:") .stderr( - r#"Error: Non-default parameter `bar` follows default parameter + r"Error: Non-default parameter `bar` follows default parameter ╭─[ justfile:2:21 ] │ 2 │ hello baz arg='foo' bar: ───╯ -"#, +", ) .failure(); } @@ -1005,12 +1005,12 @@ fn required_after_plus_variadic() { Test::new() .justfile("bar:\nhello baz +arg bar:") .stderr( - r#"Error: Parameter `bar` follows variadic parameter + r"Error: Parameter `bar` follows variadic parameter ╭─[ justfile:2:16 ] │ 2 │ hello baz +arg bar: ───╯ -"#, +", ) .failure(); } @@ -1020,12 +1020,12 @@ fn required_after_star_variadic() { Test::new() .justfile("bar:\nhello baz *arg bar:") .stderr( - r#"Error: Parameter `bar` follows variadic parameter + r"Error: Parameter `bar` follows variadic parameter ╭─[ justfile:2:16 ] │ 2 │ hello baz *arg bar: ───╯ -"#, +", ) .failure(); } @@ -1510,12 +1510,12 @@ fn dependency_takes_arguments_exact() { ", ) .stderr( - r#"Error: Dependency `a` got 0 arguments but takes 1 argument + r"Error: Dependency `a` got 0 arguments but takes 1 argument ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ -"#, +", ) .failure(); } @@ -1531,12 +1531,12 @@ fn dependency_takes_arguments_at_least() { ", ) .stderr( - r#"Error: Dependency `a` got 0 arguments but takes at least 1 argument + r"Error: Dependency `a` got 0 arguments but takes at least 1 argument ╭─[ justfile:2:4 ] │ 2 │ b: a ───╯ -"#, +", ) .failure(); } @@ -1552,12 +1552,12 @@ fn dependency_takes_arguments_at_most() { ", ) .stderr( - r#"Error: Dependency `a` got 3 arguments but takes at most 2 arguments + r"Error: Dependency `a` got 3 arguments but takes at most 2 arguments ╭─[ justfile:2:5 ] │ 2 │ b: (a '0' '1' '2') ───╯ -"#, +", ) .failure(); } @@ -1568,12 +1568,12 @@ fn duplicate_parameter() { .arg("a") .justfile("a foo foo:") .stderr( - r#"Error: Recipe `a` has duplicate parameter `foo` + r"Error: Recipe `a` has duplicate parameter `foo` ╭─[ justfile:1:7 ] │ 1 │ a foo foo: ───╯ -"#, +", ) .failure(); } @@ -1584,12 +1584,12 @@ fn duplicate_recipe() { .arg("b") .justfile("b:\nb:") .stderr( - r#"Error: Recipe `b` first defined on line 1 is redefined on line 2 + r"Error: Recipe `b` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:1 ] │ 2 │ b: ───╯ -"#, +", ) .failure(); } @@ -1600,12 +1600,12 @@ fn duplicate_variable() { .arg("foo") .justfile("a := 'hello'\na := 'hello'\nfoo:") .stderr( - r#"Error: Variable `a` has multiple definitions + r"Error: Variable `a` has multiple definitions ╭─[ justfile:2:1 ] │ 2 │ a := 'hello' ───╯ -"#, +", ) .failure(); } @@ -1615,12 +1615,12 @@ fn unexpected_token_in_dependency_position() { Test::new() .arg("foo") .justfile("foo: 'bar'") - .stderr(r#"Error: Expected '&&', comment, end of file, end of line, identifier, or '(', but found string + .stderr(r"Error: Expected '&&', comment, end of file, end of line, identifier, or '(', but found string ╭─[ justfile:1:6 ] │ 1 │ foo: 'bar' ───╯ -"#) +") .failure(); } @@ -1630,12 +1630,12 @@ fn unexpected_token_after_name() { .arg("foo") .justfile("foo 'bar'") .stderr( - r#"Error: Expected '*', ':', '$', identifier, or '+', but found string + r"Error: Expected '*', ':', '$', identifier, or '+', but found string ╭─[ justfile:1:5 ] │ 1 │ foo 'bar' ───╯ -"#, +", ) .failure(); } @@ -1646,12 +1646,12 @@ fn self_dependency() { .arg("a") .justfile("a: a") .stderr( - r#"Error: Recipe `a` depends on itself + r"Error: Recipe `a` depends on itself ╭─[ justfile:1:4 ] │ 1 │ a: a ───╯ -"#, +", ) .failure(); } @@ -1662,12 +1662,12 @@ fn long_circular_recipe_dependency() { .arg("a") .justfile("a: b\nb: c\nc: d\nd: a") .stderr( - r#"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` + r"Error: Recipe `d` has circular dependency `a -> b -> c -> d -> a` ╭─[ justfile:4:4 ] │ 4 │ d: a ───╯ -"#, +", ) .failure(); } @@ -1678,12 +1678,12 @@ fn variable_self_dependency() { .arg("a") .justfile("z := z\na:") .stderr( - r#"Error: Variable `z` is defined in terms of itself + r"Error: Variable `z` is defined in terms of itself ╭─[ justfile:1:1 ] │ 1 │ z := z ───╯ -"#, +", ) .failure(); } @@ -1694,12 +1694,12 @@ fn variable_circular_dependency() { .arg("a") .justfile("x := y\ny := z\nz := x\na:") .stderr( - r#"Error: Variable `x` depends on its own value: `x -> y -> z -> x` + r"Error: Variable `x` depends on its own value: `x -> y -> z -> x` ╭─[ justfile:1:1 ] │ 1 │ x := y ───╯ -"#, +", ) .failure(); } @@ -1718,12 +1718,12 @@ fn variable_circular_dependency_with_additional_variable() { ", ) .stderr( - r#"Error: Variable `x` depends on its own value: `x -> y -> x` + r"Error: Variable `x` depends on its own value: `x -> y -> x` ╭─[ justfile:2:1 ] │ 2 │ x := y ───╯ -"#, +", ) .failure(); } @@ -1891,12 +1891,12 @@ foo *a +b: ", ) .stderr( - r#"Error: Expected ':' or '=', but found '+' + r"Error: Expected ':' or '=', but found '+' ╭─[ justfile:1:8 ] │ 1 │ foo *a +b: ───╯ -"#, +", ) .failure(); } @@ -1911,12 +1911,12 @@ foo +a *b: ", ) .stderr( - r#"Error: Expected ':' or '=', but found '*' + r"Error: Expected ':' or '=', but found '*' ╭─[ justfile:1:8 ] │ 1 │ foo +a *b: ───╯ -"#, +", ) .failure(); } @@ -1961,12 +1961,12 @@ a: x y ", ) .stderr( - r#"Error: Recipe `a` has unknown dependency `y` + r"Error: Recipe `a` has unknown dependency `y` ╭─[ justfile:3:6 ] │ 3 │ a: x y ───╯ -"#, +", ) .failure(); } @@ -2098,12 +2098,12 @@ fn unknown_variable_in_default() { ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:1:7 ] │ 1 │ foo x=bar: ───╯ -"#, +", ) .failure(); } @@ -2117,12 +2117,12 @@ foo x=bar(): ", ) .stderr( - r#"Error: Call to unknown function `bar` + r"Error: Call to unknown function `bar` ╭─[ justfile:1:7 ] │ 1 │ foo x=bar(): ───╯ -"#, +", ) .failure(); } @@ -2194,12 +2194,12 @@ fn unterminated_interpolation_eol() { ", ) .stderr( - r#"Error: Unterminated interpolation + r"Error: Unterminated interpolation ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ -"#, +", ) .failure(); } @@ -2214,12 +2214,12 @@ fn unterminated_interpolation_eof() { ", ) .stderr( - r#"Error: Unterminated interpolation + r"Error: Unterminated interpolation ╭─[ justfile:2:8 ] │ 2 │ echo {{ ───╯ -"#, +", ) .failure(); } @@ -2233,12 +2233,12 @@ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ", ) .stderr( - r#"Error: Unknown start of token '%' + r"Error: Unknown start of token '%' ╭─[ justfile:1:25 ] │ 1 │ assembly_source_files = %(wildcard src/arch/$(arch)/*.s) ───╯ -"#, +", ) .failure(); } @@ -2252,12 +2252,12 @@ fn unknown_start_of_token_invisible_unicode() { ", ) .stderr( - r#"Error: Unknown start of token '​' (U+200B) + r"Error: Unknown start of token '\u{200B}' (U+200B) ╭─[ justfile:1:1 ] │ - 1 │ ​foo := 'bar' + 1 │ \u{200B}foo := 'bar' ───╯ -"#, +", ) .failure(); } @@ -2271,12 +2271,12 @@ fn unknown_start_of_token_ascii_control_char() { ", ) .stderr( - r#"Error: Unknown start of token '' (U+0000) + r"Error: Unknown start of token '' (U+0000) ╭─[ justfile:1:1 ] │ 1 │ foo := 'bar' ───╯ -"#, +", ) .failure(); } @@ -2402,12 +2402,12 @@ fn old_equals_assignment_syntax_produces_error() { ", ) .stderr( - r#"Error: Expected '*', ':', '$', identifier, or '+', but found '=' + r"Error: Expected '*', ':', '$', identifier, or '+', but found '=' ╭─[ justfile:1:5 ] │ 1 │ foo = 'bar' ───╯ -"#, +", ) .failure(); } diff --git a/tests/modules.rs b/tests/modules.rs index 19e2ccbd0b..c50bf59855 100644 --- a/tests/modules.rs +++ b/tests/modules.rs @@ -204,12 +204,12 @@ foo: .arg("foo") .arg("foo") .stderr( - r#"Error: Recipe `foo` first defined on line 1 is redefined on line 2 + r"Error: Recipe `foo` first defined on line 1 is redefined on line 2 ╭─[ foo.just:2:1 ] │ 2 │ foo: ───╯ -"#, +", ) .failure(); } @@ -225,12 +225,12 @@ fn modules_conflict_with_recipes() { ", ) .stderr( - r#"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 + r"Error: Module `foo` defined on line 1 is redefined as a recipe on line 2 ╭─[ justfile:2:1 ] │ 2 │ foo: ───╯ -"#, +", ) .failure(); } @@ -247,12 +247,12 @@ fn modules_conflict_with_aliases() { ", ) .stderr( - r#"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 + r"Error: Module `foo` defined on line 1 is redefined as an alias on line 3 ╭─[ justfile:3:7 ] │ 3 │ alias foo := bar ───╯ -"#, +", ) .failure(); } @@ -270,12 +270,12 @@ fn modules_conflict_with_other_modules() { ", ) .stderr( - r#"Error: Module `foo` first defined on line 1 is redefined on line 2 + r"Error: Module `foo` first defined on line 1 is redefined on line 2 ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ -"#, +", ) .failure(); } @@ -1016,12 +1016,12 @@ fn bad_module_attribute_fails() { .test_round_trip(false) .arg("--list") .stderr( - r#"Error: Module `foo` has invalid attribute `no-cd` + r"Error: Module `foo` has invalid attribute `no-cd` ╭─[ justfile:2:5 ] │ 2 │ mod foo ───╯ -"#, +", ) .failure(); } diff --git a/tests/newline_escape.rs b/tests/newline_escape.rs index 0376b0af02..07c746de22 100644 --- a/tests/newline_escape.rs +++ b/tests/newline_escape.rs @@ -69,12 +69,12 @@ fn newline_escape_deps_invalid_esc() { ", ) .stderr( - r#"Error: `\ ` is not a valid escape sequence + r"Error: `\ ` is not a valid escape sequence ╭─[ justfile:1:11 ] │ 1 │ default: a\ b ───╯ -"#, +", ) .failure(); } @@ -87,12 +87,12 @@ fn newline_escape_unpaired_linefeed() { default:\\\ra", ) .stderr( - r#"Error: Unpaired carriage return + r"Error: Unpaired carriage return ╭─[ justfile:1:9 ] │ 1 │ default:\ ───╯ -"#, +", ) .failure(); } diff --git a/tests/no_exit_message.rs b/tests/no_exit_message.rs index 744923e8af..a1b8062d91 100644 --- a/tests/no_exit_message.rs +++ b/tests/no_exit_message.rs @@ -65,12 +65,12 @@ fn unknown_attribute() { ", ) .stderr( - r#"Error: Unknown attribute `unknown-attribute` + r"Error: Unknown attribute `unknown-attribute` ╭─[ justfile:2:2 ] │ 2 │ [unknown-attribute] ───╯ -"#, +", ) .failure(); } @@ -87,12 +87,12 @@ fn empty_attribute() { ", ) .stderr( - r#"Error: Expected identifier, but found ']' + r"Error: Expected identifier, but found ']' ╭─[ justfile:2:2 ] │ 2 │ [] ───╯ -"#, +", ) .failure(); } @@ -109,12 +109,12 @@ fn extraneous_attribute_before_comment() { ", ) .stderr( - r#"Error: Extraneous attribute + r"Error: Extraneous attribute ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ -"#, +", ) .failure(); } @@ -131,12 +131,12 @@ fn extraneous_attribute_before_empty_line() { ", ) .stderr( - r#"Error: Extraneous attribute + r"Error: Extraneous attribute ╭─[ justfile:1:1 ] │ 1 │ [no-exit-message] ───╯ -"#, +", ) .failure(); } @@ -248,12 +248,12 @@ fn exit_message_and_no_exit_message_compile_forbidden() { ", ) .stderr( - r#"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes + r"Error: Recipe `bar` has both `[exit-message]` and `[no-exit-message]` attributes ╭─[ justfile:2:1 ] │ 2 │ bar: ───╯ -"#, +", ) .failure(); } diff --git a/tests/options.rs b/tests/options.rs index 9d399a02a7..294a242ad5 100644 --- a/tests/options.rs +++ b/tests/options.rs @@ -11,12 +11,12 @@ fn long_options_may_not_be_empty() { ", ) .stderr( - r#"Error: Option name for parameter `bar` is empty + r"Error: Option name for parameter `bar` is empty ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='')] ───╯ -"#, +", ) .failure(); } @@ -32,12 +32,12 @@ fn short_options_may_not_be_empty() { ", ) .stderr( - r#"Error: Option name for parameter `bar` is empty + r"Error: Option name for parameter `bar` is empty ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='')] ───╯ -"#, +", ) .failure(); } @@ -53,12 +53,12 @@ fn short_options_may_not_have_multiple_characters() { ", ) .stderr( - r#"Error: Short option name for parameter `bar` contains multiple characters + r"Error: Short option name for parameter `bar` contains multiple characters ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='abc')] ───╯ -"#, +", ) .failure(); } @@ -167,12 +167,12 @@ fn duplicate_long_option_attributes_are_forbidden() { ", ) .stderr( - r#"Error: Recipe `foo` defines option `--bar` multiple times + r"Error: Recipe `foo` defines option `--bar` multiple times ╭─[ justfile:2:18 ] │ 2 │ [arg('baz', long='bar')] ───╯ -"#, +", ) .failure(); } @@ -191,12 +191,12 @@ fn defaulted_duplicate_long_option() { ", ) .stderr( - r#"Error: Recipe `foo` defines option `--bar` multiple times + r"Error: Recipe `foo` defines option `--bar` multiple times ╭─[ justfile:5:19 ] │ 5 │ [arg( 'bar', long)] ───╯ -"#, +", ) .failure(); } @@ -212,12 +212,12 @@ fn duplicate_short_option_attributes_are_forbidden() { ", ) .stderr( - r#"Error: Recipe `foo` defines option `-b` multiple times + r"Error: Recipe `foo` defines option `-b` multiple times ╭─[ justfile:2:19 ] │ 2 │ [arg('baz', short='b')] ───╯ -"#, +", ) .failure(); } @@ -232,12 +232,12 @@ fn variadics_with_long_options_are_forbidden() { ", ) .stderr( - r#"Error: Variadic parameters may not be options + r"Error: Variadic parameters may not be options ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ -"#, +", ) .failure(); } @@ -252,12 +252,12 @@ fn variadics_with_short_options_are_forbidden() { ", ) .stderr( - r#"Error: Variadic parameters may not be options + r"Error: Variadic parameters may not be options ╭─[ justfile:2:6 ] │ 2 │ foo +bar: ───╯ -"#, +", ) .failure(); } @@ -272,12 +272,12 @@ fn long_option_names_may_not_contain_equal_sign() { ", ) .stderr( - r#"Error: Option name for parameter `bar` contains equal sign + r"Error: Option name for parameter `bar` contains equal sign ╭─[ justfile:1:18 ] │ 1 │ [arg('bar', long='bar=baz')] ───╯ -"#, +", ) .failure(); } @@ -292,12 +292,12 @@ fn short_option_names_may_not_contain_equal_sign() { ", ) .stderr( - r#"Error: Option name for parameter `bar` contains equal sign + r"Error: Option name for parameter `bar` contains equal sign ╭─[ justfile:1:19 ] │ 1 │ [arg('bar', short='=')] ───╯ -"#, +", ) .failure(); } @@ -660,12 +660,12 @@ fn value_requires_long_or_short() { ) .args(["foo", "-b=hello"]) .stderr( - r#"Error: Argument attribute `value` only valid with `long` or `short` + r"Error: Argument attribute `value` only valid with `long` or `short` ╭─[ justfile:1:13 ] │ 1 │ [arg('bar', value='baz')] ───╯ -"#, +", ) .failure(); } diff --git a/tests/parameters.rs b/tests/parameters.rs index d86f80cb51..fc518f1a94 100644 --- a/tests/parameters.rs +++ b/tests/parameters.rs @@ -25,12 +25,12 @@ fn parameter_default_values_may_not_use_later_parameters() { ) .args(["foo", "bar"]) .stderr( - r#"Error: Variable `c` not defined + r"Error: Variable `c` not defined ╭─[ justfile:1:10 ] │ 1 │ @foo a b=c c='': ───╯ -"#, +", ) .failure(); } diff --git a/tests/parser.rs b/tests/parser.rs index be36a3d280..230464bd28 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -21,12 +21,12 @@ fn invalid_bang_operator() { ", ) .stderr( - r#"Error: Expected character `=` or `~` + r"Error: Expected character `=` or `~` ╭─[ justfile:1:13 ] │ 1 │ x := if '' !! '' { '' } else { '' } ───╯ -"#, +", ) .failure(); } @@ -36,12 +36,12 @@ fn truncated_bang_operator() { Test::new() .justfile("x := if '' !") .stderr( - r#"Error: Expected character `=` or `~` but found end-of-file + r"Error: Expected character `=` or `~` but found end-of-file ╭─[ justfile:1:13 ] │ 1 │ x := if '' ! ───╯ -"#, +", ) .failure(); } diff --git a/tests/recursion_limit.rs b/tests/recursion_limit.rs index 750fe496e8..94a2fd84c3 100644 --- a/tests/recursion_limit.rs +++ b/tests/recursion_limit.rs @@ -13,12 +13,12 @@ fn bugfix() { } #[cfg(not(windows))] -const RECURSION_LIMIT_REACHED: &str = r#"Error: Parsing recursion depth exceeded +const RECURSION_LIMIT_REACHED: &str = r"Error: Parsing recursion depth exceeded ╭─[ justfile:1:265 ] │ 1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( ───╯ -"#; +"; #[cfg(windows)] const RECURSION_LIMIT_REACHED: &str = " diff --git a/tests/settings.rs b/tests/settings.rs index 81ce9436a8..1353e76805 100644 --- a/tests/settings.rs +++ b/tests/settings.rs @@ -35,12 +35,12 @@ fn undefined_variable_in_working_directory() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:26 ] │ 1 │ set working-directory := foo ───╯ -"#, +", ) .failure(); } @@ -54,12 +54,12 @@ fn undefined_variable_in_dotenv_filename() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:24 ] │ 1 │ set dotenv-filename := foo ───╯ -"#, +", ) .failure(); } @@ -73,12 +73,12 @@ fn undefined_variable_in_dotenv_path() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:20 ] │ 1 │ set dotenv-path := foo ───╯ -"#, +", ) .failure(); } @@ -92,12 +92,12 @@ fn undefined_variable_in_tempdir() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:16 ] │ 1 │ set tempdir := foo ───╯ -"#, +", ) .failure(); } @@ -111,12 +111,12 @@ fn undefined_variable_in_script_interpreter_command() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:28 ] │ 1 │ set script-interpreter := [foo] ───╯ -"#, +", ) .failure(); } @@ -130,12 +130,12 @@ fn undefined_variable_in_script_interpreter_argument() { ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:1:35 ] │ 1 │ set script-interpreter := ['foo', bar] ───╯ -"#, +", ) .failure(); } @@ -149,12 +149,12 @@ fn undefined_variable_in_shell_command() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:15 ] │ 1 │ set shell := [foo] ───╯ -"#, +", ) .failure(); } @@ -168,12 +168,12 @@ fn undefined_variable_in_shell_argument() { ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:1:22 ] │ 1 │ set shell := ['foo', bar] ───╯ -"#, +", ) .failure(); } @@ -187,12 +187,12 @@ fn undefined_variable_in_windows_shell_command() { ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:1:23 ] │ 1 │ set windows-shell := [foo] ───╯ -"#, +", ) .failure(); } @@ -206,12 +206,12 @@ fn undefined_variable_in_windows_shell_argument() { ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:1:30 ] │ 1 │ set windows-shell := ['foo', bar] ───╯ -"#, +", ) .failure(); } diff --git a/tests/shell_expansion.rs b/tests/shell_expansion.rs index abaa1bdafa..9498dd5eff 100644 --- a/tests/shell_expansion.rs +++ b/tests/shell_expansion.rs @@ -22,12 +22,12 @@ fn shell_expanded_strings_must_not_have_whitespace() { x := x '$JUST_TEST_VARIABLE' ", ) - .stderr(r#"Error: Expected '&&', '||', comment, end of file, end of line, '(', '+', or '/', but found string + .stderr(r"Error: Expected '&&', '||', comment, end of file, end of line, '(', '+', or '/', but found string ╭─[ justfile:1:8 ] │ 1 │ x := x '$JUST_TEST_VARIABLE' ───╯ -"#) +") .failure(); } @@ -41,12 +41,12 @@ fn shell_expanded_error_messages_highlight_string_token() { ) .env("JUST_TEST_VARIABLE", "FOO") .args(["--evaluate", "x"]) - .stderr(r#"Error: Shell expansion failed: error looking key 'FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' up: environment variable not found + .stderr(r"Error: Shell expansion failed: error looking key 'FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' up: environment variable not found ╭─[ justfile:1:7 ] │ 1 │ x := x'$FOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' ───╯ -"#) +") .failure(); } diff --git a/tests/show.rs b/tests/show.rs index b7f876a811..a10981938a 100644 --- a/tests/show.rs +++ b/tests/show.rs @@ -43,12 +43,12 @@ fn alias_show_missing_target() { .arg("f") .justfile("alias f := foo") .stderr( - r#"Error: Alias `f` has an unknown target `foo` + r"Error: Alias `f` has an unknown target `foo` ╭─[ justfile:1:7 ] │ 1 │ alias f := foo ───╯ -"#, +", ) .failure(); } diff --git a/tests/slash_operator.rs b/tests/slash_operator.rs index 804cf2ac3d..408b7db732 100644 --- a/tests/slash_operator.rs +++ b/tests/slash_operator.rs @@ -46,12 +46,12 @@ fn no_rhs_once() { Test::new() .justfile("x := 'a' /") .stderr( - r#"Error: Expected backtick, identifier, '(', '/', or string, but found end of file + r"Error: Expected backtick, identifier, '(', '/', or string, but found end of file ╭─[ justfile:1:11 ] │ 1 │ x := 'a' / ───╯ -"#, +", ) .failure(); } @@ -66,12 +66,12 @@ fn default_un_parenthesized() { ", ) .stderr( - r#"Error: Expected '*', ':', '$', identifier, or '+', but found '/' + r"Error: Expected '*', ':', '$', identifier, or '+', but found '/' ╭─[ justfile:1:11 ] │ 1 │ foo x='a' / 'b': ───╯ -"#, +", ) .failure(); } @@ -86,12 +86,12 @@ fn no_lhs_un_parenthesized() { ", ) .stderr( - r#"Error: Expected backtick, identifier, '(', or string, but found '/' + r"Error: Expected backtick, identifier, '(', or string, but found '/' ╭─[ justfile:1:7 ] │ 1 │ foo x=/ 'a' / 'b': ───╯ -"#, +", ) .failure(); } diff --git a/tests/string.rs b/tests/string.rs index 08807d41a7..249d9fd55b 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -147,12 +147,12 @@ a: ", ) .stderr( - r#"Error: Variable `foo` not defined + r"Error: Variable `foo` not defined ╭─[ justfile:6:11 ] │ 6 │ echo '{{foo}}' ───╯ -"#, +", ) .failure(); } @@ -172,12 +172,12 @@ a: ", ) .stderr( - r#"Error: Variable `bar` not defined + r"Error: Variable `bar` not defined ╭─[ justfile:3:13 ] │ 3 │ whatever' + bar ───╯ -"#, +", ) .failure(); } @@ -222,12 +222,12 @@ a: "#, ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:5:10 ] │ 5 │ echo {{b}} ───╯ -"#, +", ) .failure(); } @@ -242,12 +242,12 @@ fn unterminated_raw_string() { ", ) .stderr( - r#"Error: Unterminated string + r"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= ': ───╯ -"#, +", ) .failure(); } @@ -282,12 +282,12 @@ fn unterminated_backtick() { ", ) .stderr( - r#"Error: Unterminated backtick + r"Error: Unterminated backtick ╭─[ justfile:1:8 ] │ 1 │ foo a= `echo blaaaaaah: ───╯ -"#, +", ) .failure(); } @@ -302,12 +302,12 @@ fn unterminated_indented_raw_string() { ", ) .stderr( - r#"Error: Unterminated string + r"Error: Unterminated string ╭─[ justfile:1:6 ] │ 1 │ a b= ''': ───╯ -"#, +", ) .failure(); } @@ -342,12 +342,12 @@ fn unterminated_indented_backtick() { ", ) .stderr( - r#"Error: Unterminated backtick + r"Error: Unterminated backtick ╭─[ justfile:1:8 ] │ 1 │ foo a= ```echo blaaaaaah: ───╯ -"#, +", ) .failure(); } @@ -494,12 +494,12 @@ fn shebang_backtick() { ", ) .stderr( - r#"Error: Backticks may not start with `#!` + r"Error: Backticks may not start with `#!` ╭─[ justfile:1:6 ] │ 1 │ x := `#!/usr/bin/env sh` ───╯ -"#, +", ) .failure(); } diff --git a/tests/subsequents.rs b/tests/subsequents.rs index 868aa91176..5bb494ae73 100644 --- a/tests/subsequents.rs +++ b/tests/subsequents.rs @@ -64,12 +64,12 @@ fn circular_dependency() { ", ) .stderr( - r#"Error: Recipe `foo` depends on itself + r"Error: Recipe `foo` depends on itself ╭─[ justfile:1:9 ] │ 1 │ foo: && foo ───╯ -"#, +", ) .failure(); } @@ -83,12 +83,12 @@ fn unknown() { ", ) .stderr( - r#"Error: Recipe `foo` has unknown dependency `bar` + r"Error: Recipe `foo` has unknown dependency `bar` ╭─[ justfile:1:9 ] │ 1 │ foo: && bar ───╯ -"#, +", ) .failure(); } @@ -104,12 +104,12 @@ fn unknown_argument() { ", ) .stderr( - r#"Error: Variable `y` not defined + r"Error: Variable `y` not defined ╭─[ justfile:3:14 ] │ 3 │ foo: && (bar y) ───╯ -"#, +", ) .failure(); } diff --git a/tests/undefined_variables.rs b/tests/undefined_variables.rs index fe16c6e746..393aeacafb 100644 --- a/tests/undefined_variables.rs +++ b/tests/undefined_variables.rs @@ -5,12 +5,12 @@ fn parameter_default_unknown_variable_in_expression() { Test::new() .justfile("foo a=(b+''):") .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:8 ] │ 1 │ foo a=(b+''): ───╯ -"#, +", ) .failure(); } @@ -24,12 +24,12 @@ fn unknown_variable_in_unary_call() { ", ) .stderr( - r#"Error: Variable `a` not defined + r"Error: Variable `a` not defined ╭─[ justfile:1:15 ] │ 1 │ foo x=env_var(a): ───╯ -"#, +", ) .failure(); } @@ -43,12 +43,12 @@ fn unknown_first_variable_in_binary_call() { ", ) .stderr( - r#"Error: Variable `a` not defined + r"Error: Variable `a` not defined ╭─[ justfile:1:26 ] │ 1 │ foo x=env_var_or_default(a, b): ───╯ -"#, +", ) .failure(); } @@ -62,12 +62,12 @@ fn unknown_second_variable_in_binary_call() { ", ) .stderr( - r#"Error: Variable `b` not defined + r"Error: Variable `b` not defined ╭─[ justfile:1:30 ] │ 1 │ foo x=env_var_or_default('', b): ───╯ -"#, +", ) .failure(); } @@ -81,12 +81,12 @@ fn unknown_variable_in_ternary_call() { ", ) .stderr( - r#"Error: Variable `a` not defined + r"Error: Variable `a` not defined ╭─[ justfile:1:15 ] │ 1 │ foo x=replace(a, b, c): ───╯ -"#, +", ) .failure(); } diff --git a/tests/unexport.rs b/tests/unexport.rs index 79ba8233a9..4da0d77937 100644 --- a/tests/unexport.rs +++ b/tests/unexport.rs @@ -48,12 +48,12 @@ fn duplicate_unexport_fails() { ) .env("JUST_TEST_VARIABLE", "foo") .stderr( - r#"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times + r"Error: Variable `JUST_TEST_VARIABLE` is unexported multiple times ╭─[ justfile:6:10 ] │ 6 │ unexport JUST_TEST_VARIABLE ───╯ -"#, +", ) .failure(); } @@ -72,12 +72,12 @@ fn export_unexport_conflict() { ", ) .stderr( - r#"Error: Variable JUST_TEST_VARIABLE is both exported and unexported + r"Error: Variable JUST_TEST_VARIABLE is both exported and unexported ╭─[ justfile:6:8 ] │ 6 │ export JUST_TEST_VARIABLE := 'foo' ───╯ -"#, +", ) .failure(); } diff --git a/tests/working_directory.rs b/tests/working_directory.rs index 43030057b1..71de019cd6 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -343,7 +343,7 @@ fn attribute_duplicate() { ", ) .stderr( - r#"Error: Duplicate attribute `working-directory` + r"Error: Duplicate attribute `working-directory` ╭─[ justfile:2:2 ] │ 1 │ [working-directory('bar')] @@ -353,7 +353,7 @@ fn attribute_duplicate() { │ ────────┬──────── │ ╰────────── duplicate ───╯ -"#, +", ) .failure(); } From 639b0ae6116f8d2e2afa368e189d650e9a7049ca Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 14:55:44 -0800 Subject: [PATCH 10/14] Bump minimum rust version to 1.85 for ariadne --- .github/workflows/ci.yaml | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f9629d17e5..751e2d3eb3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.82.0 + toolchain: 1.85.0 - uses: Swatinem/rust-cache@v2 diff --git a/Cargo.toml b/Cargo.toml index 744a72cb53..a812c4b0d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["command-line", "task", "runner", "development", "utility"] license = "CC0-1.0" readme = "crates-io-readme.md" repository = "https://github.com/casey/just" -rust-version = "1.82.0" +rust-version = "1.85.0" [workspace] members = [".", "crates/*"] From 9ab39c83dd2023da09c6c447626c7d5111e8bf96 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 15:01:03 -0800 Subject: [PATCH 11/14] Small change --- src/compile_error.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compile_error.rs b/src/compile_error.rs index abae2f9341..900d130e72 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -29,13 +29,11 @@ impl<'src> CompileError<'src> { pub(crate) fn render_compile_error(error: &CompileError, color: Color) { use ariadne::{Config, Label, Report, ReportKind, Source}; - let token = error.token; - let source = Source::from(token.src); + let source = Source::from(error.token.src); - let start = token.offset; - let end = token.offset + token.length; - - let path = format!("{}", token.path.display()); + let start = error.token.offset; + let end = start + error.token.length; + let path = error.token.path.display().to_string(); let label = Label::new((&path, start..end)); let config = Config::default().with_color(color.stderr().active()); From 88e8c85412ce2252c873876243a391c91a5363d4 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 16:04:31 -0800 Subject: [PATCH 12/14] Use Rust escape sequences in misc.rs for invisible/control char tests Replace literal binary bytes (U+200B zero-width space and null byte) in test source code with Rust escape sequences (\u{200b} and \0), making tests/misc.rs a pure-ASCII file searchable by ripgrep and Neovim Telescope. The escape sequences expand to the actual characters at runtime, so test behavior is unchanged. Co-Authored-By: Claude Sonnet 4.6 --- tests/misc.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/misc.rs b/tests/misc.rs index d7ddd35443..ffb3f3859c 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -2252,10 +2252,10 @@ fn unknown_start_of_token_invisible_unicode() { ", ) .stderr( - r"Error: Unknown start of token '\u{200B}' (U+200B) + "Error: Unknown start of token '\u{200b}' (U+200B) ╭─[ justfile:1:1 ] │ - 1 │ \u{200B}foo := 'bar' + 1 │ \u{200b}foo := 'bar' ───╯ ", ) @@ -2267,14 +2267,14 @@ fn unknown_start_of_token_ascii_control_char() { Test::new() .justfile( " -\0foo := 'bar' +\u{0000}foo := 'bar' ", ) .stderr( - r"Error: Unknown start of token '' (U+0000) + "Error: Unknown start of token '\0' (U+0000) ╭─[ justfile:1:1 ] │ - 1 │ foo := 'bar' + 1 │ \0foo := 'bar' ───╯ ", ) From 2d9abd6026744aa64ef7f097c3a9dbb0b92b42f2 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 16:56:10 -0800 Subject: [PATCH 13/14] Update Windows recursion_limit test to ariadne format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Windows constant for the recursion limit error was still using the old `——▶` format. Update it to match ariadne's output format with the column number (57) where Windows hits the recursion limit due to its smaller default stack size. Co-Authored-By: Claude Sonnet 4.6 --- tests/recursion_limit.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/recursion_limit.rs b/tests/recursion_limit.rs index 94a2fd84c3..7f691dca2b 100644 --- a/tests/recursion_limit.rs +++ b/tests/recursion_limit.rs @@ -21,10 +21,9 @@ const RECURSION_LIMIT_REACHED: &str = r"Error: Parsing recursion depth exceeded "; #[cfg(windows)] -const RECURSION_LIMIT_REACHED: &str = " -error: Parsing recursion depth exceeded - ——▶ justfile:1:57 - │ -1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( - │ ^ +const RECURSION_LIMIT_REACHED: &str = r"Error: Parsing recursion depth exceeded + ╭─[ justfile:1:57 ] + │ + 1 │ foo: (x (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +───╯ "; From 704d68f8dfcb295ac4cd60f2bfba0443454ec25a Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 24 Feb 2026 17:08:20 -0800 Subject: [PATCH 14/14] revert extraneous justfile change --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index 7cb0da22f0..cfd9400d58 100755 --- a/justfile +++ b/justfile @@ -12,7 +12,7 @@ export JUST_LOG := log watch +args='test': cargo watch --clear --exec '{{ args }}' -[group('test')] +[group: 'test'] test: cargo test --all