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

gtest-380.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8e27fa894f51bb9e0f73d15da6c212ee962f431d (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
using System.Reflection;
using System;

class GTest<T>
{
	public static volatile string str = "Hello";
}

class Test
{
	public volatile int field;

	public static int Main ()
	{
		FieldInfo fi = typeof (Test).GetField ("field");
		if (fi.GetCustomAttributes (true).Length != 0)
			return 1;
		
		Type[] t = fi.GetRequiredCustomModifiers ();
		if (t.Length != 1)
			return 2;
		
		if (t [0] != typeof (System.Runtime.CompilerServices.IsVolatile))
			return 3;

		fi = typeof (GTest<>).GetField ("str");
		if (fi.GetCustomAttributes (true).Length != 0)
			return 10;
		
		t = fi.GetRequiredCustomModifiers ();
		if (t.Length != 1)
			return 11;
		
		if (t [0] != typeof (System.Runtime.CompilerServices.IsVolatile))
			return 12;

		Console.WriteLine ("OK");
		return 0;
	}
}