X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fcustom-attr.cs;h=40dbae17ddb9c93060eeef27c4b87577892b720a;hb=f73e83935184e83818e67e111cce69aa0d4ff537;hp=7e8d50dd41d7a743a52d2b898e48f0469755f2a0;hpb=0649b90c407fc29ee8377f2c6fb42ae2c006e26a;p=mono.git diff --git a/mono/tests/custom-attr.cs b/mono/tests/custom-attr.cs index 7e8d50dd41d..40dbae17ddb 100644 --- a/mono/tests/custom-attr.cs +++ b/mono/tests/custom-attr.cs @@ -32,6 +32,23 @@ namespace Test { public char[] Prop2; } + + class XAttribute : Attribute { + public XAttribute () + { + throw new Exception ("X"); + } + } + + interface ZInterface { + } + + class ZAttribute : Attribute, ZInterface { + } + + [X, Z, Serializable] + class Y { + } [My("testclass")] [My2("testclass", 22)] @@ -61,6 +78,27 @@ namespace Test { } } } + + // + // Test that requesting a specific custom attributes does not + // create all the others + // + + typeof (Y).IsDefined (typeof (ZAttribute), true); + typeof (Y).IsDefined (typeof (XAttribute), true); + + typeof (Y).GetCustomAttributes (typeof (ZAttribute), true); + + try { + typeof (Y).GetCustomAttributes (true); + return 4; + } + catch { + } + + if (typeof (Y).GetCustomAttributes (typeof (ZInterface), true).Length != 1) + return 5; + return 0; } }