do not check order sequence if option /order was not used
[mono.git] / mcs / tests / gtest-381.cs
1 using System.Collections.Generic;
2
3 class TestGoto
4 {
5   static int x = 2;
6
7   static void Main(string[] args)
8     {
9       foreach (bool b in test())
10         ;
11       if (x != 0)
12         throw new System.Exception ();
13     }
14
15   static IEnumerable<bool> setX()
16   {
17     x = 1;
18     try {
19       yield return true;
20     } finally {
21       x = 0;
22     }
23   }
24
25   static IEnumerable<bool> test()
26   {
27     foreach (bool b in setX()) {
28       yield return true;
29       // Change "goto label" to "break" to show the correct result.
30       goto label;
31     }
32   label:
33     yield break;
34   }
35 }