aboutsummaryrefslogtreecommitdiffstats
path: root/test-cases
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-06-02 17:40:28 +0200
committerJonas Maier <jonas@x77.dev>2026-06-02 17:40:28 +0200
commitfda08e286d3eeca8db598bcd3dd1802e99209363 (patch)
tree14028ebaa69ee59ef2affe446b8791f0da92c238 /test-cases
parente1f64a93c0246d7832a308c756b654965fe3710d (diff)
downloadpish-fda08e286d3eeca8db598bcd3dd1802e99209363.tar.gz
lookahead, implemented wrong
Diffstat (limited to 'test-cases')
-rw-r--r--test-cases/case2_lookahead/script.sh38
-rw-r--r--test-cases/case2_lookahead/stdout.txt0
2 files changed, 38 insertions, 0 deletions
diff --git a/test-cases/case2_lookahead/script.sh b/test-cases/case2_lookahead/script.sh
new file mode 100644
index 0000000..1a2226b
--- /dev/null
+++ b/test-cases/case2_lookahead/script.sh
@@ -0,0 +1,38 @@
+case foo {
+ f(?=o)oo {}
+ .* { echo fail 1 }
+}
+
+case foo {
+ fo(?=x)o { echo fail 2 }
+ .* { }
+}
+
+fun match {
+ set res = $($1 $2)
+ if [ $res != $3 ] {
+ echo "match $1 $2: expected $3, got $res"
+ }
+}
+
+fun x0 {
+ case $1 {
+ a(?=b). { echo yes }
+ .* { echo no }
+ }
+}
+match x0 aa no
+match x0 aaa no
+match x0 ab yes
+
+fun x1 {
+ case $1 {
+ a(?!x)x { echo yes }
+ .* { echo no }
+ }
+}
+match x1 a no
+match x1 aa no
+match x1 ax no
+match x1 axx no
+match x1 aax no
diff --git a/test-cases/case2_lookahead/stdout.txt b/test-cases/case2_lookahead/stdout.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test-cases/case2_lookahead/stdout.txt