|
|
|
@ -110,6 +110,18 @@ namespace Google.Protobuf |
|
|
|
|
Assert.AreEqual(10, bs[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void CopyFromReadOnlySpanCopiesContents() |
|
|
|
|
{ |
|
|
|
|
byte[] data = new byte[1]; |
|
|
|
|
data[0] = 10; |
|
|
|
|
ReadOnlySpan<byte> byteSpan = data; |
|
|
|
|
var bs = ByteString.CopyFrom(byteSpan); |
|
|
|
|
Assert.AreEqual(10, bs[0]); |
|
|
|
|
data[0] = 5; |
|
|
|
|
Assert.AreEqual(10, bs[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void ToByteArrayCopiesContents() |
|
|
|
|
{ |
|
|
|
@ -249,5 +261,6 @@ namespace Google.Protobuf |
|
|
|
|
var copied = byteString.Memory.ToArray(); |
|
|
|
|
CollectionAssert.AreEqual(byteString, copied); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |