Skip to content

[SR-10574] Add tests for new Japanese calendar era name #2200

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

Conversation

novi
Copy link
Contributor

@novi novi commented Apr 30, 2019

  • Add Calendar test
  • Add DateFormatter test

Test Calendar and DateFormatter with new era name (SR-10574).
Related swiftlang/swift#24387.

@ianpartridge
Copy link
Contributor

@swift-ci test

@novi
Copy link
Contributor Author

novi commented Apr 30, 2019

Reiwa(令和) era has just begun 😄.

// format test
let dateString = formatter.string(from: Date(timeIntervalSince1970: 1556633400)) // April 30, 2019, 11:10 PM (JST)
XCTAssertEqual(dateString, "平成31年4月30日 23:10")
// Disabled until the ICU is updated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you enable these tests please. I just want to check they fail with the current ICU so then they pass with the new ICU we know its all working correctly, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@spevans This following codes require ICU 64.2. It should be enabled?
And if the ICU is 64.2, L448-L457 will fail. This lines for ICU 61.2.

Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot commit tests that fail.

If you want, you can replace the do block with if shouldAttemptXFailTests("These tests require ICU 64.2 or later. https://bugs.swift.org/browse/SR-XXXX") { … } where the XXXX link is a bug filed on bugs.swift.org to migrate to newer ICU. @spevans, you can then run this test by setting the environment variable NS_FOUNDATION_ATTEMPT_XFAIL_TESTS to YES.

