File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -407,6 +407,18 @@ UnsafeRawBufferPointerTestSuite.test("subscript.range.wide") {
407
407
buffer [ 0 ..< 2 ] = buffer [ 0 ..< 3 ]
408
408
}
409
409
410
+ UnsafeRawBufferPointerTestSuite . test ( " _copyContents " ) {
411
+ let a = Array < UInt8 > ( 0 ..< 20 )
412
+ let b = UnsafeMutableBufferPointer< UInt8> . allocate( capacity: 10 * a. count)
413
+ defer { b. deallocate ( ) }
414
+ var ( unwritten, written) = a. withUnsafeBytes {
415
+ bytes in
416
+ bytes. _copyContents ( initializing: b)
417
+ }
418
+ expectNil ( unwritten. next ( ) )
419
+ expectEqual ( written, a. count)
420
+ }
421
+
410
422
UnsafeRawBufferPointerTestSuite . test ( " copyMemory.overflow " ) {
411
423
var buffer = UnsafeMutableRawBufferPointer . allocate ( byteCount: 3 , alignment: MemoryLayout< UInt> . alignment)
412
424
defer { buffer. deallocate ( ) }
You can’t perform that action at this time.
0 commit comments