Skip to content

Commit 1d874d7

Browse files
committed
Add (disabled) test for NSUUID NSCoding
1 parent 3b3d540 commit 1d874d7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Foundation/NSUUID.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public class NSUUID : NSObject, NSCopying, NSSecureCoding, NSCoding {
6060
}
6161

6262
public required init?(coder: NSCoder) {
63-
63+
NSUnimplemented()
6464
}
6565

6666
public func encodeWithCoder(aCoder: NSCoder) {
67-
67+
NSUnimplemented()
6868
}
6969

7070
public override func isEqual(object: AnyObject?) -> Bool {

TestFoundation/TestNSUUID.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class TestNSUUID : XCTestCase {
2626
("test_InitializationWithNil", test_InitializationWithNil),
2727
("test_UUIDString", test_UUIDString),
2828
("test_description", test_description),
29+
// Disabled until NSKeyedArchiver and NSKeyedUnarchiver are implemented
30+
// ("test_NSCoding", test_NSCoding),
2931
]
3032
}
3133

@@ -59,4 +61,10 @@ class TestNSUUID : XCTestCase {
5961
let uuid = NSUUID()
6062
XCTAssertEqual(uuid.description, uuid.UUIDString, "The description must be the same as the UUIDString.")
6163
}
64+
65+
func test_NSCoding() {
66+
let uuidA = NSUUID()
67+
let uuidB = NSKeyedUnarchiver.unarchiveObjectWithData(NSKeyedArchiver.archivedDataWithRootObject(uuidA)) as! NSUUID
68+
XCTAssertEqual(uuidA, uuidB, "Archived then unarchived uuid must be equal.")
69+
}
6270
}

0 commit comments

Comments
 (0)