Skip to content

Replace XCTAssertNotNil with enhanced tests on TestDate and TestTimer #1523

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
Apr 19, 2018

Conversation

otaviolima
Copy link
Contributor

@otaviolima otaviolima commented Apr 18, 2018

Similar to #1516 but in cases where simply removing the XCTAssertNotNil would not bring any benefit or even harm the test suite.

}

func test_descriptionWithLocale() {
let d = NSDate(timeIntervalSince1970: 0)
XCTAssertEqual(d.description(with: nil), "1970-01-01 00:00:00 +0000")
XCTAssertNotNil(d.description(with: Locale(identifier: "ja_JP")))
XCTAssertEqual(d.description(with: Locale(identifier: "en_US")), "Thursday, January 1, 1970 at 12:00:00 AM Greenwich Mean Time")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We explicitly did not want to test the exact string output here because it can change from time to time due to formatting differences.

Copy link
Contributor Author

@otaviolima otaviolima Apr 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe XCTAssert(d.description(with: Locale(identifier: "ja_JP")) != "") then? Or Just keep the old code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps we could use en_US_POSIX locale as it should not change it's formatting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with checking that isEmpty is false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@otaviolima otaviolima force-pushed the enhance-timer-date-tests branch from 9db658a to ca5f395 Compare April 19, 2018 07:32
@parkera
Copy link
Contributor

parkera commented Apr 19, 2018

@swift-ci test and merge

@swift-ci swift-ci merged commit 57305f9 into swiftlang:master Apr 19, 2018
@otaviolima otaviolima deleted the enhance-timer-date-tests branch April 19, 2018 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants