Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-474.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42357f22e0faa99b815a1e7cfcbd24784d57f5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Test for bug 76550 -- EmitAssign getting called
// on captured params.

class Z {
	public static void Main ()
	{
		TestPreinc (1);
		TestPostinc (1);
	}
	
	delegate void X ();

	static void TestPreinc (int i)
	{
		Assert (i, 1);
		X x = delegate {
			int z = ++i;
			Assert (z, 2);
			Assert (i, 2);
		};
		x ();
		Assert (i, 2);
	}

	static void TestPostinc (int i)
	{
		Assert (i, 1);
		X x = delegate {
			int z = i++;
			Assert (z, 1);
			Assert (i, 2);
		};
		x ();
		Assert (i, 2);
	}
	
	static void Assert (int a, int b)
	{
		if (a == b)
			return;

		throw new System.Exception ("Incorrect was: " + a + " should have been " + b + ".");
	}
}