-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Extend URLResponse tests #2035
Extend URLResponse tests #2035
Conversation
Let's kicking CI. @swift-ci Please test. |
Yes, I did change it to -1 but going to add the 0 test back in, thanks for the reply!
… Am 23.03.2019 um 18:08 schrieb Simon Evans ***@***.***>:
@spevans commented on this pull request.
In TestFoundation/TestURLResponse.swift:
> - let url = URL(string: "test")!
- let res1 = URLResponse(url: url, mimeType: "text/plain", expectedContentLength: zeroContentLength, textEncodingName: nil)
- XCTAssertEqual(res1.expectedContentLength, Int64(zeroContentLength), "should be Int65 of the zero length")
- let res2 = URLResponse(url: url, mimeType: "text/plain", expectedContentLength: positiveContentLength, textEncodingName: nil)
- XCTAssertEqual(res2.expectedContentLength, Int64(positiveContentLength), "should be Int64 of the positive content length")
+
+ func test_MIMEType_notAvailable() {
+ let mimetype: String? = nil
+ let res = URLResponse(url: testURL, mimeType: mimetype, expectedContentLength: 0, textEncodingName: nil)
+ XCTAssertEqual(res.mimeType, mimetype, "should be the other mimetype")
+ }
+
+ func test_ExpectedContentLength_positive() {
+ let contentLength = 100
+ let res1 = URLResponse(url: testURL, mimeType: "text/plain", expectedContentLength: contentLength, textEncodingName: nil)
+ XCTAssertEqual(res1.expectedContentLength, Int64(contentLength), "should be positive Int64 content length")
Has the test with zeroContentLength been removed? In general we don't remove tests unless they are invalid and not required anymore, so I would just add back in the zero content length test to this test function.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Could we try the ci-tests again? |
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci test |
Is it possible that sometimes the CI doesn't execute? Seems it's still waiting for the linux swift test even though the test was triggered a day ago. |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these! ✨
This is my first rather small contribution to the swift project.
I tried to start with updating/adding a few tests for URLResponse.
Since I am still on High Sierra I was working on the 4.2 branch.
Please let me know if there is anything wrong or things I can do better next time.