Skip to content

Implementation of NSURLCredential.copy(with:) #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Foundation/NSURLCredential.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ open class URLCredential : NSObject, NSSecureCoding, NSCopying {
}

open func copy(with zone: NSZone? = nil) -> Any {
NSUnimplemented()
return self
}

/*!
Expand Down
9 changes: 8 additions & 1 deletion TestFoundation/TestNSURLCredential.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class TestNSURLCredential : XCTestCase {

static var allTests: [(String, (TestNSURLCredential) -> () throws -> Void)] {
return [
("test_construction", test_construction)
("test_construction", test_construction),
("test_copy", test_copy)
]
}

Expand All @@ -32,4 +33,10 @@ class TestNSURLCredential : XCTestCase {
XCTAssertEqual(credential.persistence, URLCredential.Persistence.forSession)
XCTAssertEqual(credential.hasPassword, true)
}

func test_copy() {
let credential = URLCredential(user: "swiftUser", password: "swiftPassword", persistence: .forSession)
let copy = credential.copy() as! URLCredential
XCTAssertTrue(copy.isEqual(credential))
}
}