Skip to content

Commit 847583e

Browse files
committed
Add test for invalid UUID
1 parent e382503 commit 847583e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

TestFoundation/TestNSUUID.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class TestNSUUID : XCTestCase {
2222
var allTests : [(String, () -> ())] {
2323
return [
2424
("test_Equality", test_Equality),
25+
("test_InvalidUUID", test_InvalidUUID),
2526
]
2627
}
2728

@@ -35,4 +36,9 @@ class TestNSUUID : XCTestCase {
3536
XCTAssertEqual(uuidA, uuidC, "A UUID initialized with a string must be equal to the same UUID initialized with its UnsafePointer<UInt8> equivalent representation.")
3637
XCTAssertNotEqual(uuidC, uuidD, "Two different UUIDs must not be equal.")
3738
}
39+
40+
func test_InvalidUUID() {
41+
let uuid = NSUUID(UUIDString: "Invalid UUID")
42+
XCTAssertNil(uuid, "The convenience initializer `init?(UUIDString string:)` must return nil for an invalid UUID string.")
43+
}
3844
}

0 commit comments

Comments
 (0)