@@ -21,12 +21,15 @@ public static void TestGetEnumUnderlyingType()
2121 AssertEquals ( typeof ( long ) , typeof ( LongEnum ) . GetEnumUnderlyingType ( ) ) ;
2222 AssertEquals ( typeof ( ulong ) , typeof ( ULongEnum ) . GetEnumUnderlyingType ( ) ) ;
2323
24- AssertEquals ( typeof ( char ) , typeof ( CharEnum ) . GetEnumUnderlyingType ( ) ) ;
25- AssertEquals ( typeof ( bool ) , typeof ( BoolEnum ) . GetEnumUnderlyingType ( ) ) ;
26- AssertEquals ( typeof ( float ) , typeof ( FloatEnum ) . GetEnumUnderlyingType ( ) ) ;
27- AssertEquals ( typeof ( double ) , typeof ( DoubleEnum ) . GetEnumUnderlyingType ( ) ) ;
28- AssertEquals ( typeof ( nint ) , typeof ( IntPtrEnum ) . GetEnumUnderlyingType ( ) ) ;
29- AssertEquals ( typeof ( nuint ) , typeof ( UIntPtrEnum ) . GetEnumUnderlyingType ( ) ) ;
24+ if ( TestLibrary . PlatformDetection . IsRareEnumsSupported )
25+ {
26+ AssertEquals ( typeof ( char ) , typeof ( CharEnum ) . GetEnumUnderlyingType ( ) ) ;
27+ AssertEquals ( typeof ( bool ) , typeof ( BoolEnum ) . GetEnumUnderlyingType ( ) ) ;
28+ AssertEquals ( typeof ( float ) , typeof ( FloatEnum ) . GetEnumUnderlyingType ( ) ) ;
29+ AssertEquals ( typeof ( double ) , typeof ( DoubleEnum ) . GetEnumUnderlyingType ( ) ) ;
30+ AssertEquals ( typeof ( nint ) , typeof ( IntPtrEnum ) . GetEnumUnderlyingType ( ) ) ;
31+ AssertEquals ( typeof ( nuint ) , typeof ( UIntPtrEnum ) . GetEnumUnderlyingType ( ) ) ;
32+ }
3033
3134 AssertThrowsArgumentException ( ( ) => typeof ( int ) . GetEnumUnderlyingType ( ) ) ;
3235 AssertThrowsArgumentException ( ( ) => typeof ( nint ) . GetEnumUnderlyingType ( ) ) ;
@@ -43,12 +46,15 @@ public static void TestGetEnumUnderlyingType()
4346 AssertEquals ( typeof ( long ) , NoInline ( typeof ( LongEnum ) . GetEnumUnderlyingType ( ) ) ) ;
4447 AssertEquals ( typeof ( ulong ) , NoInline ( typeof ( ULongEnum ) . GetEnumUnderlyingType ( ) ) ) ;
4548
46- AssertEquals ( typeof ( char ) , NoInline ( typeof ( CharEnum ) . GetEnumUnderlyingType ( ) ) ) ;
47- AssertEquals ( typeof ( bool ) , NoInline ( typeof ( BoolEnum ) . GetEnumUnderlyingType ( ) ) ) ;
48- AssertEquals ( typeof ( float ) , NoInline ( typeof ( FloatEnum ) . GetEnumUnderlyingType ( ) ) ) ;
49- AssertEquals ( typeof ( double ) , NoInline ( typeof ( DoubleEnum ) . GetEnumUnderlyingType ( ) ) ) ;
50- AssertEquals ( typeof ( nint ) , NoInline ( typeof ( IntPtrEnum ) . GetEnumUnderlyingType ( ) ) ) ;
51- AssertEquals ( typeof ( nuint ) , NoInline ( typeof ( UIntPtrEnum ) . GetEnumUnderlyingType ( ) ) ) ;
49+ if ( TestLibrary . PlatformDetection . IsRareEnumsSupported )
50+ {
51+ AssertEquals ( typeof ( char ) , NoInline ( typeof ( CharEnum ) . GetEnumUnderlyingType ( ) ) ) ;
52+ AssertEquals ( typeof ( bool ) , NoInline ( typeof ( BoolEnum ) . GetEnumUnderlyingType ( ) ) ) ;
53+ AssertEquals ( typeof ( float ) , NoInline ( typeof ( FloatEnum ) . GetEnumUnderlyingType ( ) ) ) ;
54+ AssertEquals ( typeof ( double ) , NoInline ( typeof ( DoubleEnum ) . GetEnumUnderlyingType ( ) ) ) ;
55+ AssertEquals ( typeof ( nint ) , NoInline ( typeof ( IntPtrEnum ) . GetEnumUnderlyingType ( ) ) ) ;
56+ AssertEquals ( typeof ( nuint ) , NoInline ( typeof ( UIntPtrEnum ) . GetEnumUnderlyingType ( ) ) ) ;
57+ }
5258
5359 AssertThrowsArgumentException ( ( ) => NoInline ( typeof ( int ) . GetEnumUnderlyingType ( ) ) ) ;
5460 AssertThrowsArgumentException ( ( ) => NoInline ( typeof ( nint ) . GetEnumUnderlyingType ( ) ) ) ;
0 commit comments