summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-08-22 11:04:30 +0000
committerjilles <jilles@FreeBSD.org>2010-08-22 11:04:30 +0000
commita0dc7e84cff2c39510d98dd9a1fadfc44052b0a7 (patch)
tree605003e6f14e401b07818b802192a9b6c66811d4
parent2b32a31ca3484e23ff35b71b7349d361ba187ee3 (diff)
downloadFreeBSD-src-a0dc7e84cff2c39510d98dd9a1fadfc44052b0a7.zip
FreeBSD-src-a0dc7e84cff2c39510d98dd9a1fadfc44052b0a7.tar.gz
sh: Add a test for breaking from a loop outside the current function.
It is unwise to rely on this but I'd like to know if this would break.
-rw-r--r--tools/regression/bin/sh/builtins/break3.015
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/break3.0 b/tools/regression/bin/sh/builtins/break3.0
new file mode 100644
index 0000000..10a5ca8
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/break3.0
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+# We accept this and people might rely on it.
+# However, various other shells do not accept it.
+
+f() {
+ break
+ echo bad1
+}
+
+while :; do
+ f
+ echo bad2
+ exit 2
+done
OpenPOWER on IntegriCloud