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(); +}