aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-12 08:40:55 +0100
committerJonas Maier <>2026-03-12 08:40:55 +0100
commit8dea55071464739bd1b8ef33ed5c294183d4780a (patch)
tree09dd07c1b2ec0ec22e9fdca3b3157790c3788a90 /src
parent9c36ef5162f517d793c0dd65244ad631a8e5b3ef (diff)
downloadpish-8dea55071464739bd1b8ef33ed5c294183d4780a.tar.gz
add tests for upcoming syntax
Diffstat (limited to 'src')
-rw-r--r--src/parse/test.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/parse/test.rs b/src/parse/test.rs
index 9eda7d1..64cb101 100644
--- a/src/parse/test.rs
+++ b/src/parse/test.rs
@@ -169,3 +169,36 @@ fn escape_hex_1() {
fn escape_hex_2() {
parse_test(parse(b"\\x0a"), pipes([cmd([estr(b"\n")])]));
}
+
+#[test]
+fn pipe_on_new_line() {
+ parse_test(
+ parse(b"cat file \n | cat"),
+ pipes([cmd([estr(b"cat"), estr(b"file")]), cmd([estr(b"cat")])]),
+ );
+}
+
+#[test]
+fn semicolon() {
+ parse_test(parse(b"x ; y"), todo!());
+}
+
+#[test]
+fn newline_separates_commands() {
+ parse_test(parse(b"x \n y"), todo!());
+}
+
+#[test]
+fn simple_if() {
+ parse_test(parse(b"if cond { x }"), todo!());
+}
+
+#[test]
+fn if_else() {
+ parse_test(parse(b"if cond { x } else { y }"), todo!());
+}
+
+#[test]
+fn simple_while() {
+ parse_test(parse(b"while cond { x }"), todo!());
+} \ No newline at end of file