Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2019-10-04 19:31:40 +0300
committerMarek Safar <marek.safar@gmail.com>2019-10-07 12:39:34 +0300
commitab3667782f32459bd44bcea906b4a16b151a4b5a (patch)
tree3d13bf4d8db81cc0b86762db0e9290a190ae885d /test/Mono.Linker.Tests.Cases/ComponentModel
parente8fea0e48e63e3e5706246b28efd6ef935c5c58c (diff)
Add simple detection for custom TypeConvertors
Contributes to #153
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/ComponentModel')
-rw-r--r--test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs b/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs
new file mode 100644
index 000000000..4f94ed07e
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs
@@ -0,0 +1,68 @@
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+using Mono.Linker.Tests.Cases.Expectations.Metadata;
+
+namespace Mono.Linker.Tests.Cases.ComponentModel
+{
+ [TypeConverter (typeof (Custom1))]
+
+ [Kept]
+ [KeptAttributeAttribute (typeof (TypeConverterAttribute))]
+ class CustomDataType
+ {
+ [Kept]
+ [KeptBaseType (typeof (TypeConverter))]
+ class Custom1 : TypeConverter
+ {
+ [Kept]
+ public Custom1 (Type type)
+ {
+ }
+
+ [Kept]
+ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ return "test";
+ }
+ }
+ }
+
+ [TypeConverter ("Mono.Linker.Tests.Cases.ComponentModel.CustomDataType_2/Custom2")]
+
+ [Kept]
+ [KeptAttributeAttribute (typeof (TypeConverterAttribute))]
+ class CustomDataType_2
+ {
+ [Kept]
+ [KeptBaseType (typeof (TypeConverter))]
+ class Custom2 : TypeConverter
+ {
+ [Kept]
+ public Custom2 ()
+ {
+ }
+
+ [Kept]
+ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ return "test";
+ }
+ }
+ }
+
+ [Reference ("System.dll")]
+ public class CustomTypeConvertor
+ {
+ public static void Main ()
+ {
+ var tc1 = TypeDescriptor.GetConverter (typeof (CustomDataType));
+ var res1 = tc1.ConvertFromString ("from");
+
+ var tc2 = TypeDescriptor.GetConverter (typeof (CustomDataType_2));
+ var res2 = tc2.ConvertFromString ("from");
+
+ }
+ }
+}