aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-07 13:17:20 +0100
committerJonas Maier <>2026-03-07 13:17:20 +0100
commit448a7dd10fbd369e56e7a17e650b4d1c760e3bd1 (patch)
tree3e6b33529a16529d1a9e78ed78c7962f90c7b606
parent4f9c061a348547a77635cde495ed21969efb3cc7 (diff)
downloadpish-448a7dd10fbd369e56e7a17e650b4d1c760e3bd1.tar.gz
fix parsing of simple variables
-rw-r--r--src/parse/mod.rs3
-rw-r--r--src/parse/test.rs10
2 files changed, 9 insertions, 4 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index 853580d..f8de732 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -520,6 +520,9 @@ impl Parse for ExpString {
continue;
}
+ if delim == b' ' {
+ already_parsed = true;
+ }
continue;
}
diff --git a/src/parse/test.rs b/src/parse/test.rs
index 2ea3f9c..e1c2077 100644
--- a/src/parse/test.rs
+++ b/src/parse/test.rs
@@ -37,8 +37,10 @@ fn string_concat() {
#[test]
fn simple_string() {
- parse_test(
- parse(b"foo"),
- pipes([cmd([estr(b"foo")])]),
- );
+ parse_test(parse(b"foo"), pipes([cmd([estr(b"foo")])]));
+}
+
+#[test]
+fn simple_var() {
+ parse_test(parse(b"$foo"), pipes([cmd([str([var(b"foo")])])]));
}