2009-04-29 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 29 Apr 2009 23:28:02 +0000 (23:28 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 29 Apr 2009 23:28:02 +0000 (23:28 -0000)
* cli-tables-tests.md: Tests for cattr table.

* assembly-with-cattr.cs: New test file for producing tests
for cattr table.

* Makefile: Add new dependencies and do some cleanup.

svn path=/trunk/mono/; revision=133092

mono/tests/metadata-verifier/Changelog
mono/tests/metadata-verifier/Makefile
mono/tests/metadata-verifier/assembly-with-cattr.cs [new file with mode: 0644]
mono/tests/metadata-verifier/cli-tables-tests.md

index c98b445a088432c8aded69f2c285d00245f4bdb4..b5e42bb3cd542d95ff262bc4b40721a7ae62eb4f 100644 (file)
@@ -1,3 +1,12 @@
+2009-04-29 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * cli-tables-tests.md: Tests for cattr table.
+
+       * assembly-with-cattr.cs: New test file for producing tests
+       for cattr table.
+
+       * Makefile: Add new dependencies and do some cleanup.
+
 2009-04-29 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * gen-md-tests.c: Close the image after using it.
index dce888682905b2243065082350f94bcd7486f975..c761400844f567ae8d6cc698baa4cbe31a62a917 100644 (file)
@@ -19,11 +19,15 @@ assembly-with-params.exe: assembly-with-params.cs
 assembly-with-constants.exe: assembly-with-constants.cs
        gmcs assembly-with-constants.cs
 
+assembly-with-cattr.exe: assembly-with-cattr.cs
+       gmcs assembly-with-cattr.cs
+
 TEST_BINARIES = assembly-with-resource.exe \
        assembly-with-complex-type.exe \
        assembly-with-methods.exe \
        assembly-with-params.exe \
        assembly-with-constants.exe \
+       assembly-with-cattr.exe \
        simple-assembly.exe
 
 
diff --git a/mono/tests/metadata-verifier/assembly-with-cattr.cs b/mono/tests/metadata-verifier/assembly-with-cattr.cs
new file mode 100644 (file)
index 0000000..fbac2c6
--- /dev/null
@@ -0,0 +1,65 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.ComponentModel;
+
+//TODO add to a typeref
+//TODO is Bla<D> a memberref?
+//TODO to an entry in security table
+//TODO add to a standalonesig
+//TODO add to a moduleref
+//TODO add to a typespec
+//TODO add to a assemblyref
+//TODO add to a file
+//TODO add to a exportedtype
+//TODO add to a manifesresource
+//TODO add to an interfaceimpl
+
+
+[assembly: Generic (14)]
+[module: Generic (80)]
+
+
+[AttributeUsage(AttributeTargets.All)]
+public sealed class GenericAttribute : Attribute
+{
+       public GenericAttribute () {}
+       public GenericAttribute (int x) {}
+}
+
+public interface IFace {}
+
+
+public class Foo : IFace
+{}
+
+public class Foo<T> 
+{
+       [Generic (70)]
+       public void Bla<D> () {}
+
+}
+
+
+public delegate int Del();
+
+[Generic (30)]
+public class Class
+{
+       [Generic (20)]
+       int field;
+
+       int Foo ([Generic (50)] int d) { return d; }
+
+       [Generic (100)]
+       public int Bla { get; set; }
+
+       [Generic (110)]
+       public event Del Zzz;
+
+       [Generic (10)]
+       public static void Main ()
+       {
+       
+       }
+}
index f3a6d0976d60fe56526d9638434353541dd04f06..274a2f53bf0b38e58080a00b55908572965a79d1 100644 (file)
@@ -604,7 +604,54 @@ constant-table {
 
        #LAMEIMPL, MS doesn't bound check the constant size. Lame of them.
        invalid offset table-row ( 0xB 0 ) + 4 set-ushort read.uint ( stream-header ( 3 ) + 4 ) - 1 
-       
 }
 
+cattr-table {
+       assembly assembly-with-cattr.exe
+
+       #parent is a valid coded index (2)
+       #The spec say any table can be used, but only 19 tables are allowed on the coded token
+       #bad table
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x33
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x34
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x35
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x36
+
+       #LAMEIMPL MS doesn't test this error
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x37
+       #LAMEIMPL MS doesn't test this error
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x38
+
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x39
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3A
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3B
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3C
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3D
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3E
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x3F
+
+       #bad index
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x8801
+       invalid offset table-row ( 0xC 0 ) set-ushort 0x8832
+
+       #type is a valid token (3)
+       #this uses 3 bits and only 0x2/0x3 are valid
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x0008
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x0009
+       valid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000A
+       valid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000B
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000C
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000D
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000E
+       invalid offset table-row ( 0xC 0 ) + 2 set-ushort 0x000F
+
+       #value is optional (4)
+       valid offset table-row ( 0xC 0 ) + 4 set-ushort 0
+
+       #Valid is a valid blob index (5)
+       invalid offset table-row ( 0xC 0 ) + 4 set-ushort 0x8888
+
+       #TODO validate the cattr blob (6,7,8,9)
+       #TODO verify is Type is a .ctor.
+}