X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fcustom-attr.cs;h=b8d35607ae6dc3411731a31bead8c26b96274408;hb=0cac21043dff96146ac6d6081c3f112e8a97cae1;hp=79b5fdf4bf38adc3ffd56486286b33e976f4fd5a;hpb=b585d00928892398dfbfc315ed78b8032fa14708;p=mono.git diff --git a/mono/tests/custom-attr.cs b/mono/tests/custom-attr.cs index 79b5fdf4bf3..b8d35607ae6 100644 --- a/mono/tests/custom-attr.cs +++ b/mono/tests/custom-attr.cs @@ -40,12 +40,19 @@ namespace Test { } } - class ZAttribute : Attribute { + interface ZInterface { + } + + class ZAttribute : Attribute, ZInterface { } [X, Z, Serializable] class Y { } + + [My("arg\0string\0with\0nuls")] + class NulTests { + } [My("testclass")] [My2("testclass", 22)] @@ -93,6 +100,20 @@ namespace Test { catch { } + if (typeof (Y).GetCustomAttributes (typeof (ZInterface), true).Length != 1) + return 5; + + if (!typeof (Y).IsDefined (typeof (ZInterface), true)) + return 6; + + // Test that synthetic methods have no attributes + if (typeof(int[,]).GetConstructor (new Type [] { typeof (int), typeof (int) }).GetCustomAttributes (true).Length != 0) + return 7; + + // Test that nuls are preserved (see Xamarin bug 5732) + if (((MyAttribute)typeof (NulTests).GetCustomAttributes (true)[0]).val != "arg\0string\0with\0nuls") + return 8; + return 0; } }