Skip to content

Commit

Permalink
[tests] Attempt to enable test (#89498)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrzVlad authored Aug 8, 2023
1 parent bcf9938 commit 03816d2
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions src/libraries/System.Runtime/tests/System/TypedReferenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,34 +78,31 @@ public static void MakeTypedReference_ToObjectTests()
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()
Expand Down

0 comments on commit 03816d2

Please sign in to comment.