From 193da04bd876291deb3230c4f15256eeca370ba4 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 22 Aug 2010 11:04:30 +0000 Subject: [PATCH] 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. --- tools/regression/bin/sh/builtins/break3.0 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tools/regression/bin/sh/builtins/break3.0 diff --git a/tools/regression/bin/sh/builtins/break3.0 b/tools/regression/bin/sh/builtins/break3.0 new file mode 100644 index 00000000000..10a5ca88edf --- /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