do {
let date = Date(timeIntervalSince1970: 1556633400) // April 30, 2019
let components = calendar.dateComponents([.era, .year, .month, .day], from: date)
XCTAssertEqual(calendar.eraSymbols[components.era!], "Heisei")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this assuming a particular current locale?

@spevans
Copy link
Contributor

spevans commented Apr 30, 2019

This is to be tested with swiftlang/swift#24387

@novi
Copy link
Contributor Author

novi commented May 1, 2019

I fixed some lines of the test.

  • Avoid using force unwrapping
  • Add a Locale to the Calendar test
  • Replace the block for ICU 64.2

Is it okay? Would we these commits combine into a single commit?

@spevans
Copy link
Contributor

spevans commented May 1, 2019

Yes, if you could, can rebase squash them into one commit, thanks.

@novi novi force-pushed the add-test-for-japanese-calendar-era-name-icu-61.2 branch from ae737c1 to 70d8d97 Compare May 1, 2019 07:05
@novi
Copy link
Contributor Author

novi commented May 1, 2019

It seems to be okay.

@spevans
Copy link
Contributor

spevans commented May 1, 2019

@swift-ci test

@millenomi
Copy link
Contributor

@swift-ci please test

@spevans
Copy link
Contributor

spevans commented May 1, 2019

Please test with the following pull request:
swiftlang/swift#24387

@swift-ci test linux

@spevans
Copy link
Contributor

spevans commented May 2, 2019

@ianpartridge It looks like the CI isnt pulling in the new version of ICU when doing update-checkout but I dont know what the fix for that is.

@ianpartridge
Copy link
Contributor

Yeah I'm not sure there is one. It looks like it decides which release of ICU to use before it looks at my PR :( Maybe we'll have to merge then test?

@millenomi
Copy link
Contributor

@shahmishal Can you look into why CI isn't pulling the new updated ICU from the associated Swift PR?

@shahmishal
Copy link
Member

Please test with the following pull request:
swiftlang/swift#24387

@swift-ci test linux

@novi
Copy link
Contributor Author

novi commented May 8, 2019

The test crashes on something related CF and Foundation bridges.
Does anyone know why this error is caused?

@novi
Copy link
Contributor Author

novi commented May 8, 2019

I found that Calendar.eraSymbols for any calendars cause crash with following code on Swift version 5.0.1 (swift-5.0.1-RELEASE) (Docker image tagged swift:bionic ) .

import Foundation
let cal = Calendar(identifier: .gregorian)
cal.eraSymbols

@spevans
Copy link
Contributor

spevans commented May 8, 2019

@novi, could you open a bug for that issue please. The actual error for it is:

Could not cast value of type 'Foundation._NSCFArray' (0x7fcaf94d7660) to '__C.CFArrayRef' (0x7fcaf94b3b80).

Caused by this line in NSCalendar.swift:

let result = (CFDateFormatterCopyProperty(dateFormatter, key) as! CFArray)._swiftObject

Thanks

@novi
Copy link
Contributor Author

novi commented May 8, 2019

@spevans I submitted an issue. SR-10638

This pull request would be continued after the bug is fixed.

@YOCKOW
Copy link
Member

YOCKOW commented Jun 8, 2019

@novi SR-10638 seems to be resolved. Could you go ahead if there is something to do?

@novi
Copy link
Contributor Author

novi commented Jun 8, 2019

@YOCKOW Thanks. That's great.

@spevans @millenomi Could we test this pull request again?

@ianpartridge
Copy link
Contributor

@swift-ci test

@novi
Copy link
Contributor Author

novi commented Jun 9, 2019

@ianpartridge Thanks. Would it be tested with swiftlang/swift#24387 ?

@ikesyo
Copy link
Member

ikesyo commented Jun 9, 2019

swiftlang/swift#24387

@swift-ci Please test

@novi
Copy link
Contributor Author

novi commented Jun 19, 2019

It seems to be not tested with swiftlang/swift#24387. Would it be tested with that?

@ikesyo
Copy link
Member

ikesyo commented Jun 19, 2019

@swift-ci Please test with the following pull request

swiftlang/swift#24387

@novi
Copy link
Contributor Author

novi commented Jun 25, 2019

Thanks, but the latest testing is 15 days ago. Could we have any ideas?

@spevans
Copy link
Contributor

spevans commented Nov 16, 2019

@swift-ci test linux

@spevans
Copy link
Contributor

spevans commented Nov 17, 2019

@novi Now that ICU has been updated to 65.1 in swiftlang/swift#27937 if you could update this test to use XCTUnwrap instead of unwrapped() and remove the shouldAttemptXFailTests then this should be ok for merging, thanks.

@novi novi force-pushed the add-test-for-japanese-calendar-era-name-icu-61.2 branch from 70d8d97 to e0cc72e Compare November 21, 2019 06:40
@novi
Copy link
Contributor Author

novi commented Nov 21, 2019

@spevans The tests is updated for ICU 65.1. (A branch name of my fork includes 61.2, but we could merge this PR anyway.)

@spevans
Copy link
Contributor

spevans commented Nov 21, 2019

@swift-ci test

@novi
Copy link
Contributor Author

novi commented Jan 21, 2020

Could you merge this pull request? I would update to resolve this conflicts before merge.

@spevans
Copy link
Contributor

spevans commented Jan 21, 2020

Yes please rebase it and then it can be merged. ICU has been updated to 65.1 now so the tests should now pass.

@novi novi force-pushed the add-test-for-japanese-calendar-era-name-icu-61.2 branch from e0cc72e to dde1c44 Compare January 22, 2020 08:02
@novi
Copy link
Contributor Author

novi commented Jan 22, 2020

@spevans Thanks. I have rebased it and the base is up to date.

@@ -111,6 +111,31 @@ class TestCalendar: XCTestCase {
XCTAssertEqual(components.day, 18)

}

func test_gettingDatesOnJapaneseCalendar() throws {
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need to add this test into the list of tests at the end of the file, Linux and TestFoundation doesnt automatically pick up tests as happens on macOS. If you can squash that change in we can get this merged, thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@spevans Sure. Fixed it. Now, It seems be okay.

@novi novi force-pushed the add-test-for-japanese-calendar-era-name-icu-61.2 branch from dde1c44 to ddeeecb Compare January 22, 2020 18:01
@spevans
Copy link
Contributor

spevans commented Jan 22, 2020

@swift-ci test and merge

- Add Calendar test
- Add DateFormatter test
@novi novi force-pushed the add-test-for-japanese-calendar-era-name-icu-61.2 branch from ddeeecb to 0bfcda9 Compare March 12, 2020 08:28
@novi
Copy link
Contributor Author

novi commented Mar 12, 2020

@spevans Hello, will it be tested? I have resolved the conflicts.

@spevans
Copy link
Contributor

spevans commented Mar 12, 2020

@swift-ci test linux

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.

7 participants