@@ -32,6 +32,7 @@ class TestHTTPCookieStorage: XCTestCase {
32
32
( " test_cookiesForURL " , test_cookiesForURL) ,
33
33
( " test_cookiesForURLWithMainDocumentURL " , test_cookiesForURLWithMainDocumentURL) ,
34
34
( " test_cookieInXDGSpecPath " , test_cookieInXDGSpecPath) ,
35
+ ( " test_descriptionCookie " , test_descriptionCookie)
35
36
]
36
37
}
37
38
@@ -90,6 +91,11 @@ class TestHTTPCookieStorage: XCTestCase {
90
91
setCookiesForURLWithMainDocumentURL ( with: . groupContainer( " test " ) )
91
92
}
92
93
94
+ func test_descriptionCookie( ) {
95
+ descriptionCookie ( with: . shared)
96
+ descriptionCookie ( with: . groupContainer( " test " ) )
97
+ }
98
+
93
99
func getStorage( for type: _StorageType ) -> HTTPCookieStorage {
94
100
switch type {
95
101
case . shared:
@@ -246,6 +252,23 @@ class TestHTTPCookieStorage: XCTestCase {
246
252
XCTAssertEqual ( storage. cookies ( for: url1!) !. count, 0 )
247
253
}
248
254
255
+ func descriptionCookie( with storageType: _StorageType ) {
256
+ let storage = getStorage ( for: storageType)
257
+ XCTAssertEqual ( storage. description, " <NSHTTPCookieStorage cookies count: \( storage. cookies!. count) > " )
258
+
259
+ let simpleCookie = HTTPCookie ( properties: [
260
+ . name: " TestCookie1 " ,
261
+ . value: " Test value @#$%^$&*99 " ,
262
+ . path: " / " ,
263
+ . domain: " swift.org " ,
264
+ . expires: Date ( timeIntervalSince1970: Date ( ) . timeIntervalSince1970 + 1000 )
265
+ ] ) !
266
+ storage. setCookie ( simpleCookie)
267
+ XCTAssertEqual ( storage. description, " <NSHTTPCookieStorage cookies count: \( storage. cookies!. count) > " )
268
+ storage. deleteCookie ( simpleCookie)
269
+ XCTAssertEqual ( storage. description, " <NSHTTPCookieStorage cookies count: \( storage. cookies!. count) > " )
270
+ }
271
+
249
272
func test_cookieInXDGSpecPath( ) {
250
273
#if !os(Android) && !DARWIN_COMPATIBILITY_TESTS
251
274
//Test without setting the environment variable
0 commit comments