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! {
|
integration_test! {
|
||||||
name: unexpected_token,
|
name: unexpected_token_in_dependency_position,
|
||||||
justfile: "foo: 'bar'",
|
justfile: "foo: 'bar'",
|
||||||
args: ("foo"),
|
args: ("foo"),
|
||||||
stdout: "",
|
stdout: "",
|
||||||
@ -1286,6 +1286,18 @@ integration_test! {
|
|||||||
status: EXIT_FAILURE,
|
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! {
|
integration_test! {
|
||||||
name: self_dependency,
|
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> {
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
write!(f, "{}", match *self {
|
write!(f, "{}", match *self {
|
||||||
Backtick => "backtick",
|
Backtick => "backtick",
|
||||||
Colon => "\":\"",
|
Colon => "':'",
|
||||||
Comment => "comment",
|
Comment => "comment",
|
||||||
Dedent => "dedent",
|
Dedent => "dedent",
|
||||||
Eof => "end of file",
|
Eof => "end of file",
|
||||||
Eol => "end of line",
|
Eol => "end of line",
|
||||||
Equals => "\"=\"",
|
Equals => "'='",
|
||||||
Indent => "indent",
|
Indent => "indent",
|
||||||
InterpolationEnd => "}}",
|
InterpolationEnd => "'}}'",
|
||||||
InterpolationStart => "{{",
|
InterpolationStart => "'{{'",
|
||||||
Line => "command",
|
Line => "command",
|
||||||
Name => "name",
|
Name => "name",
|
||||||
Plus => "\"+\"",
|
Plus => "'+'",
|
||||||
At => "\"@\"",
|
At => "'@'",
|
||||||
StringToken => "string",
|
StringToken => "string",
|
||||||
RawString => "raw string",
|
RawString => "raw string",
|
||||||
Text => "command text",
|
Text => "command text",
|
||||||
|
Loading…
Reference in New Issue
Block a user