diff --git a/src/parser.rs b/src/parser.rs index 00ec7e7..e04c1da 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -333,8 +333,10 @@ impl<'tokens, 'src> Parser<'tokens, 'src> { } Some(Keyword::Set) if self.next_are(&[Identifier, Identifier, ColonEquals]) - || self.next_are(&[Identifier, Identifier, Eol]) - || self.next_are(&[Identifier, Identifier, Eof]) => + || self.next_are(&[Identifier, Identifier, Comment, Eof]) + || self.next_are(&[Identifier, Identifier, Comment, Eol]) + || self.next_are(&[Identifier, Identifier, Eof]) + || self.next_are(&[Identifier, Identifier, Eol]) => { items.push(Item::Set(self.parse_set()?)); } diff --git a/tests/lib.rs b/tests/lib.rs index b6fa7a4..9867e3d 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -58,6 +58,7 @@ mod json; mod line_prefixes; mod misc; mod multibyte_char; +mod parser; mod positional_arguments; mod quiet; mod quote; diff --git a/tests/parser.rs b/tests/parser.rs new file mode 100644 index 0000000..307f1ae --- /dev/null +++ b/tests/parser.rs @@ -0,0 +1,13 @@ +use super::*; + +#[test] +fn dont_run_duplicate_recipes() { + Test::new() + .justfile( + " + set dotenv-load # foo + bar: + ", + ) + .run(); +}