diff options
author | Miguel de Icaza <miguel@gnome.org> | 2002-07-09 23:32:33 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2002-07-09 23:32:33 +0400 |
commit | 99693d4f429ade5974b9e778723217e39289e560 (patch) | |
tree | 98719f8e4cced30f7f3c3e539bfe6e18e4402b84 /mcs/tests/test-52.cs | |
parent | 98fc563c16a5f96f13405a79e56816c1b536ec5d (diff) |
2002-07-09 Miguel de Icaza <miguel@ximian.com>
* statement.cs (Break): We can be breaking out of a Try/Catch
controlled section (foreach might have an implicit try/catch
clause), so we need to use Leave instead of Br.
svn path=/trunk/mcs/; revision=5672
Diffstat (limited to 'mcs/tests/test-52.cs')
-rwxr-xr-x | mcs/tests/test-52.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mcs/tests/test-52.cs b/mcs/tests/test-52.cs index f16e6264696..c6b0726c3a7 100755 --- a/mcs/tests/test-52.cs +++ b/mcs/tests/test-52.cs @@ -73,6 +73,25 @@ class X { if (total2 != "AB") return 3; + ArrayList list = new ArrayList (); + list.Add ("one"); + list.Add ("two"); + list.Add ("three"); + int count = 0; + + // + // This test will make sure that `break' inside foreach will + // actually use a `leave' opcode instead of a `br' opcode + // + foreach (string s in list){ + if (s == "two"){ + break; + } + count++; + } + if (count != 1) + return 4; + Console.WriteLine ("test passes"); return 0; } |