summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-08 14:40:57 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-08 14:40:57 -0500
commit82b885d8f12fc9ccb02a7e77799ced063d2df29e (patch)
treec95f74d9d734454326b33d0e5b8f5542312bd5ce
parent7b932969d69dc99b49f1a7a7ec7e5d87024bcfe2 (diff)
downloadnbsh-82b885d8f12fc9ccb02a7e77799ced063d2df29e.tar.gz
nbsh-82b885d8f12fc9ccb02a7e77799ced063d2df29e.zip
more tests
-rw-r--r--src/parse/ast.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs
index 55a71f4..3e67273 100644
--- a/src/parse/ast.rs
+++ b/src/parse/ast.rs
@@ -622,4 +622,51 @@ fn test_parts() {
)
)
);
+ parse_eq!(
+ "echo $HOME/bin",
+ c!(
+ "echo $HOME/bin",
+ p!(
+ "echo $HOME/bin",
+ e!(w!("echo"), w!(wpv!("HOME"), wpb!("/bin")))
+ )
+ )
+ );
+ parse_eq!(
+ "echo '$HOME/bin'",
+ c!(
+ "echo '$HOME/bin'",
+ p!("echo '$HOME/bin'", e!(w!("echo"), w!(wps!("$HOME/bin"))))
+ )
+ );
+ parse_eq!(
+ "echo \"foo\"\"bar\"",
+ c!(
+ "echo \"foo\"\"bar\"",
+ p!(
+ "echo \"foo\"\"bar\"",
+ e!(w!("echo"), w!(wpd!("foo"), wpd!("bar")))
+ )
+ )
+ );
+ parse_eq!(
+ "echo $foo$bar$baz",
+ c!(
+ "echo $foo$bar$baz",
+ p!(
+ "echo $foo$bar$baz",
+ e!(w!("echo"), w!(wpv!("foo"), wpv!("bar"), wpv!("baz")))
+ )
+ )
+ );
+ parse_eq!(
+ "perl -E'say \"foo\"'",
+ c!(
+ "perl -E'say \"foo\"'",
+ p!(
+ "perl -E'say \"foo\"'",
+ e!(w!("perl"), w!(wpb!("-E"), wps!("say \"foo\"")))
+ )
+ )
+ );
}