@@ -503,6 +503,7 @@ class TestNSData: LoopbackServerTest {
503
503
( " test_validateMutation_slice_customBacking_withUnsafeMutableBytes_lengthLessThanLowerBound " , test_validateMutation_slice_customBacking_withUnsafeMutableBytes_lengthLessThanLowerBound) ,
504
504
( " test_validateMutation_slice_customMutableBacking_withUnsafeMutableBytes_lengthLessThanLowerBound " ,
505
505
test_validateMutation_slice_customMutableBacking_withUnsafeMutableBytes_lengthLessThanLowerBound) ,
506
+ ( " test_nskeyedarchiving " , test_nskeyedarchiving) ,
506
507
( " test_discontiguousEnumerateBytes " , test_discontiguousEnumerateBytes) ,
507
508
( " testBridgingCustom " , testBridgingCustom) ,
508
509
( " testCustomData " , testCustomData) ,
@@ -4452,5 +4453,18 @@ extension TestNSData {
4452
4453
let range = slice. range ( of: " a " . data ( using: . ascii) !)
4453
4454
XCTAssertEqual ( range, Range < Data . Index > ( 4 ..< 5 ) )
4454
4455
}
4456
+
4457
+ func test_nskeyedarchiving( ) {
4458
+ let bytes : [ UInt8 ] = [ 0xd , 0xe , 0xa , 0xd , 0xb , 0xe , 0xe , 0xf ]
4459
+ let data = NSData ( bytes: bytes, length: bytes. count)
4460
+
4461
+ let archiver = NSKeyedArchiver ( )
4462
+ data. encode ( with: archiver)
4463
+ let encodedData = archiver. encodedData
4464
+
4465
+ let unarchiver = NSKeyedUnarchiver ( forReadingWith: encodedData)
4466
+ let decodedData = NSData ( coder: unarchiver)
4467
+ XCTAssertEqual ( data, decodedData)
4468
+ }
4455
4469
}
4456
4470
0 commit comments