summaryrefslogtreecommitdiff
path: root/mcs/tests/test-876.cs
blob: f7e373e69d05186ad550bdd30da8c654fd7fb9fd (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;

class T
{
	public static int Main ()
	{
		Test1 ();
		Test2 ();
		Test3 (0, 1);
		Test4 ();
		Test5 ();
		
		switch (1) {
		case 1:
			return 0;
		default:
			break;
		}
	}

	static void Test1 ()
	{
		int g = 9;
	A:
		switch (g) {
		case 4:
			return;
		case 5:
			goto A;
		}

		switch (g) {
		case 9:
			break;
		}

		return;
	}
	
	static void Test2 ()
	{
		int a,b;
		int g = 9;
		if (g > 0) {
			a = 1;
			goto X;
		} else {
			b = 2;
			goto Y;
		}

	X:
		Console.WriteLine (a);
		return;
	Y:
		Console.WriteLine (b);
		return;
	}
	
	static uint Test3 (int self, uint data)
	{
		uint rid;
		switch (self) {
		case 0:
			rid = 2;
			switch (data & 3) {
			case 0:
				goto ret;
			default:
				goto exit;
			}
		default:
			goto exit;
		}
	ret:
		return rid;
	exit:
		return 0;
	}

	static void Test4 ()
	{
		bool v;
		try {
			throw new NotImplementedException ();
		} catch (System.Exception) {
			v = false;
		}
		
		Console.WriteLine (v);
	}

	static void Test5 ()
	{
		int i = 8;
		switch (10) {
		case 5:
			if (i != 10)
				throw new ApplicationException ();
			
			Console.WriteLine (5);
			break;
		case 10:
			i = 10;
			Console.WriteLine (10);
			goto default;
		default:
			Console.WriteLine ("default");
			goto case 5;
		}
	}
}