diff --git a/src/lib.rs b/src/lib.rs index 97617de..58f710b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -988,7 +988,7 @@ impl<'a> Display for RunError<'a> { match *self { RunError::UnknownRecipes{ref recipes} => { if recipes.len() == 1 { - try!(write!(f, "Justfile does not contain recipe: {}", recipes[0])); + try!(write!(f, "Justfile does not contain recipe `{}`", recipes[0])); } else { try!(write!(f, "Justfile does not contain recipes: {}", recipes.join(" "))); }; @@ -1528,7 +1528,8 @@ impl<'a> Parser<'a> { if token.lexeme.starts_with("#!") { shebang = true; } - } else if !shebang && token.lexeme.starts_with(' ') || token.lexeme.starts_with('\t') { + } else if !shebang && (token.lexeme.starts_with(' ') || + token.lexeme.starts_with('\t')) { return Err(token.error(ErrorKind::ExtraLeadingWhitespace)); } } diff --git a/src/unit.rs b/src/unit.rs index ac02648..9313e82 100644 --- a/src/unit.rs +++ b/src/unit.rs @@ -302,6 +302,25 @@ y: z:"); } +#[test] +fn parse_shebang() { + parse_summary(" +practicum = 'hello' +install: +\t#!/bin/sh +\tif [[ -f {{practicum}} ]]; then +\t\treturn +\tfi +", "practicum = \"hello\" + +install: + #!/bin/sh + if [[ -f {{practicum}} ]]; then + \treturn + fi" + ); +} + #[test] fn parse_assignments() { parse_summary(