Make unexpected token formatting clearer (#243)
Symbols are now be surrounded by single quotes, to set them off more clearly.
This commit is contained in:
parent
fcc27a9993
commit
b9e1f73919
@ -1274,7 +1274,7 @@ integration_test! {
|
||||
}
|
||||
|
||||
integration_test! {
|
||||
name: unexpected_token,
|
||||
name: unexpected_token_in_dependency_position,
|
||||
justfile: "foo: 'bar'",
|
||||
args: ("foo"),
|
||||
stdout: "",
|
||||
@ -1286,6 +1286,18 @@ integration_test! {
|
||||
status: EXIT_FAILURE,
|
||||
}
|
||||
|
||||
integration_test! {
|
||||
name: unexpected_token_after_name,
|
||||
justfile: "foo 'bar'",
|
||||
args: ("foo"),
|
||||
stdout: "",
|
||||
stderr: "error: Expected name, '+', ':', or '=', but found raw string
|
||||
|
|
||||
1 | foo 'bar'
|
||||
| ^^^^^
|
||||
",
|
||||
status: EXIT_FAILURE,
|
||||
}
|
||||
|
||||
integration_test! {
|
||||
name: self_dependency,
|
||||
|
12
src/lib.rs
12
src/lib.rs
@ -1493,19 +1493,19 @@ impl Display for TokenKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}", match *self {
|
||||
Backtick => "backtick",
|
||||
Colon => "\":\"",
|
||||
Colon => "':'",
|
||||
Comment => "comment",
|
||||
Dedent => "dedent",
|
||||
Eof => "end of file",
|
||||
Eol => "end of line",
|
||||
Equals => "\"=\"",
|
||||
Equals => "'='",
|
||||
Indent => "indent",
|
||||
InterpolationEnd => "}}",
|
||||
InterpolationStart => "{{",
|
||||
InterpolationEnd => "'}}'",
|
||||
InterpolationStart => "'{{'",
|
||||
Line => "command",
|
||||
Name => "name",
|
||||
Plus => "\"+\"",
|
||||
At => "\"@\"",
|
||||
Plus => "'+'",
|
||||
At => "'@'",
|
||||
StringToken => "string",
|
||||
RawString => "raw string",
|
||||
Text => "command text",
|
||||
|
Loading…
Reference in New Issue
Block a user