File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,13 @@ class TestNSDictionary : XCTestCase {
255
255
XCTAssertEqual ( dictionary [ 3 as NSNumber ] as? String , " k " )
256
256
}
257
257
258
+ func test_NSCoding( ) {
259
+ let original : NSDictionary = [ " foo " : " bar " ]
260
+ let encodedData = NSKeyedArchiver . archivedData ( withRootObject: original)
261
+ let decoded = NSKeyedUnarchiver . unarchiveObject ( with: encodedData) as! NSDictionary
262
+ XCTAssertEqual ( original, decoded, " Archived then unarchived `NSDictionary` must be equal. " )
263
+ }
264
+
258
265
static var allTests : [ ( String , ( TestNSDictionary ) -> ( ) throws -> Void ) ] {
259
266
return [
260
267
( " test_BasicConstruction " , test_BasicConstruction) ,
@@ -270,6 +277,7 @@ class TestNSDictionary : XCTestCase {
270
277
( " test_valueForKey " , test_valueForKey) ,
271
278
( " test_valueForKeyWithNestedDict " , test_valueForKeyWithNestedDict) ,
272
279
( " test_sharedKeySets " , test_sharedKeySets) ,
280
+ ( " test_NSCoding " , test_NSCoding) ,
273
281
]
274
282
}
275
283
}
You can’t perform that action at this time.
0 commit comments