Last active
April 13, 2018 08:32
-
-
Save akuraru/f19d883536dd4e71d979f881d9d82a47 to your computer and use it in GitHub Desktop.
そのうち壊れるテスト書いた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
class HeiseiTests: XCTestCase { | |
func test平成じゃない() { | |
let calendar = Calendar(identifier: .japanese) | |
let component = DateComponents( | |
calendar: calendar, | |
timeZone: nil, | |
era: 235, // 平成 | |
year: 31, | |
month: 5, // この日から元号が変わる | |
day: 1 | |
) | |
let date = component.date! | |
let year = calendar.dateComponents([.year], from: date).year | |
XCTAssert(year == 31) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment