diff options
Diffstat (limited to 'src/parse/test_ast.rs')
-rw-r--r-- | src/parse/test_ast.rs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/parse/test_ast.rs b/src/parse/test_ast.rs index 5c89871..f762615 100644 --- a/src/parse/test_ast.rs +++ b/src/parse/test_ast.rs @@ -121,19 +121,19 @@ macro_rules! wpv { } macro_rules! wpb { - ($bareword:literal) => { + ($bareword:expr) => { WordPart::Bareword($bareword.to_string()) }; } macro_rules! wpd { - ($doublequoted:literal) => { + ($doublequoted:expr) => { WordPart::DoubleQuoted($doublequoted.to_string()) }; } macro_rules! wps { - ($singlequoted:literal) => { + ($singlequoted:expr) => { WordPart::SingleQuoted($singlequoted.to_string()) }; } @@ -201,6 +201,25 @@ fn test_basic() { p!((44, 60), e!(w!("builtin"), w!("echo"), w!("bar"))) ) ); + + // XXX this parse may change in the future + let exe = std::env::current_exe() + .unwrap() + .into_os_string() + .into_string() + .unwrap(); + parse_eq!( + "seq 1 5 | (while read line; echo \"line: $line\"; end)", + cs!(p!( + (0, 52), + e!(w!("seq"), w!("1"), w!("5")), + e!( + w!(wps!(exe)), + w!(wps!("-c")), + w!(wps!("while read line; echo \"line: $line\"; end")) + ) + )) + ); } #[test] |