diff options
Diffstat (limited to 'src/makefile')
-rw-r--r-- | src/makefile/input.rs | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 74742f9..345f465 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -439,15 +439,7 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { Ok(x) => x, Err(err) => return Some((n, Err(err))), }; - let line = if settings.strip_comments { - COMMENT - .replace(&line, "$1") - .replace(r"\#", "#") - .trim_end() - .to_owned() - } else { - line - }; + // TODO strip comments if it's correct to line_pieces.push(line.trim_start().to_owned()); } } @@ -1150,10 +1142,11 @@ pub struct FinishedMakefileReader { #[cfg(test)] mod test { - use super::*; - use std::io::Cursor; + use super::*; + use crate::makefile::token::Token; + type R = Result<()>; #[test] @@ -1485,4 +1478,35 @@ test: c ); Ok(()) } + + #[cfg(feature = "full")] + #[test] + fn shell_comment() -> R { + let file = r#" +FOO=$(shell \ +echo \ +#abc) + "#; + let args = Args::empty(); + let makefile = MakefileReader::read( + &args, + MacroScopeStack::default(), + MacroSet::new(), + Cursor::new(file), + "", + Default::default(), + )?; + let makefile = makefile.finish(); + assert_eq!( + makefile.macros.get_non_recursive("FOO").map(|x| &x.text), + Some(&TokenString::from(vec![ + Token::Text(String::new()), + Token::FunctionCall { + name: TokenString::text("shell"), + args: vec![TokenString::text("echo #abc")], + }, + ])) + ); + Ok(()) + } } |