[tests] Attempt to enable test (#89498)
authorVlad Brezae <brezaevlad@gmail.com>
Tue, 8 Aug 2023 13:30:43 +0000 (16:30 +0300)
committerGitHub <noreply@github.com>
Tue, 8 Aug 2023 13:30:43 +0000 (16:30 +0300)
src/libraries/System.Runtime/tests/System/TypedReferenceTests.cs

index 20d7235..f70176e 100644 (file)
@@ -78,34 +78,31 @@ namespace System.Tests
             Assert.Equal(structObj, TypedReference.ToObject(reference));
         }
 
-        // These tests are currently crashing the Mono AOT compiler, so commenting them out (skipping them isn't enough)
-        //[Fact]
-        //[ActiveIssue("https://github.com/dotnet/runtime/issues/70091", TestRuntimes.Mono)]
-        //public static unsafe void MakeTypedReference_ToObjectTests_WithPointer()
-        //{
-        //    float* pointer = (float*)(nuint)0x12345678;
-        //    TypedReference reference = __makeref(pointer);
-        //    object obj = TypedReference.ToObject(reference);
-        //
-        //    // TypedReference-s over pointers use the UIntPtr type when boxing
-        //    Assert.NotNull(obj);
-        //    Assert.IsType<UIntPtr>(obj);
-        //    Assert.Equal((nuint)0x12345678, (nuint)obj);
-        //}
-        //
-        //[Fact]
-        //[ActiveIssue("https://github.com/dotnet/runtime/issues/70091", TestRuntimes.Mono)]
-        //public static unsafe void MakeTypedReference_ToObjectTests_WithFunctionPointer()
-        //{
-        //    delegate*<int, float, string> pointer = (delegate*<int, float, string>)(void*)(nuint)0x12345678;
-        //    TypedReference reference = __makeref(pointer);
-        //    object obj = TypedReference.ToObject(reference);
-        //
-        //    // TypedReference-s over function pointers use the UIntPtr type when boxing
-        //    Assert.NotNull(obj);
-        //    Assert.IsType<UIntPtr>(obj);
-        //    Assert.Equal((nuint)0x12345678, (nuint)obj);
-        //}
+        [Fact]
+        public static unsafe void MakeTypedReference_ToObjectTests_WithPointer()
+        {
+            float* pointer = (float*)(nuint)0x12345678;
+            TypedReference reference = __makeref(pointer);
+            object obj = TypedReference.ToObject(reference);
+
+            // TypedReference-s over pointers use the UIntPtr type when boxing
+            Assert.NotNull(obj);
+            Assert.IsType<UIntPtr>(obj);
+            Assert.Equal((nuint)0x12345678, (nuint)obj);
+        }
+
+        [Fact]
+        public static unsafe void MakeTypedReference_ToObjectTests_WithFunctionPointer()
+        {
+            delegate*<int, float, string> pointer = (delegate*<int, float, string>)(void*)(nuint)0x12345678;
+            TypedReference reference = __makeref(pointer);
+            object obj = TypedReference.ToObject(reference);
+
+            // TypedReference-s over function pointers use the UIntPtr type when boxing
+            Assert.NotNull(obj);
+            Assert.IsType<UIntPtr>(obj);
+            Assert.Equal((nuint)0x12345678, (nuint)obj);
+        }
 
         [Fact]
         public static void MakeTypedReference_ReadOnlyField_Succeeds()