diff --git a/.circleci/config.yml b/.circleci/config.yml index 321431b893..b7e2021c62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -762,14 +762,16 @@ jobs: run-test-ios-15: executor: name: macos-executor - xcode_version: '14.3.0' + # Needs to be 15.2.0 because if not running on Swift 5.9, the tests fail + xcode_version: '15.2.0' steps: - checkout - - set-maximum-duration - install-dependencies: install_swiftlint: false - update-spm-installation-commit + - install-runtime: + runtime-name: iOS 15.5 - run: name: Run tests command: bundle exec fastlane test_ios diff --git a/Tests/UnitTests/FoundationExtensions/LocaleExtensionsTests.swift b/Tests/UnitTests/FoundationExtensions/LocaleExtensionsTests.swift index 526f8e0cfe..41aabae44c 100644 --- a/Tests/UnitTests/FoundationExtensions/LocaleExtensionsTests.swift +++ b/Tests/UnitTests/FoundationExtensions/LocaleExtensionsTests.swift @@ -40,8 +40,13 @@ class LocaleExtensionsTests: TestCase { // Fixed in iOS 17 on Xcode 15 expect(Locale(identifier: "").rc_languageCode).to(beNil()) } else { - // Broken in iOS 16 on Xcode 15 - expect(Locale(identifier: "").rc_languageCode) == "en" + if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { + // Broken in iOS 16 on Xcode 15 + expect(Locale(identifier: "").rc_languageCode) == "en" + } else { + // iOS 15 on Xcode 15 + expect(Locale(identifier: "").rc_languageCode).to(beNil()) + } } #else expect(Locale(identifier: "").rc_languageCode).to(beNil()) @@ -61,8 +66,13 @@ class LocaleExtensionsTests: TestCase { // Fixed in iOS 17 on Xcode 15 expect(Locale(identifier: "").removingRegion).to(beNil()) } else { - // Broken in iOS 16 on Xcode 15 - expect(Locale(identifier: "").removingRegion?.identifier) == "en" + if #available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *) { + // Broken in iOS 16 on Xcode 15 + expect(Locale(identifier: "").removingRegion?.identifier) == "en" + } else { + // iOS 15 on Xcode 15 + expect(Locale(identifier: "").removingRegion).to(beNil()) + } } #else expect(Locale(identifier: "").removingRegion).to(beNil()) diff --git a/Tests/UnitTests/Paywalls/PaywallDataTests.swift b/Tests/UnitTests/Paywalls/PaywallDataTests.swift index 35e72bbd3d..ad8c4cb8d9 100644 --- a/Tests/UnitTests/Paywalls/PaywallDataTests.swift +++ b/Tests/UnitTests/Paywalls/PaywallDataTests.swift @@ -148,18 +148,16 @@ class PaywallDataTests: BaseHTTPResponseTest { } func testLocalesOrderedByPriority() throws { - let expected: [String] - - if #available(iOS 16.0, tvOS 16.0, watchOS 9.0, *) { - expected = [ - "en-US" - ] - } else { - expected = [ - // `Locale.preferredLanguages` returns `en` before iOS 17. - "en" - ] - } + #if swift(>=5.9) + let expected = [ + "en-US" + ] + #else + let expected = [ + // `Locale.preferredLanguages` returns `en` before Xcode 15. + "en" + ] + #endif expect(PaywallData.localesOrderedByPriority.map(\.identifier)) == expected } diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithAdServicesToken.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithAdServicesToken.1.json index b27dfcf34a..07205fc5b1 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithAdServicesToken.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithAdServicesToken.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesCustomerInfoIfStatusCodeIsSuccess.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesCustomerInfoIfStatusCodeIsSuccess.1.json index 317447c27c..3a6b24730a 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesCustomerInfoIfStatusCodeIsSuccess.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesCustomerInfoIfStatusCodeIsSuccess.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesErrorIfStatusCodeIsNotSuccess.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesErrorIfStatusCodeIsNotSuccess.1.json index db9595da21..89eea644e3 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesErrorIfStatusCodeIsNotSuccess.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesPassesErrorIfStatusCodeIsNotSuccess.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesReturnsBadJson.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesReturnsBadJson.1.json index 317447c27c..3a6b24730a 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesReturnsBadJson.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesReturnsBadJson.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesSendsThemCorrectly.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesSendsThemCorrectly.1.json index db9595da21..89eea644e3 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesSendsThemCorrectly.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithSubscriberAttributesSendsThemCorrectly.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithoutSubscriberAttributesSkipsThem.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithoutSubscriberAttributesSkipsThem.1.json index b6f52b9e4b..c0c687398c 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithoutSubscriberAttributesSkipsThem.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostReceiptWithoutSubscriberAttributesSkipsThem.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInNetworkErrorCase.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInNetworkErrorCase.1.json index 9c20fe3176..560035efeb 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInNetworkErrorCase.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInNetworkErrorCase.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInSuccessCase.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInSuccessCase.1.json index 9c20fe3176..560035efeb 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInSuccessCase.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionInSuccessCase.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionWithErrorInBadRequestCase.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionWithErrorInBadRequestCase.1.json index 9c20fe3176..560035efeb 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionWithErrorInBadRequestCase.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesCallsCompletionWithErrorInBadRequestCase.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsAttributesErrorsIfAny.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsAttributesErrorsIfAny.1.json index 9c20fe3176..560035efeb 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsAttributesErrorsIfAny.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsAttributesErrorsIfAny.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1", diff --git a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsRightParameters.1.json b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsRightParameters.1.json index 9c20fe3176..560035efeb 100644 --- a/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsRightParameters.1.json +++ b/Tests/UnitTests/SubscriberAttributes/__Snapshots__/BackendSubscriberAttributesTests/iOS15-testPostSubscriberAttributesSendsRightParameters.1.json @@ -14,7 +14,7 @@ "X-Platform-Flavor" : "Unity", "X-Platform-Flavor-Version" : "2.3.3", "X-Platform-Version" : "Version 17.0.0 (Build 21A342)", - "X-Preferred-Locales" : "en", + "X-Preferred-Locales" : "en_US", "X-Retry-Count" : "0", "X-Storefront" : "USA", "X-StoreKit-Version" : "1",