Skip to content

Instantly share code, notes, and snippets.

@mattmassicotte
Last active January 11, 2021 16:01
Show Gist options
  • Save mattmassicotte/e2462f0338937fab6e468192ea5a8fa9 to your computer and use it in GitHub Desktop.
Save mattmassicotte/e2462f0338937fab6e468192ea5a8fa9 to your computer and use it in GitHub Desktop.
func testCurrentYearAppearsInInfoPlistCopyright() throws {
let bundle = Bundle(for: AppDelegate.self)
let plist = try XCTUnwrap(bundle.localizedInfoDictionary)
let string = try XCTUnwrap(plist["NSHumanReadableCopyright"] as? String)
let formatter = DateFormatter()
formatter.dateFormat = "yyyy"
let currentYear = formatter.string(from: Date())
XCTAssert(string.contains(currentYear))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment