Skip to content

Commit 8705f6d

Browse files
authored
Make the locale checking test more robust (check that the locale is valid rather than checking against a specific locale) (#411)
1 parent 1750b7e commit 8705f6d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/platform/swift/unit_integration/core/DeviceAttributesTests.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ final class DeviceAttributesTests: XCTestCase {
1313
func testLocale() {
1414
let deviceAttributes = DeviceAttributes()
1515
// Confirm that attributes are initialized with the `locale` field value.
16-
XCTAssertEqual("en_US", deviceAttributes.getFields()["_locale"] as? String)
16+
let localeStr = deviceAttributes.getFields()["_locale"] as! String
17+
XCTAssertNotNil(Locale(identifier: localeStr))
1718

1819
deviceAttributes.start()
1920
// Confirm that the `locale` field looks OK after starting device attributes.
20-
XCTAssertEqual("en_US", deviceAttributes.getFields()["_locale"] as? String)
21+
let nowLocaleStr = deviceAttributes.getFields()["_locale"] as! String
22+
XCTAssertNotNil(Locale(identifier: nowLocaleStr))
23+
24+
// And is the same as before.
25+
XCTAssertEqual(localeStr, nowLocaleStr)
2126
}
2227
}

0 commit comments

Comments
 (0)