summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAvi Avni <avi.avni@gmail.com>2019-06-11 03:22:34 +0300
committerDavid Wrighton <davidwr@microsoft.com>2019-06-10 17:22:34 -0700
commit5cea50c794753b65a25c17b9b88a84eb7e432ba5 (patch)
treecaa15e3e3d66f325b9502fe0ba3d7e799f6308ac /tests
parenta7b7af37dd9e56f94016aed9d9eaf5f857a6d722 (diff)
downloadcoreclr-5cea50c794753b65a25c17b9b88a84eb7e432ba5.tar.gz
coreclr-5cea50c794753b65a25c17b9b88a84eb7e432ba5.tar.bz2
coreclr-5cea50c794753b65a25c17b9b88a84eb7e432ba5.zip
fix generic attribute bug when generic attribute has parameters and the parameters (#25054)
* fix generic attribute bug * add missing test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/src/reflection/GenericAttribute/GenericAttributeTests.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/src/reflection/GenericAttribute/GenericAttributeTests.cs b/tests/src/reflection/GenericAttribute/GenericAttributeTests.cs
index 762f011fae..f9305706fb 100644
--- a/tests/src/reflection/GenericAttribute/GenericAttributeTests.cs
+++ b/tests/src/reflection/GenericAttribute/GenericAttributeTests.cs
@@ -133,6 +133,22 @@ class Program
var b8 = ((ICustomAttributeProvider)programTypeInfo).GetCustomAttributes(typeof(MultiAttribute<bool?>), true);
AssertAny(b8, a => (a as MultiAttribute<bool?>)?.Value == null);
+ var a9 = CustomAttributeExtensions.GetCustomAttributes<MultiAttribute<string>>(programTypeInfo, true);
+ AssertAny(a9, a => (a as MultiAttribute<string>)?.Value == "Ctor");
+ AssertAny(a9, a => (a as MultiAttribute<string>)?.Value == "Property");
+
+ var b9 = ((ICustomAttributeProvider)programTypeInfo).GetCustomAttributes(typeof(MultiAttribute<string>), true);
+ AssertAny(b9, a => (a as MultiAttribute<string>)?.Value == "Ctor");
+ AssertAny(b9, a => (a as MultiAttribute<string>)?.Value == "Property");
+
+ var a10 = CustomAttributeExtensions.GetCustomAttributes<MultiAttribute<Type>>(programTypeInfo, true);
+ AssertAny(a10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class));
+ AssertAny(a10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class.Derive));
+
+ var b10 = ((ICustomAttributeProvider)programTypeInfo).GetCustomAttributes(typeof(MultiAttribute<Type>), true);
+ AssertAny(b10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class));
+ AssertAny(b10, a => (a as MultiAttribute<Type>)?.Value == typeof(Class.Derive));
+
Assert(CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), false) == null);
Assert(CustomAttributeExtensions.GetCustomAttributes(programTypeInfo, typeof(MultiAttribute<>), true) == null);
Assert(!((ICustomAttributeProvider)programTypeInfo).GetCustomAttributes(typeof(MultiAttribute<>), true).GetEnumerator().MoveNext());