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

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-10-29 03:23:43 +0300
committerGitHub <noreply@github.com>2016-10-29 03:23:43 +0300
commit33b31eaf00065279530a8affddf2dc5dc76d1d8e (patch)
tree0649bcea79a7614baa309d7e735b0068adc6aac2 /src/System.Runtime.CompilerServices.Unsafe/tests
parent2e67b517fb16213c9d62c229ed6d5dad42366685 (diff)
Enable S.R.CS.Unsafe tests that depend on ref locals and returns (#13141)
Fix #6505
Diffstat (limited to 'src/System.Runtime.CompilerServices.Unsafe/tests')
-rw-r--r--src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs b/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs
index 1385fbe442..ba6ecb1737 100644
--- a/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs
+++ b/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs
@@ -418,9 +418,6 @@ namespace System.Runtime.CompilerServices
Assert.Equal(new IntPtr(-3), Unsafe.ByteOffset(ref byte4.B3, ref byte4.B0));
}
- // Active Issue: https://github.com/dotnet/coreclr/issues/6505
- // These tests require C# compiler with support for ref returns and locals
-#if false
[Fact]
public unsafe static void AsRef()
{
@@ -473,7 +470,7 @@ namespace System.Runtime.CompilerServices
ref int r2 = ref Unsafe.Add(ref r1, (IntPtr)2);
Assert.Equal(0x456, r2);
- ref int r3 = ref Unsafe.Add(ref r2, (IntPtr)-3);
+ ref int r3 = ref Unsafe.Add(ref r2, (IntPtr)(-3));
Assert.Equal(0x123, r3);
}
@@ -482,13 +479,13 @@ namespace System.Runtime.CompilerServices
{
byte[] a = new byte[] { 0x12, 0x34, 0x56, 0x78 };
- ref int r1 = ref Unsafe.AddByteOffset(ref a[0], (IntPtr)1);
+ ref byte r1 = ref Unsafe.AddByteOffset(ref a[0], (IntPtr)1);
Assert.Equal(0x34, r1);
- ref int r2 = ref Unsafe.AddByteOffset(ref r1, (IntPtr)2);
+ ref byte r2 = ref Unsafe.AddByteOffset(ref r1, (IntPtr)2);
Assert.Equal(0x78, r2);
- ref int r3 = ref Unsafe.AddByteOffset(ref r2, (IntPtr) - 3);
+ ref byte r3 = ref Unsafe.AddByteOffset(ref r2, (IntPtr)(-3));
Assert.Equal(0x12, r3);
}
@@ -512,10 +509,10 @@ namespace System.Runtime.CompilerServices
{
string[] a = new string[] { "abc", "def", "ghi", "jkl" };
- ref string r1 = ref Unsafe.Subtract(ref a[0], (IntPtr)-2);
+ ref string r1 = ref Unsafe.Subtract(ref a[0], (IntPtr)(-2));
Assert.Equal("ghi", r1);
- ref string r2 = ref Unsafe.Subtract(ref r1, (IntPtr)-1);
+ ref string r2 = ref Unsafe.Subtract(ref r1, (IntPtr)(-1));
Assert.Equal("jkl", r2);
ref string r3 = ref Unsafe.Subtract(ref r2, (IntPtr)3);
@@ -527,13 +524,13 @@ namespace System.Runtime.CompilerServices
{
byte[] a = new byte[] { 0x12, 0x34, 0x56, 0x78 };
- ref int r1 = ref Unsafe.SubtractByteOffset(ref a[0], (IntPtr)-1);
+ ref byte r1 = ref Unsafe.SubtractByteOffset(ref a[0], (IntPtr)(-1));
Assert.Equal(0x34, r1);
- ref int r2 = ref Unsafe.SubtractByteOffset(ref r1, (IntPtr)-2);
+ ref byte r2 = ref Unsafe.SubtractByteOffset(ref r1, (IntPtr)(-2));
Assert.Equal(0x78, r2);
- ref int r3 = ref Unsafe.SubtractByteOffset(ref r2, (IntPtr)3);
+ ref byte r3 = ref Unsafe.SubtractByteOffset(ref r2, (IntPtr)3);
Assert.Equal(0x12, r3);
}
@@ -545,7 +542,6 @@ namespace System.Runtime.CompilerServices
Assert.True(Unsafe.AreSame(ref a[0], ref a[0]));
Assert.False(Unsafe.AreSame(ref a[0], ref a[1]));
}
-#endif
}
[StructLayout(LayoutKind.Explicit)]