2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-474.cs
blob09408fb2a6541e910174ff5af8331559ed4134ef
1 // Test for bug 76550 -- EmitAssign getting called
2 // on captured params.
4 class Z {
5 static void Main ()
7 TestPreinc (1);
8 TestPostinc (1);
11 delegate void X ();
13 static void TestPreinc (int i)
15 Assert (i, 1);
16 X x = delegate {
17 int z = ++i;
18 Assert (z, 2);
19 Assert (i, 2);
21 x ();
22 Assert (i, 2);
25 static void TestPostinc (int i)
27 Assert (i, 1);
28 X x = delegate {
29 int z = i++;
30 Assert (z, 1);
31 Assert (i, 2);
33 x ();
34 Assert (i, 2);
37 static void Assert (int a, int b)
39 if (a == b)
40 return;
42 throw new System.Exception ("Incorrect was: " + a + " should have been " + b + ".");