2009-02-10 Jeffrey Stedfast <fejj@novell.com>
[mono-project/dkf.git] / mcs / tests / gtest-412.cs
blob50d9c256b824766c8da2a420678de8c4ef50a9fb
1 using System;
2 using System.Reflection;
4 class Program
6 static int Main ()
8 Type type = typeof (Foo<>);
9 Type [] gargs = type.GetGenericArguments ();
10 if (gargs == null || gargs.Length != 1) {
11 Console.WriteLine ("#1");
12 return 1;
15 Type garg = gargs [0];
16 Type [] csts = garg.GetGenericParameterConstraints ();
18 if (garg.Name != "T") {
19 Console.WriteLine ("#2: " + garg.Name);
20 return 2;
22 if (garg.GenericParameterAttributes !=
23 (GenericParameterAttributes.DefaultConstructorConstraint | GenericParameterAttributes.NotNullableValueTypeConstraint)) {
24 Console.WriteLine ("#3: " + garg.GenericParameterAttributes);
25 return 3;
27 if (csts == null || csts.Length != 1) {
28 Console.WriteLine ("#4");
29 return 4;
31 if (csts [0] != typeof (ValueType)) {
32 Console.WriteLine ("#5: " + csts [0].FullName);
33 return 5;
36 return 0;
40 struct Foo<T> where T : struct