未验证 提交 03816d24 编写于 作者: V Vlad Brezae 提交者: GitHub

[tests] Attempt to enable test (#89498)

上级 bcf9938d
......@@ -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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册