@@ -16,6 +16,7 @@ class TestNSError : XCTestCase {
1616 return [
1717 ( " test_LocalizedError_errorDescription " , test_LocalizedError_errorDescription) ,
1818 ( " test_NSErrorAsError_localizedDescription " , test_NSErrorAsError_localizedDescription) ,
19+ ( " test_NSError_inDictionary " , test_NSError_inDictionary) ,
1920 ( " test_CustomNSError_domain " , test_CustomNSError_domain) ,
2021 ( " test_CustomNSError_userInfo " , test_CustomNSError_userInfo) ,
2122 ( " test_CustomNSError_errorCode " , test_CustomNSError_errorCode) ,
@@ -39,6 +40,14 @@ class TestNSError : XCTestCase {
3940 let error = nsError as Error
4041 XCTAssertEqual ( error. localizedDescription, " Localized! " )
4142 }
43+
44+ func test_NSError_inDictionary( ) {
45+ let error = NSError ( domain: " domain " , code: 42 , userInfo: nil )
46+ let nsdictionary = [ " error " : error] as NSDictionary
47+ let dictionary = nsdictionary as? Dictionary < String , Error >
48+ XCTAssertNotNil ( dictionary)
49+ XCTAssertEqual ( error, dictionary ? [ " error " ] as NSError ? )
50+ }
4251
4352 func test_CustomNSError_domain( ) {
4453 let name = testBundleName ( )
0 commit comments