summaryrefslogtreecommitdiffstats
path: root/tools/regression/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-01-15 21:39:38 +0000
committerjilles <jilles@FreeBSD.org>2012-01-15 21:39:38 +0000
commit0ae130814a5b5ff84bc63b403e50eab143d5eddc (patch)
tree1b3dae3bc843b68f70d43cdc73e4cb560bc9baeb /tools/regression/bin/sh
parent286401123342863782d27c80567e650d22f2ac91 (diff)
downloadFreeBSD-src-0ae130814a5b5ff84bc63b403e50eab143d5eddc.zip
FreeBSD-src-0ae130814a5b5ff84bc63b403e50eab143d5eddc.tar.gz
sh: Fix some bugs with exit status from case containing ;&.
Also, rework evalcase() to not evaluate any tree. Instead, return the NCLISTFALLTHRU node and handle it in evaltree(). Fixed bugs: * If a ;& list with non-zero exit status is followed by an empty ;; or final list, the exit status of the case command should be equal to the exit status of the ;& list, not 0. * An empty ;& case should not reset $?.
Diffstat (limited to 'tools/regression/bin/sh')
-rw-r--r--tools/regression/bin/sh/builtins/case17.03
-rw-r--r--tools/regression/bin/sh/builtins/case18.07
-rw-r--r--tools/regression/bin/sh/builtins/case19.07
3 files changed, 17 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/case17.0 b/tools/regression/bin/sh/builtins/case17.0
new file mode 100644
index 0000000..ed1d25f
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/case17.0
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+! case x in x) false ;& y) esac
diff --git a/tools/regression/bin/sh/builtins/case18.0 b/tools/regression/bin/sh/builtins/case18.0
new file mode 100644
index 0000000..470253f
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/case18.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+case x$(false) in
+x) ;&
+y) [ $? != 0 ] ;;
+z) false ;;
+esac
diff --git a/tools/regression/bin/sh/builtins/case19.0 b/tools/regression/bin/sh/builtins/case19.0
new file mode 100644
index 0000000..215066a
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/case19.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+[ "`case x in
+x) false ;&
+y) ;&
+z) echo $? ;;
+esac`" != 0 ]
OpenPOWER on IntegriCloud