Skip to content

Commit 229025d

Browse files
e78lparkera
authored andcommitted
Incorporate NSHTTPCookieStorage changes (#1036)
1 parent e371a63 commit 229025d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

TestFoundation/TestNSHTTPCookieStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class TestNSHTTPCookieStorage: XCTestCase {
247247
task.launchPath = bundlePath.substring(to: pathIndex!) + "/xdgTestHelper/xdgTestHelper"
248248
var environment = ProcessInfo.processInfo.environment
249249
let testPath = NSHomeDirectory() + "/TestXDG"
250-
environment["XDG_CONFIG_HOME"] = testPath
250+
environment["XDG_DATA_HOME"] = testPath
251251
task.environment = environment
252252
// Launch the task
253253
task.launch()

TestFoundation/XDGTestHelper.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,28 @@ class XDGCheck {
1717

1818
static func run() -> Never {
1919
let storage = HTTPCookieStorage.shared
20-
let properties = [
21-
HTTPCookiePropertyKey.name: "TestCookie",
22-
HTTPCookiePropertyKey.value: "Test @#$%^$&*99",
23-
HTTPCookiePropertyKey.path: "/",
24-
HTTPCookiePropertyKey.domain: "example.com",
25-
]
20+
let properties: [HTTPCookiePropertyKey: String] = [
21+
.name: "TestCookie",
22+
.value: "Test @#$%^$&*99",
23+
.path: "/",
24+
.domain: "example.com",
25+
]
2626
let simpleCookie = HTTPCookie(properties: properties)
2727
guard simpleCookie != nil else {
2828
exit(HelperCheckStatus.cookieStorageNil.rawValue)
2929
}
30-
let rawValue = getenv("XDG_CONFIG_HOME")
30+
let rawValue = getenv("XDG_DATA_HOME")
3131
guard rawValue != nil else {
3232
exit(HelperCheckStatus.fail.rawValue)
3333
}
34-
let xdg_config_home = String(utf8String: rawValue!)
34+
let xdg_data_home = String(utf8String: rawValue!)
3535
storage.setCookie(simpleCookie!)
3636
let fm = FileManager.default
37-
let destPath = xdg_config_home! + "/.cookies.shared"
37+
let destPath = xdg_data_home! + "/xdgTestHelper/.cookies.shared"
3838
var isDir = false
3939
let exists = fm.fileExists(atPath: destPath, isDirectory: &isDir)
4040
if (!exists) {
41+
print("Expected cookie path: ", destPath)
4142
exit(HelperCheckStatus.cookieStorePathWrong.rawValue)
4243
}
4344
exit(HelperCheckStatus.ok.rawValue)

0 commit comments

Comments
 (0)