From 524e12e2d8f2f3cd8afcf047bd2c5c56ac2a9dd0 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 11 Dec 2024 15:22:25 -0800 Subject: [PATCH] Fix truncated bang operator error message --- src/compile_error.rs | 2 +- tests/parser.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/compile_error.rs b/src/compile_error.rs index 593f4f5912..ce53c12f70 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -255,7 +255,7 @@ impl Display for CompileError<'_> { UnexpectedEndOfToken { expected } => { write!( f, - "Expected character `{}` but found end-of-file", + "Expected character {} but found end-of-file", List::or_ticked(expected), ) } diff --git a/tests/parser.rs b/tests/parser.rs index 3512991ca0..32a57a9216 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -32,3 +32,20 @@ error: Expected character `=` or `~` ) .run(); } + +#[test] +fn truncated_bang_operator() { + Test::new() + .justfile("x := if '' !") + .status(1) + .stderr( + r" +error: Expected character `=` or `~` but found end-of-file + ——▶ justfile:1:13 + │ +1 │ x := if '' ! + │ ^ +", + ) + .run(); +}