diff options
Diffstat (limited to 'shell/hush_test')
14 files changed, 42 insertions, 0 deletions
diff --git a/shell/hush_test/hush-arith/arith-ternary-assign.right b/shell/hush_test/hush-arith/arith-ternary-assign.right new file mode 100644 index 0000000..6644d86 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-assign.right @@ -0,0 +1 @@ +42:42 diff --git a/shell/hush_test/hush-arith/arith-ternary-assign.tests b/shell/hush_test/hush-arith/arith-ternary-assign.tests new file mode 100755 index 0000000..fa18fe7 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-assign.tests @@ -0,0 +1,3 @@ +exec 2>&1 +a='@' +echo 42:$((a=1?42:3,a)) diff --git a/shell/hush_test/hush-arith/arith-ternary-comma.right b/shell/hush_test/hush-arith/arith-ternary-comma.right new file mode 100644 index 0000000..6644d86 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-comma.right @@ -0,0 +1 @@ +42:42 diff --git a/shell/hush_test/hush-arith/arith-ternary-comma.tests b/shell/hush_test/hush-arith/arith-ternary-comma.tests new file mode 100755 index 0000000..5e05b58 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-comma.tests @@ -0,0 +1,3 @@ +exec 2>&1 +x='@' +echo 42:$((1?4:x,20*2+2)) diff --git a/shell/hush_test/hush-arith/arith-ternary-preincr.right b/shell/hush_test/hush-arith/arith-ternary-preincr.right new file mode 100644 index 0000000..6644d86 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-preincr.right @@ -0,0 +1 @@ +42:42 diff --git a/shell/hush_test/hush-arith/arith-ternary-preincr.tests b/shell/hush_test/hush-arith/arith-ternary-preincr.tests new file mode 100755 index 0000000..3985c70 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary-preincr.tests @@ -0,0 +1,3 @@ +exec 2>&1 +x='@' +echo 42:$((1?42:++x)) diff --git a/shell/hush_test/hush-arith/arith-ternary1.right b/shell/hush_test/hush-arith/arith-ternary1.right new file mode 100644 index 0000000..6b751d7 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary1.right @@ -0,0 +1,2 @@ +42:42 +a=0 diff --git a/shell/hush_test/hush-arith/arith-ternary1.tests b/shell/hush_test/hush-arith/arith-ternary1.tests new file mode 100755 index 0000000..3532ce5 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary1.tests @@ -0,0 +1,5 @@ +exec 2>&1 +a=0 +# The not-taken branch should not evaluate +echo 42:$((1 ? 42 : (a+=2))) +echo "a=$a" diff --git a/shell/hush_test/hush-arith/arith-ternary2.right b/shell/hush_test/hush-arith/arith-ternary2.right new file mode 100644 index 0000000..a549b1b --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary2.right @@ -0,0 +1,3 @@ +6:6 +a=b=+err+ +b=6 diff --git a/shell/hush_test/hush-arith/arith-ternary2.tests b/shell/hush_test/hush-arith/arith-ternary2.tests new file mode 100755 index 0000000..cb31639 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary2.tests @@ -0,0 +1,7 @@ +exec 2>&1 +a='b=+err+' +b=5 +# The not-taken branch should not parse variables +echo 6:$((0 ? a : ++b)) +echo "a=$a" +echo "b=$b" diff --git a/shell/hush_test/hush-arith/arith-ternary3.right b/shell/hush_test/hush-arith/arith-ternary3.right new file mode 100644 index 0000000..6644d86 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary3.right @@ -0,0 +1 @@ +42:42 diff --git a/shell/hush_test/hush-arith/arith-ternary3.tests b/shell/hush_test/hush-arith/arith-ternary3.tests new file mode 100755 index 0000000..0bf9f30 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary3.tests @@ -0,0 +1,4 @@ +exec 2>&1 +# "EXPR ?..." should check _evaluated_ EXPR, +# not its last value +echo 42:$((1 < 1 ? -1 : 1 > 1 ? 1 : 42)) diff --git a/shell/hush_test/hush-arith/arith-ternary_nested3.right b/shell/hush_test/hush-arith/arith-ternary_nested3.right new file mode 100644 index 0000000..1a34fde --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary_nested3.right @@ -0,0 +1,2 @@ +42:42 +a=2:2 diff --git a/shell/hush_test/hush-arith/arith-ternary_nested3.tests b/shell/hush_test/hush-arith/arith-ternary_nested3.tests new file mode 100755 index 0000000..b69dcc6 --- /dev/null +++ b/shell/hush_test/hush-arith/arith-ternary_nested3.tests @@ -0,0 +1,6 @@ +exec 2>&1 +x='@' +a=2 +# After processing nested ?:, outermost ?: should still rememeber to NOT evaluate a*=2 +echo 42:$((1?0?41:42:(a*=2))) +echo "a=2:$a" |