Skip to content

Commit

Permalink
More tests.
Browse files Browse the repository at this point in the history
svn path=/trunk/mono/; revision=2544
  • Loading branch information
illupus committed Feb 20, 2002
1 parent 5476034 commit af53eeb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mono/tests/Makefile.am
Expand Up @@ -35,6 +35,8 @@ TESTSRC= \
enum2.cs \
property.cs \
enumcast.cs \
array-cast.cs \
cattr-compile.cs \
custom-attr.cs \
double-cast.cs \
newobj-valuetype.cs \
Expand Down
12 changes: 12 additions & 0 deletions mono/tests/array-cast.cs
@@ -0,0 +1,12 @@
using System;

namespace Test {
public class Test {
public static int Main () {
Attribute[] attr_array = new Attribute [1];
object obj = (object) attr_array;
object[] obj_array = (object[]) obj;
return 0;
}
}
}
11 changes: 11 additions & 0 deletions mono/tests/cattr-compile.cs
@@ -0,0 +1,11 @@
using System;

namespace Test {
[CLSCompliant(false)]
public class Test {
[CLSCompliant(false)]
public static int Main() {
return 0;
}
}
}
10 changes: 9 additions & 1 deletion mono/tests/custom-attr.cs
Expand Up @@ -10,15 +10,23 @@ public class MyAttribute: Attribute {
val = stuff;
}
}
public class My2Attribute: MyAttribute {
public int ival;
public My2Attribute (string stuff, int blah) : base (stuff) {
System.Console.WriteLine ("ctor with int val"+stuff);
ival = blah;
}
}
[My("testclass")]
[My2("testclass", 22)]
public class Test {
static public int Main() {
System.Reflection.MemberInfo info = typeof (Test);
object[] attributes = info.GetCustomAttributes (false);
for (int i = 0; i < attributes.Length; i ++) {
System.Console.WriteLine(attributes[i]);
}
if (attributes.Length != 1)
if (attributes.Length != 2)
return 1;
MyAttribute attr = (MyAttribute) attributes [0];
if (attr.val != "testclass")
Expand Down

0 comments on commit af53eeb

Please sign in to comment.