diff options
author | dotnet bot <dotnet-bot@dotnetfoundation.org> | 2018-03-29 06:22:38 +0300 |
---|---|---|
committer | Ahson Khan <ahkha@microsoft.com> | 2018-03-29 06:22:38 +0300 |
commit | bb5c46859048bfcefca281d7c303540c1217da41 (patch) | |
tree | 0364eacd3d965776f59fede61ceb601e353a8ba5 /src/System.Memory/tests/Memory/Strings.cs | |
parent | 52bdd078870fb3b10ed050b0bc40391e90c9c6b0 (diff) |
Mirror changes from dotnet/coreclr (#28534)
* Adding Memory.Pin() to eventually replace Memory.Retain(bool) (#17269)
* Adding Memory.Pin() to eventually replace Memory.Retain(bool)
* Fix copy/paste error and return default for when object is null.
* Fix XML comments.
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
* Add Memory.Pin to the ref and add tests.
* Add Pin tests
* Update calls to Retain(true) to now call Pin()
* Remove extra space in tests.
* Add Pin to the ApiCompatBaseline for uapaot.
Diffstat (limited to 'src/System.Memory/tests/Memory/Strings.cs')
-rw-r--r-- | src/System.Memory/tests/Memory/Strings.cs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/System.Memory/tests/Memory/Strings.cs b/src/System.Memory/tests/Memory/Strings.cs index 6e4e0bfe05..b711179cd1 100644 --- a/src/System.Memory/tests/Memory/Strings.cs +++ b/src/System.Memory/tests/Memory/Strings.cs @@ -57,18 +57,13 @@ namespace System.MemoryTests } [Fact] - public static unsafe void Memory_Retain_ExpectedPointerValue() + public static unsafe void Memory_Pin_ExpectedPointerValue() { string input = "0123456789"; ReadOnlyMemory<char> readonlyMemory = input.AsMemory(); Memory<char> m = MemoryMarshal.AsMemory(readonlyMemory); - using (MemoryHandle h = m.Retain(pin: false)) - { - Assert.Equal(IntPtr.Zero, (IntPtr)h.Pointer); - } - - using (MemoryHandle h = m.Retain(pin: true)) + using (MemoryHandle h = m.Pin()) { GC.Collect(); fixed (char* ptr = input) |