diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 3b97251..be62980 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -10,25 +10,45 @@ on: jobs: test: name: Unit-Tests - runs-on: macos-latest - + runs-on: macos-14 steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v4 + + - name: Setup Java 17 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + - name: Set up XCode + run: sudo xcode-select --switch /Applications/Xcode_15.1.app + - name: Bundle Install run: bundle install + + - name: Install Cocoapods + run: bundle exec pod install + + - name: Link SwiftLint or install it + run: brew link --overwrite swiftlint || brew install swiftlint || brew link --overwrite swiftlint + - name: Unit tests run: bundle exec fastlane unit_tests env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + - name: Code Coverage run: bundle exec fastlane coverage + - name: Lint run: bundle exec fastlane lint + - name: Setup sonarqube - uses: warchant/setup-sonar-scanner@v3 + uses: warchant/setup-sonar-scanner@v8 + - name: Send to Sonarcloud run: bundle exec fastlane sonarqube env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONARCLOUD_KEY }} + SONAR_TOKEN: ${{ secrets.SONARCLOUD_KEY }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 330d167..e87dc17 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,5 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ +Podfile.lock +Gemfile.lock diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..f670eca --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,33 @@ +disabled_rules: +- trailing_whitespace +opt_in_rules: +- empty_count +- empty_string +excluded: +- Carthage +- Pods +- vendor +- SwiftLint/Common/3rdPartyLib +line_length: + warning: 150 + error: 200 + ignores_function_declarations: true + ignores_comments: true + ignores_urls: true +function_body_length: + warning: 300 + error: 500 +function_parameter_count: + warning: 6 + error: 8 +type_body_length: + warning: 300 + error: 500 +file_length: + warning: 1000 + error: 1500 + ignore_comment_only_lines: true +cyclomatic_complexity: + warning: 15 + error: 25 +reporter: "xcode" \ No newline at end of file diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..749f9e2 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,2 @@ +# O11/ODC +* @OutSystems/rd-mobile-ecosystem \ No newline at end of file diff --git a/Gemfile b/Gemfile index a80b326..03554d1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source "https://rubygems.org" -gem "fastlane" -gem "slather" \ No newline at end of file +gem 'cocoapods', '1.14.3' +gem 'fastlane' +gem 'slather' \ No newline at end of file diff --git a/docs/LICENSE b/LICENSE similarity index 100% rename from docs/LICENSE rename to LICENSE diff --git a/OSPaymentsLib.xcodeproj/project.pbxproj b/OSPaymentsLib.xcodeproj/project.pbxproj index 29ac8a9..5d52311 100644 --- a/OSPaymentsLib.xcodeproj/project.pbxproj +++ b/OSPaymentsLib.xcodeproj/project.pbxproj @@ -7,9 +7,53 @@ objects = { /* Begin PBXBuildFile section */ + 2795015547475D10533FC3ED /* Pods_OSPaymentsLib_OSPaymentsLibTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B66E22F38CE39794C45BD54C /* Pods_OSPaymentsLib_OSPaymentsLibTests.framework */; }; + 2BE96A49C6E23101BB86CFA2 /* Pods_OSPaymentsLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 438D56B93CBB340D927AAE83 /* Pods_OSPaymentsLib.framework */; }; 7507FC1B27FC2AAE003809F6 /* OSPaymentsLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7507FC1227FC2AAE003809F6 /* OSPaymentsLib.framework */; }; - 7507FC2027FC2AAE003809F6 /* OSPaymentsLibTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7507FC1F27FC2AAE003809F6 /* OSPaymentsLibTests.swift */; }; - 7507FC2127FC2AAE003809F6 /* OSPaymentsLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 7507FC1527FC2AAE003809F6 /* OSPaymentsLib.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7509DC7728993C4C005BA0D4 /* PKMerchantCapability+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC7628993C4C005BA0D4 /* PKMerchantCapability+Adapter.swift */; }; + 7509DC7D28995A07005BA0D4 /* OSPMTAvailabilityDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC7C28995A07005BA0D4 /* OSPMTAvailabilityDelegate.swift */; }; + 7509DC7F28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC7E28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift */; }; + 7509DC81289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509DC80289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift */; }; + 751B1DB2293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 751B1DB1293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift */; }; + 753CDB1C2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */; }; + 7556EA952934DAC600FF4044 /* OSPMTRequestParametersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA942934DAC600FF4044 /* OSPMTRequestParametersModel.swift */; }; + 7556EA982934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA972934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift */; }; + 7556EA9A2934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA992934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift */; }; + 7556EA9C29350B9B00FF4044 /* OSPMTGatewayFactorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7556EA9B29350B9B00FF4044 /* OSPMTGatewayFactorySpec.swift */; }; + 755A804B289BB96900426EAA /* PKPassLibrary+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A804A289BB96900426EAA /* PKPassLibrary+Adapter.swift */; }; + 755A804D289BBAB300426EAA /* PKPaymentAuthorizationController+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A804C289BBAB300426EAA /* PKPaymentAuthorizationController+Adapter.swift */; }; + 755A8050289BBDF000426EAA /* OSPMTApplePayAvailabilityBehaviourSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A804F289BBDF000426EAA /* OSPMTApplePayAvailabilityBehaviourSpec.swift */; }; + 755A8055289BC8EE00426EAA /* OSPMTDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8053289BC8EE00426EAA /* OSPMTDetailsModel.swift */; }; + 755A8056289BC8EE00426EAA /* OSPMTScopeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8054289BC8EE00426EAA /* OSPMTScopeModel.swift */; }; + 755A8058289BC90A00426EAA /* OSPMTRequestDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8057289BC90A00426EAA /* OSPMTRequestDelegate.swift */; }; + 755A805A289BC92A00426EAA /* PKContactField+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8059289BC92A00426EAA /* PKContactField+Adapter.swift */; }; + 755A805C289BD4C600426EAA /* OSPMTApplePayRequestBehaviourSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A805B289BD4C600426EAA /* OSPMTApplePayRequestBehaviourSpec.swift */; }; + 755A8060289BD54E00426EAA /* OSPMTDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A805F289BD54E00426EAA /* OSPMTDataModel.swift */; }; + 755A8062289BD56300426EAA /* OSPMTAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8061289BD56300426EAA /* OSPMTAddressModel.swift */; }; + 755A8064289BD58900426EAA /* OSPMTContactInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755A8063289BD58900426EAA /* OSPMTContactInfoModel.swift */; }; + 755DF3F0297FF02800140860 /* StripePayments in Frameworks */ = {isa = PBXBuildFile; productRef = 755DF3EF297FF02800140860 /* StripePayments */; }; + 756931E62937A9200014618D /* OSPMTTokenInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756931E52937A9200014618D /* OSPMTTokenInfoModel.swift */; }; + 75760F78289C102D001BDCEC /* OSPMTAddressModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F77289C102D001BDCEC /* OSPMTAddressModelSpec.swift */; }; + 75760F7A289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F79289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift */; }; + 75760F7D289C1AED001BDCEC /* OSPMTTokenInfoModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F7C289C1AED001BDCEC /* OSPMTTokenInfoModelSpec.swift */; }; + 75760F7F289C1BF9001BDCEC /* OSPMTDataModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F7E289C1BF9001BDCEC /* OSPMTDataModelSpec.swift */; }; + 75760F81289C1DF3001BDCEC /* OSPMTScopeModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F80289C1DF3001BDCEC /* OSPMTScopeModelSpec.swift */; }; + 75760F83289C1F99001BDCEC /* PKPayment+Adapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75760F82289C1F99001BDCEC /* PKPayment+Adapter.swift */; }; + 757ADE062934CF33002B3341 /* OSPMTGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757ADE052934CF32002B3341 /* OSPMTGateway.swift */; }; + 757ADE082934CF5E002B3341 /* OSPMTGatewayFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757ADE072934CF5E002B3341 /* OSPMTGatewayFactory.swift */; }; + 757ADE0A2934CF92002B3341 /* OSPMTGatewayDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757ADE092934CF92002B3341 /* OSPMTGatewayDelegate.swift */; }; + 757ADE0C2934CFE4002B3341 /* OSPMTStripeWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757ADE0B2934CFE4002B3341 /* OSPMTStripeWrapper.swift */; }; + 75CC42E829375A6200149E6E /* OSPMTServiceProviderInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CC42E729375A6200149E6E /* OSPMTServiceProviderInfoModel.swift */; }; + 75E4DCB12897C8AD002277FD /* OSPMTPaymentsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75E4DCB02897C8AD002277FD /* OSPMTPaymentsSpec.swift */; }; + 75EC4D122893FC3C00CF50E2 /* OSPMTPayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D112893FC3C00CF50E2 /* OSPMTPayments.swift */; }; + 75EC4D152894143A00CF50E2 /* OSPMTCallbackDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D142894143A00CF50E2 /* OSPMTCallbackDelegate.swift */; }; + 75EC4D172894150F00CF50E2 /* OSPMTHandlerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D162894150F00CF50E2 /* OSPMTHandlerDelegate.swift */; }; + 75EC4D1A2894156E00CF50E2 /* OSPMTError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D192894156E00CF50E2 /* OSPMTError.swift */; }; + 75EC4D1C2894160400CF50E2 /* OSPMTActionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D1B2894160400CF50E2 /* OSPMTActionDelegate.swift */; }; + 75EC4D1E289416B600CF50E2 /* OSPMTApplePayHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D1D289416B600CF50E2 /* OSPMTApplePayHandler.swift */; }; + 75EC4D2228942C3800CF50E2 /* OSPMTConfigurationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D2128942C3800CF50E2 /* OSPMTConfigurationModel.swift */; }; + 75EC4D242894449700CF50E2 /* OSPMTApplePayHandlerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D232894449700CF50E2 /* OSPMTApplePayHandlerSpec.swift */; }; + 75EC4D262894478200CF50E2 /* OSPMTTestConfigurations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EC4D252894478200CF50E2 /* OSPMTTestConfigurations.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -23,10 +67,57 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 04BB75F19D0A9E5D69F8A808 /* Pods-OSPaymentsLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OSPaymentsLib.debug.xcconfig"; path = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.debug.xcconfig"; sourceTree = ""; }; + 438D56B93CBB340D927AAE83 /* Pods_OSPaymentsLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OSPaymentsLib.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 710E89102B31A196A13C8FEF /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig"; path = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig"; sourceTree = ""; }; + 71B8EFD16BFC92BA1A1B4D38 /* Pods-OSPaymentsLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OSPaymentsLib.release.xcconfig"; path = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.release.xcconfig"; sourceTree = ""; }; 7507FC1227FC2AAE003809F6 /* OSPaymentsLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OSPaymentsLib.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7507FC1527FC2AAE003809F6 /* OSPaymentsLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSPaymentsLib.h; sourceTree = ""; }; 7507FC1A27FC2AAE003809F6 /* OSPaymentsLibTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OSPaymentsLibTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 7507FC1F27FC2AAE003809F6 /* OSPaymentsLibTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPaymentsLibTests.swift; sourceTree = ""; }; + 7509DC7628993C4C005BA0D4 /* PKMerchantCapability+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKMerchantCapability+Adapter.swift"; sourceTree = ""; }; + 7509DC7C28995A07005BA0D4 /* OSPMTAvailabilityDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTAvailabilityDelegate.swift; sourceTree = ""; }; + 7509DC7E28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayConfigurationSpec.swift; sourceTree = ""; }; + 7509DC80289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKPaymentNetwork+Adapter.swift"; sourceTree = ""; }; + 751B1DB1293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeRequestParametersModel.swift; sourceTree = ""; }; + 753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 7556EA942934DAC600FF4044 /* OSPMTRequestParametersModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTRequestParametersModel.swift; sourceTree = ""; }; + 7556EA972934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeAPIDelegate.swift; sourceTree = ""; }; + 7556EA992934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeWrapperSpec.swift; sourceTree = ""; }; + 7556EA9B29350B9B00FF4044 /* OSPMTGatewayFactorySpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTGatewayFactorySpec.swift; sourceTree = ""; }; + 755A804A289BB96900426EAA /* PKPassLibrary+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKPassLibrary+Adapter.swift"; sourceTree = ""; }; + 755A804C289BBAB300426EAA /* PKPaymentAuthorizationController+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKPaymentAuthorizationController+Adapter.swift"; sourceTree = ""; }; + 755A804F289BBDF000426EAA /* OSPMTApplePayAvailabilityBehaviourSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayAvailabilityBehaviourSpec.swift; sourceTree = ""; }; + 755A8053289BC8EE00426EAA /* OSPMTDetailsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSPMTDetailsModel.swift; sourceTree = ""; }; + 755A8054289BC8EE00426EAA /* OSPMTScopeModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSPMTScopeModel.swift; sourceTree = ""; }; + 755A8057289BC90A00426EAA /* OSPMTRequestDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSPMTRequestDelegate.swift; sourceTree = ""; }; + 755A8059289BC92A00426EAA /* PKContactField+Adapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PKContactField+Adapter.swift"; sourceTree = ""; }; + 755A805B289BD4C600426EAA /* OSPMTApplePayRequestBehaviourSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayRequestBehaviourSpec.swift; sourceTree = ""; }; + 755A805F289BD54E00426EAA /* OSPMTDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTDataModel.swift; sourceTree = ""; }; + 755A8061289BD56300426EAA /* OSPMTAddressModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTAddressModel.swift; sourceTree = ""; }; + 755A8063289BD58900426EAA /* OSPMTContactInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTContactInfoModel.swift; sourceTree = ""; }; + 756931E52937A9200014618D /* OSPMTTokenInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSPMTTokenInfoModel.swift; sourceTree = ""; }; + 75760F77289C102D001BDCEC /* OSPMTAddressModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTAddressModelSpec.swift; sourceTree = ""; }; + 75760F79289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTContactInfoModelSpec.swift; sourceTree = ""; }; + 75760F7C289C1AED001BDCEC /* OSPMTTokenInfoModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTTokenInfoModelSpec.swift; sourceTree = ""; }; + 75760F7E289C1BF9001BDCEC /* OSPMTDataModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTDataModelSpec.swift; sourceTree = ""; }; + 75760F80289C1DF3001BDCEC /* OSPMTScopeModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTScopeModelSpec.swift; sourceTree = ""; }; + 75760F82289C1F99001BDCEC /* PKPayment+Adapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PKPayment+Adapter.swift"; sourceTree = ""; }; + 757ADE052934CF32002B3341 /* OSPMTGateway.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTGateway.swift; sourceTree = ""; }; + 757ADE072934CF5E002B3341 /* OSPMTGatewayFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTGatewayFactory.swift; sourceTree = ""; }; + 757ADE092934CF92002B3341 /* OSPMTGatewayDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTGatewayDelegate.swift; sourceTree = ""; }; + 757ADE0B2934CFE4002B3341 /* OSPMTStripeWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTStripeWrapper.swift; sourceTree = ""; }; + 75CC42E729375A6200149E6E /* OSPMTServiceProviderInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTServiceProviderInfoModel.swift; sourceTree = ""; }; + 75E4DCB02897C8AD002277FD /* OSPMTPaymentsSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTPaymentsSpec.swift; sourceTree = ""; }; + 75EC4D112893FC3C00CF50E2 /* OSPMTPayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTPayments.swift; sourceTree = ""; }; + 75EC4D142894143A00CF50E2 /* OSPMTCallbackDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTCallbackDelegate.swift; sourceTree = ""; }; + 75EC4D162894150F00CF50E2 /* OSPMTHandlerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTHandlerDelegate.swift; sourceTree = ""; }; + 75EC4D192894156E00CF50E2 /* OSPMTError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTError.swift; sourceTree = ""; }; + 75EC4D1B2894160400CF50E2 /* OSPMTActionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTActionDelegate.swift; sourceTree = ""; }; + 75EC4D1D289416B600CF50E2 /* OSPMTApplePayHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayHandler.swift; sourceTree = ""; }; + 75EC4D2128942C3800CF50E2 /* OSPMTConfigurationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTConfigurationModel.swift; sourceTree = ""; }; + 75EC4D232894449700CF50E2 /* OSPMTApplePayHandlerSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTApplePayHandlerSpec.swift; sourceTree = ""; }; + 75EC4D252894478200CF50E2 /* OSPMTTestConfigurations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPMTTestConfigurations.swift; sourceTree = ""; }; + B66E22F38CE39794C45BD54C /* Pods_OSPaymentsLib_OSPaymentsLibTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OSPaymentsLib_OSPaymentsLibTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B7142D0B524845BC8B329891 /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig"; path = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -34,6 +125,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 755DF3F0297FF02800140860 /* StripePayments in Frameworks */, + 2BE96A49C6E23101BB86CFA2 /* Pods_OSPaymentsLib.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -42,18 +135,32 @@ buildActionMask = 2147483647; files = ( 7507FC1B27FC2AAE003809F6 /* OSPaymentsLib.framework in Frameworks */, + 2795015547475D10533FC3ED /* Pods_OSPaymentsLib_OSPaymentsLibTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 498027A500160B5AE9639B6C /* Pods */ = { + isa = PBXGroup; + children = ( + 04BB75F19D0A9E5D69F8A808 /* Pods-OSPaymentsLib.debug.xcconfig */, + 71B8EFD16BFC92BA1A1B4D38 /* Pods-OSPaymentsLib.release.xcconfig */, + B7142D0B524845BC8B329891 /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */, + 710E89102B31A196A13C8FEF /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 7507FC0827FC2AAE003809F6 = { isa = PBXGroup; children = ( 7507FC1427FC2AAE003809F6 /* OSPaymentsLib */, 7507FC1E27FC2AAE003809F6 /* OSPaymentsLibTests */, 7507FC1327FC2AAE003809F6 /* Products */, + 498027A500160B5AE9639B6C /* Pods */, + 96720D1B15CD4540D1D469E2 /* Frameworks */, ); sourceTree = ""; }; @@ -69,7 +176,14 @@ 7507FC1427FC2AAE003809F6 /* OSPaymentsLib */ = { isa = PBXGroup; children = ( - 7507FC1527FC2AAE003809F6 /* OSPaymentsLib.h */, + 75EC4D182894155D00CF50E2 /* Error */, + 7509DC7528993C26005BA0D4 /* Extensions */, + 757ADE042934CEF8002B3341 /* Gateways */, + 755A8052289BC8EE00426EAA /* Models */, + 75EC4D132894142000CF50E2 /* Protocols */, + 75EC4D1D289416B600CF50E2 /* OSPMTApplePayHandler.swift */, + 75EC4D112893FC3C00CF50E2 /* OSPMTPayments.swift */, + 753CDB1B2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy */, ); path = OSPaymentsLib; sourceTree = ""; @@ -77,11 +191,110 @@ 7507FC1E27FC2AAE003809F6 /* OSPaymentsLibTests */ = { isa = PBXGroup; children = ( - 7507FC1F27FC2AAE003809F6 /* OSPaymentsLibTests.swift */, + 75760F7B289C17B1001BDCEC /* ModelSpecs */, + 755A804F289BBDF000426EAA /* OSPMTApplePayAvailabilityBehaviourSpec.swift */, + 7509DC7E28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift */, + 75EC4D232894449700CF50E2 /* OSPMTApplePayHandlerSpec.swift */, + 755A805B289BD4C600426EAA /* OSPMTApplePayRequestBehaviourSpec.swift */, + 7556EA9B29350B9B00FF4044 /* OSPMTGatewayFactorySpec.swift */, + 75E4DCB02897C8AD002277FD /* OSPMTPaymentsSpec.swift */, + 7556EA992934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift */, + 75EC4D252894478200CF50E2 /* OSPMTTestConfigurations.swift */, ); path = OSPaymentsLibTests; sourceTree = ""; }; + 7509DC7528993C26005BA0D4 /* Extensions */ = { + isa = PBXGroup; + children = ( + 755A8059289BC92A00426EAA /* PKContactField+Adapter.swift */, + 7509DC7628993C4C005BA0D4 /* PKMerchantCapability+Adapter.swift */, + 755A804A289BB96900426EAA /* PKPassLibrary+Adapter.swift */, + 75760F82289C1F99001BDCEC /* PKPayment+Adapter.swift */, + 755A804C289BBAB300426EAA /* PKPaymentAuthorizationController+Adapter.swift */, + 7509DC80289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + 7556EA962934E09900FF4044 /* Stripe */ = { + isa = PBXGroup; + children = ( + 7556EA972934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift */, + 751B1DB1293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift */, + 757ADE0B2934CFE4002B3341 /* OSPMTStripeWrapper.swift */, + ); + path = Stripe; + sourceTree = ""; + }; + 755A8052289BC8EE00426EAA /* Models */ = { + isa = PBXGroup; + children = ( + 755A8061289BD56300426EAA /* OSPMTAddressModel.swift */, + 75EC4D2128942C3800CF50E2 /* OSPMTConfigurationModel.swift */, + 755A8063289BD58900426EAA /* OSPMTContactInfoModel.swift */, + 755A805F289BD54E00426EAA /* OSPMTDataModel.swift */, + 755A8053289BC8EE00426EAA /* OSPMTDetailsModel.swift */, + 7556EA942934DAC600FF4044 /* OSPMTRequestParametersModel.swift */, + 75CC42E729375A6200149E6E /* OSPMTServiceProviderInfoModel.swift */, + 755A8054289BC8EE00426EAA /* OSPMTScopeModel.swift */, + 756931E52937A9200014618D /* OSPMTTokenInfoModel.swift */, + ); + path = Models; + sourceTree = ""; + }; + 75760F7B289C17B1001BDCEC /* ModelSpecs */ = { + isa = PBXGroup; + children = ( + 75760F77289C102D001BDCEC /* OSPMTAddressModelSpec.swift */, + 75760F79289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift */, + 75760F7E289C1BF9001BDCEC /* OSPMTDataModelSpec.swift */, + 75760F80289C1DF3001BDCEC /* OSPMTScopeModelSpec.swift */, + 75760F7C289C1AED001BDCEC /* OSPMTTokenInfoModelSpec.swift */, + ); + path = ModelSpecs; + sourceTree = ""; + }; + 757ADE042934CEF8002B3341 /* Gateways */ = { + isa = PBXGroup; + children = ( + 7556EA962934E09900FF4044 /* Stripe */, + 757ADE052934CF32002B3341 /* OSPMTGateway.swift */, + 757ADE072934CF5E002B3341 /* OSPMTGatewayFactory.swift */, + ); + path = Gateways; + sourceTree = ""; + }; + 75EC4D132894142000CF50E2 /* Protocols */ = { + isa = PBXGroup; + children = ( + 75EC4D1B2894160400CF50E2 /* OSPMTActionDelegate.swift */, + 7509DC7C28995A07005BA0D4 /* OSPMTAvailabilityDelegate.swift */, + 75EC4D142894143A00CF50E2 /* OSPMTCallbackDelegate.swift */, + 757ADE092934CF92002B3341 /* OSPMTGatewayDelegate.swift */, + 75EC4D162894150F00CF50E2 /* OSPMTHandlerDelegate.swift */, + 755A8057289BC90A00426EAA /* OSPMTRequestDelegate.swift */, + ); + path = Protocols; + sourceTree = ""; + }; + 75EC4D182894155D00CF50E2 /* Error */ = { + isa = PBXGroup; + children = ( + 75EC4D192894156E00CF50E2 /* OSPMTError.swift */, + ); + path = Error; + sourceTree = ""; + }; + 96720D1B15CD4540D1D469E2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 438D56B93CBB340D927AAE83 /* Pods_OSPaymentsLib.framework */, + B66E22F38CE39794C45BD54C /* Pods_OSPaymentsLib_OSPaymentsLibTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -89,7 +302,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 7507FC2127FC2AAE003809F6 /* OSPaymentsLib.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -100,16 +312,21 @@ isa = PBXNativeTarget; buildConfigurationList = 7507FC2427FC2AAE003809F6 /* Build configuration list for PBXNativeTarget "OSPaymentsLib" */; buildPhases = ( + E217EDCB704EE6787A7E3A80 /* [CP] Check Pods Manifest.lock */, 7507FC0D27FC2AAE003809F6 /* Headers */, 7507FC0E27FC2AAE003809F6 /* Sources */, 7507FC0F27FC2AAE003809F6 /* Frameworks */, 7507FC1027FC2AAE003809F6 /* Resources */, + 75895022289989D200670171 /* Run Script */, ); buildRules = ( ); dependencies = ( ); name = OSPaymentsLib; + packageProductDependencies = ( + 755DF3EF297FF02800140860 /* StripePayments */, + ); productName = OSPaymentsLib; productReference = 7507FC1227FC2AAE003809F6 /* OSPaymentsLib.framework */; productType = "com.apple.product-type.framework"; @@ -118,9 +335,11 @@ isa = PBXNativeTarget; buildConfigurationList = 7507FC2727FC2AAE003809F6 /* Build configuration list for PBXNativeTarget "OSPaymentsLibTests" */; buildPhases = ( + 0E37F8707540EB748977F7F2 /* [CP] Check Pods Manifest.lock */, 7507FC1627FC2AAE003809F6 /* Sources */, 7507FC1727FC2AAE003809F6 /* Frameworks */, 7507FC1827FC2AAE003809F6 /* Resources */, + FF8F553B3E27915664C6D9DC /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -140,10 +359,11 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1330; - LastUpgradeCheck = 1330; + LastUpgradeCheck = 1510; TargetAttributes = { 7507FC1127FC2AAE003809F6 = { CreatedOnToolsVersion = 13.3; + LastSwiftMigration = 1340; }; 7507FC1927FC2AAE003809F6 = { CreatedOnToolsVersion = 13.3; @@ -159,6 +379,9 @@ Base, ); mainGroup = 7507FC0827FC2AAE003809F6; + packageReferences = ( + 755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */, + ); productRefGroup = 7507FC1327FC2AAE003809F6 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -174,6 +397,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 753CDB1C2BC55BEE005EAA76 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -186,11 +410,123 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 0E37F8707540EB748977F7F2 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-OSPaymentsLib-OSPaymentsLibTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 75895022289989D200670171 /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: Swiftlint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; + E217EDCB704EE6787A7E3A80 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-OSPaymentsLib-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + FF8F553B3E27915664C6D9DC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 7507FC0E27FC2AAE003809F6 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7509DC7D28995A07005BA0D4 /* OSPMTAvailabilityDelegate.swift in Sources */, + 75EC4D1A2894156E00CF50E2 /* OSPMTError.swift in Sources */, + 757ADE082934CF5E002B3341 /* OSPMTGatewayFactory.swift in Sources */, + 757ADE062934CF33002B3341 /* OSPMTGateway.swift in Sources */, + 755A8056289BC8EE00426EAA /* OSPMTScopeModel.swift in Sources */, + 7556EA952934DAC600FF4044 /* OSPMTRequestParametersModel.swift in Sources */, + 751B1DB2293A2744009A00B2 /* OSPMTStripeRequestParametersModel.swift in Sources */, + 7556EA982934E10D00FF4044 /* OSPMTStripeAPIDelegate.swift in Sources */, + 7509DC7728993C4C005BA0D4 /* PKMerchantCapability+Adapter.swift in Sources */, + 755A8055289BC8EE00426EAA /* OSPMTDetailsModel.swift in Sources */, + 755A804B289BB96900426EAA /* PKPassLibrary+Adapter.swift in Sources */, + 75CC42E829375A6200149E6E /* OSPMTServiceProviderInfoModel.swift in Sources */, + 75760F83289C1F99001BDCEC /* PKPayment+Adapter.swift in Sources */, + 75EC4D2228942C3800CF50E2 /* OSPMTConfigurationModel.swift in Sources */, + 75EC4D172894150F00CF50E2 /* OSPMTHandlerDelegate.swift in Sources */, + 755A8058289BC90A00426EAA /* OSPMTRequestDelegate.swift in Sources */, + 757ADE0C2934CFE4002B3341 /* OSPMTStripeWrapper.swift in Sources */, + 755A8062289BD56300426EAA /* OSPMTAddressModel.swift in Sources */, + 755A8060289BD54E00426EAA /* OSPMTDataModel.swift in Sources */, + 755A804D289BBAB300426EAA /* PKPaymentAuthorizationController+Adapter.swift in Sources */, + 75EC4D1E289416B600CF50E2 /* OSPMTApplePayHandler.swift in Sources */, + 7509DC81289967A6005BA0D4 /* PKPaymentNetwork+Adapter.swift in Sources */, + 755A8064289BD58900426EAA /* OSPMTContactInfoModel.swift in Sources */, + 75EC4D152894143A00CF50E2 /* OSPMTCallbackDelegate.swift in Sources */, + 75EC4D1C2894160400CF50E2 /* OSPMTActionDelegate.swift in Sources */, + 757ADE0A2934CF92002B3341 /* OSPMTGatewayDelegate.swift in Sources */, + 756931E62937A9200014618D /* OSPMTTokenInfoModel.swift in Sources */, + 755A805A289BC92A00426EAA /* PKContactField+Adapter.swift in Sources */, + 75EC4D122893FC3C00CF50E2 /* OSPMTPayments.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -198,7 +534,19 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7507FC2027FC2AAE003809F6 /* OSPaymentsLibTests.swift in Sources */, + 755A805C289BD4C600426EAA /* OSPMTApplePayRequestBehaviourSpec.swift in Sources */, + 7556EA9A2934E4AB00FF4044 /* OSPMTStripeWrapperSpec.swift in Sources */, + 75760F7A289C17AB001BDCEC /* OSPMTContactInfoModelSpec.swift in Sources */, + 75EC4D262894478200CF50E2 /* OSPMTTestConfigurations.swift in Sources */, + 75760F81289C1DF3001BDCEC /* OSPMTScopeModelSpec.swift in Sources */, + 755A8050289BBDF000426EAA /* OSPMTApplePayAvailabilityBehaviourSpec.swift in Sources */, + 75760F7D289C1AED001BDCEC /* OSPMTTokenInfoModelSpec.swift in Sources */, + 7509DC7F28996482005BA0D4 /* OSPMTApplePayConfigurationSpec.swift in Sources */, + 75760F7F289C1BF9001BDCEC /* OSPMTDataModelSpec.swift in Sources */, + 75EC4D242894449700CF50E2 /* OSPMTApplePayHandlerSpec.swift in Sources */, + 75E4DCB12897C8AD002277FD /* OSPMTPaymentsSpec.swift in Sources */, + 75760F78289C102D001BDCEC /* OSPMTAddressModelSpec.swift in Sources */, + 7556EA9C29350B9B00FF4044 /* OSPMTGatewayFactorySpec.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -250,6 +598,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -264,7 +613,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -313,6 +662,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -321,7 +671,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -335,8 +685,11 @@ }; 7507FC2527FC2AAE003809F6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 04BB75F19D0A9E5D69F8A808 /* Pods-OSPaymentsLib.debug.xcconfig */; buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -344,20 +697,27 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.2.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.payments.OSPaymentsLib; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -365,8 +725,11 @@ }; 7507FC2627FC2AAE003809F6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 71B8EFD16BFC92BA1A1B4D38 /* Pods-OSPaymentsLib.release.xcconfig */; buildSettings = { BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -374,19 +737,25 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.2.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17"; PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd.payments.OSPaymentsLib; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -395,14 +764,19 @@ }; 7507FC2827FC2AAE003809F6 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B7142D0B524845BC8B329891 /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = EVSWK8BA55; GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.payments.OSPaymentsLibTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -411,14 +785,19 @@ }; 7507FC2927FC2AAE003809F6 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 710E89102B31A196A13C8FEF /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = EVSWK8BA55; GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.payments.OSPaymentsLibTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -456,6 +835,25 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/stripe/stripe-ios-spm"; + requirement = { + kind = exactVersion; + version = 23.26.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 755DF3EF297FF02800140860 /* StripePayments */ = { + isa = XCSwiftPackageProductDependency; + package = 755DF3EE297FF02800140860 /* XCRemoteSwiftPackageReference "stripe-ios-spm" */; + productName = StripePayments; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 7507FC0927FC2AAE003809F6 /* Project object */; } diff --git a/OSPaymentsLib.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/OSPaymentsLib.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..2da5224 --- /dev/null +++ b/OSPaymentsLib.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "stripe-ios-spm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stripe/stripe-ios-spm", + "state" : { + "revision" : "87e3ebe7539e4408430606a5f1fbc9b88e67ae84", + "version" : "23.2.0" + } + } + ], + "version" : 2 +} diff --git a/OSPaymentsLib.xcodeproj/xcshareddata/xcschemes/OSPaymentsLib.xcscheme b/OSPaymentsLib.xcodeproj/xcshareddata/xcschemes/OSPaymentsLib.xcscheme index 38199ad..7361bb5 100644 --- a/OSPaymentsLib.xcodeproj/xcshareddata/xcschemes/OSPaymentsLib.xcscheme +++ b/OSPaymentsLib.xcodeproj/xcshareddata/xcschemes/OSPaymentsLib.xcscheme @@ -1,6 +1,6 @@ + + + + + + diff --git a/OSPaymentsLib.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/OSPaymentsLib.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/OSPaymentsLib.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/OSPaymentsLib.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/OSPaymentsLib.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/OSPaymentsLib.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/OSPaymentsLib.xcworkspace/xcshareddata/swiftpm/Package.resolved b/OSPaymentsLib.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..1be88e8 --- /dev/null +++ b/OSPaymentsLib.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "stripe-ios-spm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stripe/stripe-ios-spm", + "state" : { + "revision" : "3631ddcfa4c5dcccc4609b1682bbdec3d586bba8", + "version" : "23.26.0" + } + } + ], + "version" : 2 +} diff --git a/OSPaymentsLib/Error/OSPMTError.swift b/OSPaymentsLib/Error/OSPMTError.swift new file mode 100644 index 0000000..a5d1c5c --- /dev/null +++ b/OSPaymentsLib/Error/OSPMTError.swift @@ -0,0 +1,52 @@ +import Foundation + +/// All plugin errors that can be thrown +public enum OSPMTError: Int, CustomNSError, LocalizedError { + case invalidConfiguration = 1 + case walletNotAvailable = 3 + case paymentNotAvailable = 5 + case setupPaymentNotAvailable = 6 + case invalidDecodeDetails = 8 + case invalidEncodeScope = 9 + case paymentTriggerPresentationFailed = 10 + case paymentCancelled = 11 + + case gatewaySetFailed = 12 + case stripePaymentMethodCreation = 13 + case paymentIssue = 14 + case gatewayNotConfigured = 15 + case tokenIssue = 19 + + /// Textual description + public var errorDescription: String? { + switch self { + case .invalidConfiguration: + return "Couldn't obtain the payment's informations from the configurations file." + case .walletNotAvailable: + return "The Apple Pay is not available in the device." + case .paymentNotAvailable: + return "There is no payment method configured." + case .setupPaymentNotAvailable: + return "There are no valid payment cards for the supported networks and/or capabilities." + case .invalidDecodeDetails: + return "Couldn't decode the payment details." + case .invalidEncodeScope: + return "Couldn't encode the payment scope." + case .paymentTriggerPresentationFailed: + return "Couldn't present the Apple Pay screen." + case .paymentCancelled: + return "Payment was cancelled by the user." + + case .gatewaySetFailed: + return "Couldn't set payment service provider." + case .stripePaymentMethodCreation: + return "Couldn't obtain the PaymentMethod from Stripe." + case .paymentIssue: + return "Couldn't process payment." + case .gatewayNotConfigured: + return "Couldn't trigger the payment. The requested payment service provider is not configured yet." + case .tokenIssue: + return "Couldn’t trigger the payment. The access token is not defined." + } + } +} diff --git a/OSPaymentsLib/Extensions/PKContactField+Adapter.swift b/OSPaymentsLib/Extensions/PKContactField+Adapter.swift new file mode 100644 index 0000000..6622e90 --- /dev/null +++ b/OSPaymentsLib/Extensions/PKContactField+Adapter.swift @@ -0,0 +1,21 @@ +import PassKit + +extension PKContactField { + /// Allows the conversion of the contact text associated to Shipping and Billing Information into an object of `PKContactField` type. + /// - Parameter text: Contact field text to convert. + /// - Returns: The equivalent `PKContactField` object. + static func convert(from text: String) -> PKContactField? { + switch text.lowercased() { + case "email": + return .emailAddress + case "name": + return .name + case "phone": + return .phoneNumber + case "postal_address": + return .postalAddress + default: + return nil + } + } +} diff --git a/OSPaymentsLib/Extensions/PKMerchantCapability+Adapter.swift b/OSPaymentsLib/Extensions/PKMerchantCapability+Adapter.swift new file mode 100644 index 0000000..bcf2153 --- /dev/null +++ b/OSPaymentsLib/Extensions/PKMerchantCapability+Adapter.swift @@ -0,0 +1,21 @@ +import PassKit + +extension PKMerchantCapability { + /// Allows the conversion of the text associated to a Merchant Capability into an object of `PKMerchantCapability` type. + /// - Parameter text: Merchant capability text to convert. + /// - Returns: The equivalent `PKMerchantCapability` object. + static func convert(from text: String) -> PKMerchantCapability? { + switch text.lowercased() { + case "debit": + return .capabilityDebit + case "credit": + return .capabilityCredit + case "3ds": + return .capability3DS + case "emv": + return .capabilityEMV + default: + return nil + } + } +} diff --git a/OSPaymentsLib/Extensions/PKPassLibrary+Adapter.swift b/OSPaymentsLib/Extensions/PKPassLibrary+Adapter.swift new file mode 100644 index 0000000..b11e296 --- /dev/null +++ b/OSPaymentsLib/Extensions/PKPassLibrary+Adapter.swift @@ -0,0 +1,9 @@ +import PassKit + +extension PKPassLibrary: OSPMTWalletAvailabilityDelegate { + /// Verifies if the wallet is available for usage. + /// - Returns: A boolean indicating if the wallet is available. + static func isWalletAvailable() -> Bool { + Self.isPassLibraryAvailable() + } +} diff --git a/OSPaymentsLib/Extensions/PKPayment+Adapter.swift b/OSPaymentsLib/Extensions/PKPayment+Adapter.swift new file mode 100644 index 0000000..d5197ff --- /dev/null +++ b/OSPaymentsLib/Extensions/PKPayment+Adapter.swift @@ -0,0 +1,98 @@ +import PassKit + +extension PKPayment { + /// Converts a `PKPayment` object into a `OSPMTScopeModel` one. Returns `nil` if it can't. + /// - Parameter paymentGatewayModel: model that contains the payment gateway information resulting from completing a payment process. + /// - Returns: The corresponding `OSPMTScopeModel` object. Can also return `nil` if the conversion fails. + func createScopeModel(for paymentGatewayModel: OSPMTServiceProviderInfoModel? = nil) -> OSPMTScopeModel? { + var result: [String: Any] = [OSPMTScopeModel.CodingKeys.paymentData.rawValue: self.createTokenDataData(for: paymentGatewayModel)] + if let shippingContact = self.shippingContact { + result[OSPMTScopeModel.CodingKeys.shippingInfo.rawValue] = self.createContactInfoData(for: shippingContact) + } + + guard let scopeData = try? JSONSerialization.data(withJSONObject: result), + let scopeModel = try? JSONDecoder().decode(OSPMTScopeModel.self, from: scopeData) + else { return nil } + return scopeModel + } + + /// Converts a `PKPayment` object into a dictionary that relates to an `OSPMTDataModel` object. + /// - Parameter paymentGatewayModel: model that contains the payment gateway information resulting from completing a payment process. + /// - Returns: The corresponding `OSPMTDataModel` dictionary object. + private func createTokenDataData(for paymentGatewayModel: OSPMTServiceProviderInfoModel?) -> [String: Any] { + var result: [String: Any] = [ + OSPMTDataModel.CodingKeys.tokenData.rawValue: self.createTokenData(for: self.token.paymentData) + ] + if let billingContact = self.billingContact { + result[OSPMTDataModel.CodingKeys.billingInfo.rawValue] = self.createContactInfoData(for: billingContact) + } + if let paymentMethodName = self.token.paymentMethod.displayName { + let cardInfo = paymentMethodName.components(separatedBy: " ") + if let cardNetwork = cardInfo.first, let cardDetails = cardInfo.last { + result[OSPMTDataModel.CodingKeys.cardDetails.rawValue] = cardDetails + result[OSPMTDataModel.CodingKeys.cardNetwork.rawValue] = cardNetwork + } + } + if let paymentGatewayModel = paymentGatewayModel, + let paymentGatewayData = try? JSONEncoder().encode(paymentGatewayModel), + let paymentGatewayDict = try? JSONSerialization.jsonObject(with: paymentGatewayData) as? [String: String] { + result[OSPMTDataModel.CodingKeys.paymentServiceProviderData.rawValue] = paymentGatewayDict + } + + return result + } + + /// Takes the passed payment data object and converts it into a dictionary that relates to an `OSPMTTokenInfoModel` object. + /// - Parameter paymentData: `Data` type object that contains information related to a payment token. + /// - Returns: The corresponding `OSPMTTokenInfoModel` dictionary object. + private func createTokenData(for paymentData: Data) -> [String: String] { + var result = [OSPMTTokenInfoModel.CodingKeys.type.rawValue: "Apple Pay"] + + if let token = String(data: paymentData, encoding: .utf8) { + result[OSPMTTokenInfoModel.CodingKeys.token.rawValue] = token + } + + return result + } + + /// Takes the passed contact object and converts it into a dictionary that relates to an `OSPMTContactInfoModel` object. + /// - Parameter contact: `PKContact` type object that contains information related to the filled Billing or Shipping Information + /// - Returns: The corresponding `OSPMTContactInfoModel` dictionary object. + private func createContactInfoData(for contact: PKContact) -> [String: Any]? { + var result = [String: Any]() + if let address = contact.postalAddress { + result[OSPMTContactInfoModel.CodingKeys.address.rawValue] = self.createAddressData(for: address) + } + if let phoneNumber = contact.phoneNumber { + result[OSPMTContactInfoModel.CodingKeys.phoneNumber.rawValue] = phoneNumber.stringValue + } + if let name = contact.name, let givenName = name.givenName, let familyName = name.familyName, !givenName.isEmpty, !familyName.isEmpty { + result[OSPMTContactInfoModel.CodingKeys.name.rawValue] = "\(givenName) \(familyName)" + } + if let email = contact.emailAddress { + result[OSPMTContactInfoModel.CodingKeys.email.rawValue] = email + } + + return !result.isEmpty ? result : nil + } + + /// Takes the passed address object and converts it into a dictionary that relates to an `OSPMTAddressModel` object. + /// - Parameter postalAddress: `CNPostalAddress` type object that contains an address related to the filled Billing or Shipping Information. + /// - Returns: The corresponding `OSPMTAddressModel` dictionary object. + private func createAddressData(for postalAddress: CNPostalAddress) -> [String: String] { + var result = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: postalAddress.postalCode, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: postalAddress.street, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: postalAddress.isoCountryCode, + OSPMTAddressModel.CodingKeys.city.rawValue: postalAddress.city + ] + if !postalAddress.subAdministrativeArea.isEmpty { + result[OSPMTAddressModel.CodingKeys.administrativeArea.rawValue] = postalAddress.subAdministrativeArea + } + if !postalAddress.state.isEmpty { + result[OSPMTAddressModel.CodingKeys.state.rawValue] = postalAddress.state + } + + return result + } +} diff --git a/OSPaymentsLib/Extensions/PKPaymentAuthorizationController+Adapter.swift b/OSPaymentsLib/Extensions/PKPaymentAuthorizationController+Adapter.swift new file mode 100644 index 0000000..a449e0c --- /dev/null +++ b/OSPaymentsLib/Extensions/PKPaymentAuthorizationController+Adapter.swift @@ -0,0 +1,66 @@ +import PassKit + +extension PKPaymentAuthorizationController: OSPMTApplePaySetupAvailabilityDelegate { + /// Verifies if a payment is available for usage. + /// - Returns: A boolean indicating if a payment is available. + static func isPaymentAvailable() -> Bool { + Self.canMakePayments() + } + + /// Verifies if a payment is available for usage, given the passed payment networks and marchant capabilities + /// - Parameters: + /// - networks: Array of payment networks available by a merchant + /// - merchantCapabilities: Bit set containing the payment capabilities available by a merchant. + /// - Returns: A boolean indicating if the payment is available. + static func isPaymentAvailable(using networks: [PKPaymentNetwork]?, and merchantCapabilities: PKMerchantCapability?) -> Bool { + guard let networks = networks, let merchantCapabilities = merchantCapabilities else { return false } + return Self.canMakePayments(usingNetworks: networks, capabilities: merchantCapabilities) + } +} + +extension PKPaymentAuthorizationController: OSPMTApplePayRequestTriggerDelegate { + /// Triggers a payment request. The result is processed asyncrhonously and returned by the `completion` parameters. + /// - Parameter completion: Block that returns the success of the payment request operation. + func triggerPayment(_ completion: @escaping OSPMTRequestTriggerCompletion) { + self.present(completion: completion) + } + + /// Creates an object responsible for dealing with the payment request process, delegating the details to the passed parameter. + /// - Parameters: + /// - detailsModel: Payment details. + /// - delegate: The object responsible for the request process' response. + /// - Returns: An instance of the object or an error, it the instatiation fails. + static func createRequestTriggerBehaviour(for detailsModel: OSPMTDetailsModel, andDelegate delegate: OSPMTApplePayRequestBehaviour?) -> Result { + guard + let delegate = delegate, + let merchantIdentifier = delegate.configuration.merchantID, + let countryCode = delegate.configuration.merchantCountryCode, + let merchantCapabilities = delegate.configuration.merchantCapabilities, + let paymentSummaryItems = delegate.getPaymentSummaryItems(for: detailsModel), + let supportedNetworks = delegate.configuration.supportedNetworks + else { return .failure(.invalidConfiguration) } + + let paymentRequest = PKPaymentRequest() + paymentRequest.merchantIdentifier = merchantIdentifier + paymentRequest.countryCode = countryCode + paymentRequest.currencyCode = detailsModel.currency + paymentRequest.merchantCapabilities = merchantCapabilities + paymentRequest.paymentSummaryItems = paymentSummaryItems + paymentRequest.requiredBillingContactFields = delegate.getContactFields( + for: detailsModel.billingContact.isCustom + ? detailsModel.billingContact.contactArray + : delegate.configuration.billingSupportedContacts + ) + paymentRequest.requiredShippingContactFields = delegate.getContactFields( + for: detailsModel.shippingContact.isCustom + ? detailsModel.shippingContact.contactArray + : delegate.configuration.shippingSupportedContacts + ) + paymentRequest.supportedCountries = delegate.configuration.supportedCountries + paymentRequest.supportedNetworks = supportedNetworks + + let paymentAuthorizationController = PKPaymentAuthorizationController(paymentRequest: paymentRequest) + paymentAuthorizationController.delegate = delegate + return .success(paymentAuthorizationController) + } +} diff --git a/OSPaymentsLib/Extensions/PKPaymentNetwork+Adapter.swift b/OSPaymentsLib/Extensions/PKPaymentNetwork+Adapter.swift new file mode 100644 index 0000000..1dacb17 --- /dev/null +++ b/OSPaymentsLib/Extensions/PKPaymentNetwork+Adapter.swift @@ -0,0 +1,21 @@ +import PassKit + +extension PKPaymentNetwork { + /// Allows the conversion of the text associated to a Payment Network into an object of `PKPaymentNetwork` type. + /// - Parameter text: Payment network text to convert. + /// - Returns: The equivalent `PKPaymentNetwork` object. + static func convert(from text: String) -> PKPaymentNetwork? { + switch text.lowercased() { + case "amex": + return .amex + case "discover": + return .discover + case "visa": + return .visa + case "mastercard": + return .masterCard + default: + return nil + } + } +} diff --git a/OSPaymentsLib/Gateways/OSPMTGateway.swift b/OSPaymentsLib/Gateways/OSPMTGateway.swift new file mode 100644 index 0000000..b62ae05 --- /dev/null +++ b/OSPaymentsLib/Gateways/OSPMTGateway.swift @@ -0,0 +1,15 @@ +/// Payment Service Provider enum object +enum OSPMTGateway: String { + case stripe = "Stripe" +} + +extension OSPMTGateway { + + /// Converts a string into a `OSPMTGateway` object. + /// - Parameter text: Text to convert. + /// - Returns: A `OSPMTGateway` enum object if successful. `nil` is returned in case of error. + static func convert(from text: String?) -> OSPMTGateway? { + guard let text = text, text.lowercased() == "stripe" else { return nil } + return .stripe + } +} diff --git a/OSPaymentsLib/Gateways/OSPMTGatewayFactory.swift b/OSPaymentsLib/Gateways/OSPMTGatewayFactory.swift new file mode 100644 index 0000000..f4bbd0a --- /dev/null +++ b/OSPaymentsLib/Gateways/OSPMTGatewayFactory.swift @@ -0,0 +1,18 @@ +import Foundation + +/// Structure responsible for creating a Wrapper for the configured Gateway. +struct OSPMTGatewayFactory { + /// Creates the correct wrapper for the gateway the user has configured. + /// - Parameter configuration: Model with the gateway configuration information. + /// - Returns: The wrapper object is everything is correctly configured. `nil` is returned otherwise. + static func createWrapper(for configuration: OSPMTGatewayModel) -> OSPMTGatewayDelegate? { + guard let gateway = configuration.gatewayEnum, let url = URL(string: configuration.requestURL) else { return nil } + let urlRequest = URLRequest(url: url) + + switch gateway { + case .stripe: + guard let publishableKey = configuration.publishableKey else { return nil } + return OSPMTStripeWrapper(urlRequest: urlRequest, publishableKey: publishableKey) + } + } +} diff --git a/OSPaymentsLib/Gateways/Stripe/OSPMTStripeAPIDelegate.swift b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeAPIDelegate.swift new file mode 100644 index 0000000..76a0502 --- /dev/null +++ b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeAPIDelegate.swift @@ -0,0 +1,37 @@ +import PassKit +@_implementationOnly import StripePayments + +/// Delegate class containing the required calls for Stripe's SDK to process. +protocol OSPMTStripeAPIDelegate: AnyObject { + /// Sets the required publishable key, required to trigger payments through Stripe + /// - Parameter publishableKey: Key obtained via Stripe's Dashboard. + func set(_ publishableKey: String) + + /// Retrieves Stripe's Payment Method's Identifier in exchange for Apple Pay's payment request result. + /// - Parameters: + /// - payment: Apple Pay's payment request result. + /// - completion: The exchange operation result. In case of success, it returns the Payment Method Id or an error otherwise. + func getPaymentMethodId(from payment: PKPayment, _ completion: @escaping (Result) -> Void) +} + +extension STPAPIClient: OSPMTStripeAPIDelegate { + /// Sets the required publishable key, required to trigger payments through Stripe + /// - Parameter publishableKey: Key obtained via Stripe's Dashboard. + func set(_ publishableKey: String) { + self.publishableKey = publishableKey + } + + /// Retrieves Stripe's Payment Method's Identifier in exchange for Apple Pay's payment request result. + /// - Parameters: + /// - payment: Apple Pay's payment request result. + /// - completion: The exchange operation result. In case of success, it returns the Payment Method Id or an error otherwise. + func getPaymentMethodId(from payment: PKPayment, _ completion: @escaping (Result) -> Void) { + self.createPaymentMethod(with: payment) { paymentMethod, _ in + if let paymentMethod = paymentMethod { + completion(.success(paymentMethod.stripeId)) + } else { + completion(.failure(.stripePaymentMethodCreation)) + } + } + } +} diff --git a/OSPaymentsLib/Gateways/Stripe/OSPMTStripeRequestParametersModel.swift b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeRequestParametersModel.swift new file mode 100644 index 0000000..688b68c --- /dev/null +++ b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeRequestParametersModel.swift @@ -0,0 +1,40 @@ +/// Model to manage Stripe's payment process request parameters. This is based on `OSPMTRequestParametersModel`. +final class OSPMTStripeRequestParametersModel: OSPMTRequestParametersModel { + let paymentMethodId: String + let confirm: Bool + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case paymentMethodId = "payment_method" + case confirm + } + + /// Constructor method. + /// - Parameters: + /// - amount: Amount to charge. + /// - currency: Currency to charge. + /// - paymentMethodId: Stripe object that represents the customer's payment instruments. + /// - confirm: Automatically confirm the triggered payment process. + init(amount: Int, currency: String, paymentMethodId: String, confirm: Bool = true) { + self.paymentMethodId = paymentMethodId + self.confirm = confirm + super.init(amount: amount, currency: currency) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + override func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(paymentMethodId, forKey: .paymentMethodId) + try container.encode(confirm, forKey: .confirm) + try super.encode(to: encoder) + } +} diff --git a/OSPaymentsLib/Gateways/Stripe/OSPMTStripeWrapper.swift b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeWrapper.swift new file mode 100644 index 0000000..452ef73 --- /dev/null +++ b/OSPaymentsLib/Gateways/Stripe/OSPMTStripeWrapper.swift @@ -0,0 +1,45 @@ +import PassKit +@_implementationOnly import StripeCore + +/// Object responsible for making a Stripe payment process. The Wrapper deals with all calls that are required to Stripe's SDK. +final class OSPMTStripeWrapper: OSPMTGatewayDelegate { + var urlRequest: URLRequest + var urlSession: URLSession + let apiDelegate: OSPMTStripeAPIDelegate + + /// Constructor method. + /// - Parameters: + /// - urlRequest: URL load request object. + /// - urlSession: Coordinator object for network data transfer tasks. + /// - publishableKey: Key required for Stripe's API to trigger calls. + /// - apiDelegate: Object responsible for Stripe's API calls. + init(urlRequest: URLRequest, urlSession: URLSession = .shared, publishableKey: String, apiDelegate: OSPMTStripeAPIDelegate = STPAPIClient.shared) { + self.urlRequest = urlRequest + self.urlSession = urlSession + + apiDelegate.set(publishableKey) + self.apiDelegate = apiDelegate + } +} + +extension OSPMTStripeWrapper { + /// Triggers the process through the configured gateway. + /// - Parameters: + /// - payment: Apple Pay's payment request result. + /// - details: Payment details to trigger processing. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: Payment process result. If returns the process result in case of success or an error otherwise. + func process(_ payment: PKPayment, with details: OSPMTDetailsModel, and accessToken: String, _ completion: @escaping (Result) -> Void) { + self.apiDelegate.getPaymentMethodId(from: payment) { result in + switch result { + case .success(let paymentMethodId): + let requestParametersModel = OSPMTStripeRequestParametersModel( + amount: details.paymentAmount.multiplying(by: 100).intValue, currency: details.currency, paymentMethodId: paymentMethodId + ) + self.processURLRequest(requestParametersModel, and: accessToken, completion) + case .failure(let error): + completion(.failure(error)) + } + } + } +} diff --git a/OSPaymentsLib/Models/OSPMTAddressModel.swift b/OSPaymentsLib/Models/OSPMTAddressModel.swift new file mode 100644 index 0000000..336c4f5 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTAddressModel.swift @@ -0,0 +1,74 @@ +/// Address Information related to a Billing or Shipping Information +struct OSPMTAddressModel: Codable, Equatable { + let postalCode: String + let fullAddress: String + let countryCode: String + let city: String + let administrativeArea: String? + let state: String? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case postalCode, fullAddress, countryCode, city, administrativeArea, state + } + + /// Constructor method + /// - Parameters: + /// - postalCode: Zip code. + /// - fullAddress: Text containing full address (e.g. street, door number, floor, ...) + /// - countryCode: ISO 3166-1 country code representation of the country. + /// - city: City. + /// - administrativeArea: Administrative Area, if existing. + /// - state: State, if existing. + init(postalCode: String, fullAddress: String, countryCode: String, city: String, administrativeArea: String? = nil, state: String? = nil) { + self.postalCode = postalCode + self.fullAddress = fullAddress + self.countryCode = countryCode + self.city = city + self.administrativeArea = administrativeArea + self.state = state + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let postalCode = try container.decode(String.self, forKey: .postalCode) + let fullAddress = try container.decode(String.self, forKey: .fullAddress) + let countryCode = try container.decode(String.self, forKey: .countryCode) + let city = try container.decode(String.self, forKey: .city) + let administrativeArea = try container.decodeIfPresent(String.self, forKey: .administrativeArea) + let state = try container.decodeIfPresent(String.self, forKey: .state) + self.init( + postalCode: postalCode, + fullAddress: fullAddress, + countryCode: countryCode, + city: city, + administrativeArea: administrativeArea, + state: state + ) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(postalCode, forKey: .postalCode) + try container.encode(fullAddress, forKey: .fullAddress) + try container.encode(countryCode, forKey: .countryCode) + try container.encode(city, forKey: .city) + try container.encodeIfPresent(administrativeArea, forKey: .administrativeArea) + try container.encodeIfPresent(state, forKey: .state) + } +} diff --git a/OSPaymentsLib/Models/OSPMTConfigurationModel.swift b/OSPaymentsLib/Models/OSPMTConfigurationModel.swift new file mode 100644 index 0000000..0ee249e --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTConfigurationModel.swift @@ -0,0 +1,255 @@ +import PassKit + +/// Model that manages the Payment Service Provider's configuration. +struct OSPMTGatewayModel: Encodable { + let gateway: String + let publishableKey: String? + let requestURL: String + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case gateway + case publishableKey + case requestURL + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(gateway, forKey: .gateway) + try container.encodeIfPresent(publishableKey, forKey: .publishableKey) + try container.encode(requestURL, forKey: .requestURL) + } +} + +extension OSPMTGatewayModel { + var gatewayEnum: OSPMTGateway? { + return OSPMTGateway.convert(from: self.gateway) + } +} + +/// Model that contains all properties needed to configure a payment service. +class OSPMTConfigurationModel: Encodable { + // MARK: Merchant Information + var merchantID: String? + var merchantName: String? + var merchantCountryCode: String? + + // MARK: Payment Information + var paymentAllowedNetworks: [String]? + var paymentSupportedCapabilities: [String]? + var paymentSupportedCardCountries: [String]? + + // MARK: Shipping Information + var shippingSupportedContacts: [String]? + + // MARK: Billing Information + var billingSupportedContacts: [String]? + + // MARK: Payment Service Provider Information + var gatewayModel: OSPMTGatewayModel? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case merchantID + case merchantName + case merchantCountryCode + case paymentAllowedNetworks + case paymentSupportedCapabilities + case paymentSupportedCardCountries + case shippingSupportedContacts + case billingSupportedContacts + case gatewayModel = "tokenization" + } + + /// Constructor method. + /// - Parameters: + /// - merchantID: Merchant ID configured + /// - merchantName: Merchant Name configured + /// - merchantCountryCode: Merchant Country Code configured + /// - paymentAllowedNetworks: Payment Allowed Networks configured + /// - paymentSupportedCapabilities: Payment Supported Capabilities configured + /// - paymentSupportedCardCountries: Payment Support Card Countries configured + /// - shippingSupportedContacts: Shipping Supported Contacts configured + /// - billingSupportedContacts: Billing Supported Contacts configured + /// - tokenization: Payment Service Gateway configured + init( + merchantID: String?, + merchantName: String?, + merchantCountryCode: String?, + paymentAllowedNetworks: [String]?, + paymentSupportedCapabilities: [String]?, + paymentSupportedCardCountries: [String]?, + shippingSupportedContacts: [String]?, + billingSupportedContacts: [String]?, + gatewayModel: OSPMTGatewayModel? + ) { + self.merchantID = merchantID + self.merchantName = merchantName + self.merchantCountryCode = merchantCountryCode + self.paymentAllowedNetworks = paymentAllowedNetworks + self.paymentSupportedCapabilities = paymentSupportedCapabilities + self.paymentSupportedCardCountries = paymentSupportedCardCountries + self.shippingSupportedContacts = shippingSupportedContacts + self.billingSupportedContacts = billingSupportedContacts + self.gatewayModel = gatewayModel + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + // MARK: Merchant Information + try container.encodeIfPresent(merchantID, forKey: .merchantID) + try container.encodeIfPresent(merchantName, forKey: .merchantName) + try container.encodeIfPresent(merchantCountryCode, forKey: .merchantCountryCode) + + // MARK: Payment Information + try container.encodeIfPresent(paymentAllowedNetworks, forKey: .paymentAllowedNetworks) + try container.encodeIfPresent(paymentSupportedCapabilities, forKey: .paymentSupportedCapabilities) + try container.encodeIfPresent(paymentSupportedCardCountries, forKey: .paymentSupportedCardCountries) + + // MARK: Shipping Information + try container.encodeIfPresent(shippingSupportedContacts, forKey: .shippingSupportedContacts) + + // MARK: Billing Information + try container.encodeIfPresent(billingSupportedContacts, forKey: .billingSupportedContacts) + + // MARK: Payment Service Provider Information + try container.encodeIfPresent(gatewayModel, forKey: .gatewayModel) + } +} + +public typealias OSPMTConfiguration = [String: Any] + +/// Manages all configuration properties required to enable Apple Pay in the plugin. +class OSPMTApplePayConfiguration: OSPMTConfigurationModel { + struct ConfigurationKeys { + static let merchantID = "ApplePayMerchantID" + static let merchantName = "ApplePayMerchantName" + static let merchantCountryCode = "ApplePayMerchantCountryCode" + + static let paymentAllowedNetworks = "ApplePayPaymentAllowedNetworks" + static let paymentSupportedCapabilities = "ApplePayPaymentSupportedCapabilities" + static let paymentSupportedCardCountries = "ApplePayPaymentSupportedCardCountries" + + static let shippingSupportedContacts = "ApplePayShippingSupportedContacts" + + static let billingSupportedContacts = "ApplePayBillingSupportedContacts" + + static let paymentGateway = "ApplePayPaymentGateway" + static let paymentGatewayName = "ApplePayPaymentGatewayName" + static let paymentRequestURL = "ApplePayRequestURL" + static let stripePublishableKey = "ApplePayStripePublishableKey" + } + + /// Constructor method. + /// - Parameter source: Source class contaning the configuration. + convenience init(source: OSPMTConfiguration) { + // MARK: Merchant Information + let merchantID: String? = Self.getRequiredProperty(forSource: source, andKey: ConfigurationKeys.merchantID) + let merchantName: String? = Self.getRequiredProperty(forSource: source, andKey: ConfigurationKeys.merchantName) + let merchantCountryCode: String? = Self.getRequiredProperty(forSource: source, andKey: ConfigurationKeys.merchantCountryCode) + + // MARK: Payment Information + let paymentAllowedNetworks: [String]? = Self.getRequiredProperty(forSource: source, andKey: ConfigurationKeys.paymentAllowedNetworks) + let paymentSupportedCapabilities: [String]? = Self.getRequiredProperty( + forSource: source, andKey: ConfigurationKeys.paymentSupportedCapabilities + ) + let paymentSupportedCardCountries: [String]? = Self.getProperty(forSource: source, andKey: ConfigurationKeys.paymentSupportedCardCountries) + + // MARK: Shipping Information + let shippingSupportedContacts: [String]? = Self.getProperty(forSource: source, andKey: ConfigurationKeys.shippingSupportedContacts) + + // MARK: Billing Information + let billingSupportedContacts: [String]? = Self.getProperty(forSource: source, andKey: ConfigurationKeys.billingSupportedContacts) + + // MARK: Payment Service Provider Information + var gatewayModel: OSPMTGatewayModel? + if let providerGateway: [String: Any] = Self.getProperty(forSource: source, andKey: ConfigurationKeys.paymentGateway), + let providerGatewayName = providerGateway[ConfigurationKeys.paymentGatewayName] as? String, + let requestURL = providerGateway[ConfigurationKeys.paymentRequestURL] as? String { + let publishableKey = providerGateway[ConfigurationKeys.stripePublishableKey] as? String + gatewayModel = OSPMTGatewayModel(gateway: providerGatewayName, publishableKey: publishableKey, requestURL: requestURL) + } + + self.init( + merchantID: merchantID, + merchantName: merchantName, + merchantCountryCode: merchantCountryCode, + paymentAllowedNetworks: paymentAllowedNetworks, + paymentSupportedCapabilities: paymentSupportedCapabilities, + paymentSupportedCardCountries: paymentSupportedCardCountries, + shippingSupportedContacts: shippingSupportedContacts, + billingSupportedContacts: billingSupportedContacts, + gatewayModel: gatewayModel + ) + } +} + +private extension OSPMTApplePayConfiguration { + /// Fetches the parameter property, if it exists. + /// - Parameters: + /// - type: Type of variable to return. + /// - key: Property key to search from. + /// - isRequired: Indicates if the property is mandatory or not. + /// - Returns: The configuration property, if it exists. + static func getProperty(forSource source: OSPMTConfiguration, andKey key: String, isRequired: Bool = false) -> T? { + let result = source[key] as? T + return !isRequired || result?.isEmpty == false ? result : nil + } + + /// An acelerator for `getProperty(ofType:forKey:isRequired:)`, that should be used for mandatory properties. + /// - Parameters: + /// - type: Type of variable to return. + /// - key: Property key to search from. + /// - Returns: The configuration property, if it exists. + static func getRequiredProperty(forSource source: OSPMTConfiguration, andKey key: String) -> T? { + self.getProperty(forSource: source, andKey: key, isRequired: true) + } +} + +extension OSPMTApplePayConfiguration { + var supportedNetworks: [PKPaymentNetwork]? { + guard let paymentAllowedNetworks = self.paymentAllowedNetworks else { return nil } + let result = paymentAllowedNetworks.compactMap(PKPaymentNetwork.convert(from:)) + + return !result.isEmpty ? result : nil + } + + var merchantCapabilities: PKMerchantCapability? { + guard let paymentSupportedCapabilities = self.paymentSupportedCapabilities else { return nil } + + var result: PKMerchantCapability = [] + result = paymentSupportedCapabilities.reduce(into: result) { partialResult, capability in + let merchantCapability = PKMerchantCapability.convert(from: capability) + if let merchantCapability = merchantCapability { + partialResult.insert(merchantCapability) + } + } + + return !result.isEmpty ? result : nil + } + + var supportedCountries: Set? { + guard let paymentSupportedCardCountries = self.paymentSupportedCardCountries, !paymentSupportedCardCountries.isEmpty else { return nil } + return Set(paymentSupportedCardCountries) + } +} diff --git a/OSPaymentsLib/Models/OSPMTContactInfoModel.swift b/OSPaymentsLib/Models/OSPMTContactInfoModel.swift new file mode 100644 index 0000000..d75fe48 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTContactInfoModel.swift @@ -0,0 +1,72 @@ +/// Information related to Billing or Shipping +struct OSPMTContactInfoModel: Codable { + let address: OSPMTAddressModel? + let phoneNumber: String? + let name: String? + let email: String? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case address, phoneNumber, name, email + } + + /// Constructor method. + /// - Parameters: + /// - address: Address information, if existing. + /// - phoneNumber: Phone number information, if existing. + /// - name: Given and family name, if existing. + /// - email: Email address, if existing. + init(address: OSPMTAddressModel? = nil, phoneNumber: String? = nil, name: String? = nil, email: String? = nil) { + self.address = address + self.phoneNumber = phoneNumber + self.name = name + self.email = email + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let address = try container.decodeIfPresent(OSPMTAddressModel.self, forKey: .address) + let phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber) + let name = try container.decodeIfPresent(String.self, forKey: .name) + let email = try container.decodeIfPresent(String.self, forKey: .email) + self.init(address: address, phoneNumber: phoneNumber, name: name, email: email) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(address, forKey: .address) + try container.encodeIfPresent(phoneNumber, forKey: .phoneNumber) + try container.encodeIfPresent(name, forKey: .name) + try container.encodeIfPresent(email, forKey: .email) + } +} + +extension OSPMTContactInfoModel: Equatable { + /// Returns a Boolean value indicating whether two values are equal. + /// + /// Equality is the inverse of inequality. For any values `a` and `b`, + /// `a == b` implies that `a != b` is `false`. + /// + /// - Parameters: + /// - lhs: A value to compare. + /// - rhs: Another value to compare. + /// - Returns: The comparison result. + static func == (lhs: OSPMTContactInfoModel, rhs: OSPMTContactInfoModel) -> Bool { + lhs.address == rhs.address && lhs.phoneNumber == rhs.phoneNumber && lhs.name == rhs.name && lhs.email == rhs.email + } +} diff --git a/OSPaymentsLib/Models/OSPMTDataModel.swift b/OSPaymentsLib/Models/OSPMTDataModel.swift new file mode 100644 index 0000000..fe860fd --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTDataModel.swift @@ -0,0 +1,87 @@ +/// Payment Data Information +struct OSPMTDataModel: Codable { + let billingInfo: OSPMTContactInfoModel? + let cardDetails: String + let cardNetwork: String + let tokenData: OSPMTTokenInfoModel + let paymentServiceProviderData: OSPMTServiceProviderInfoModel? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case billingInfo, cardDetails, cardNetwork, tokenData, paymentServiceProviderData + } + + /// Constructor method. + /// - Parameters: + /// - billingInfo: Billing Information. + /// - cardDetails: The last four digits of the card used for payment. + /// - cardNetwork: The network of the card used for payment. + /// - tokenData: The data of the token used for payment. + /// - paymentServiceProviderData: Information related with the payment gateway process result. If can be `nil` if no Gateway was configured + init(billingInfo: OSPMTContactInfoModel? = nil, cardDetails: String, cardNetwork: String, tokenData: OSPMTTokenInfoModel, paymentServiceProviderData: OSPMTServiceProviderInfoModel? = nil) { + self.billingInfo = billingInfo + self.cardDetails = cardDetails + self.cardNetwork = cardNetwork + self.tokenData = tokenData + self.paymentServiceProviderData = paymentServiceProviderData + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let billingInfo = try container.decodeIfPresent(OSPMTContactInfoModel.self, forKey: .billingInfo) + let cardDetails = try container.decode(String.self, forKey: .cardDetails) + let cardNetwork = try container.decode(String.self, forKey: .cardNetwork) + let tokenData = try container.decode(OSPMTTokenInfoModel.self, forKey: .tokenData) + let paymentServiceProviderData = try container.decodeIfPresent(OSPMTServiceProviderInfoModel.self, forKey: .paymentServiceProviderData) + self.init( + billingInfo: billingInfo, + cardDetails: cardDetails, + cardNetwork: cardNetwork, + tokenData: tokenData, + paymentServiceProviderData: paymentServiceProviderData + ) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent(billingInfo, forKey: .billingInfo) + try container.encode(cardDetails, forKey: .cardDetails) + try container.encode(cardNetwork, forKey: .cardNetwork) + try container.encode(tokenData, forKey: .tokenData) + try container.encodeIfPresent(paymentServiceProviderData, forKey: .paymentServiceProviderData) + } +} + +extension OSPMTDataModel: Equatable { + /// Returns a Boolean value indicating whether two values are equal. + /// + /// Equality is the inverse of inequality. For any values `a` and `b`, + /// `a == b` implies that `a != b` is `false`. + /// + /// - Parameters: + /// - lhs: A value to compare. + /// - rhs: Another value to compare. + /// - Returns: The comparison result. + static func == (lhs: OSPMTDataModel, rhs: OSPMTDataModel) -> Bool { + lhs.billingInfo == rhs.billingInfo + && lhs.cardDetails == rhs.cardDetails + && lhs.cardNetwork == rhs.cardNetwork + && lhs.tokenData == rhs.tokenData + && lhs.paymentServiceProviderData == rhs.paymentServiceProviderData + } +} diff --git a/OSPaymentsLib/Models/OSPMTDetailsModel.swift b/OSPaymentsLib/Models/OSPMTDetailsModel.swift new file mode 100644 index 0000000..00989f2 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTDetailsModel.swift @@ -0,0 +1,108 @@ +import PassKit + +/// Status of the final value to be charged. +enum OSPMTStatus: String, Codable { + case final + case pending +} + +/// Structure of the shipping/billing information +struct OSPMTContact: Decodable { + let isCustom: Bool + let contactArray: [String]? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case isCustom + case contactArray = "contactInfo" + } + + /// Constructor method + /// - Parameters: + /// - isCustom: Indicates if the custom contact information should be used when trigger a payment request. + /// - contactArray: Shipping/Billing properties required for filling. + init(isCustom: Bool, contactArray: [String]?) { + self.isCustom = isCustom + self.contactArray = contactArray + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let isCustom = try container.decode(Bool.self, forKey: .isCustom) + let contactArray = isCustom ? try container.decodeIfPresent([String].self, forKey: .contactArray) : nil + self.init(isCustom: isCustom, contactArray: contactArray) + } +} + +/// Payment Details to be processed. +struct OSPMTDetailsModel: Decodable { + let amount: Decimal + let currency: String + let status: OSPMTStatus + let shippingContact: OSPMTContact + let billingContact: OSPMTContact + let gateway: OSPMTGateway? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case amount + case currency + case status + case shippingContact = "shippingContacts" + case billingContact = "billingContacts" + case gateway = "psp" + } + + /// Constructor method. + /// - Parameters: + /// - amount: Amount to be charged. + /// - currency: The three-letter ISO 4217 currency code. + /// - status: Final value status. + /// - shippingContact: Shipping properties required for filling. + /// - billingContact: Billiing properties required for filling. + /// - gateway: Payment service provided to be used for processing, if passed. + init(amount: Decimal, currency: String, status: OSPMTStatus, shippingContact: OSPMTContact, billingContact: OSPMTContact, gateway: String? = nil) { + self.amount = amount + self.currency = currency + self.status = status + self.shippingContact = shippingContact + self.billingContact = billingContact + self.gateway = OSPMTGateway.convert(from: gateway) + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let amount = try container.decode(Decimal.self, forKey: .amount) + let currency = try container.decode(String.self, forKey: .currency) + let status = try container.decode(OSPMTStatus.self, forKey: .status) + let shippingContact = try container.decode(OSPMTContact.self, forKey: .shippingContact) + let billingContact = try container.decode(OSPMTContact.self, forKey: .billingContact) + let gateway = try container.decodeIfPresent(String.self, forKey: .gateway) + self.init( + amount: amount, currency: currency, status: status, shippingContact: shippingContact, billingContact: billingContact, gateway: gateway + ) + } +} + +// MARK: Apple Pay extension +extension OSPMTDetailsModel { + var paymentAmount: NSDecimalNumber { + NSDecimalNumber(decimal: self.amount) + } + + var paymentSummaryItemType: PKPaymentSummaryItemType { + self.status == .pending ? .pending : .final + } +} diff --git a/OSPaymentsLib/Models/OSPMTRequestParametersModel.swift b/OSPaymentsLib/Models/OSPMTRequestParametersModel.swift new file mode 100644 index 0000000..9e3dcd4 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTRequestParametersModel.swift @@ -0,0 +1,36 @@ +/// Model to manage the gateway payment process' request parameters. +class OSPMTRequestParametersModel: Encodable { + let amount: Int + let currency: String + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case amount + case currency + } + + /// Constructor method. + /// - Parameters: + /// - amount: Amount to charge. + /// - currency: Currency to charge. + init(amount: Int, currency: String) { + self.amount = amount + self.currency = currency + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(amount, forKey: .amount) + try container.encode(currency, forKey: .currency) + } +} diff --git a/OSPaymentsLib/Models/OSPMTScopeModel.swift b/OSPaymentsLib/Models/OSPMTScopeModel.swift new file mode 100644 index 0000000..b20a855 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTScopeModel.swift @@ -0,0 +1,62 @@ +/// Payment Scope Information +struct OSPMTScopeModel: Codable { + let paymentData: OSPMTDataModel + let shippingInfo: OSPMTContactInfoModel? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case paymentData, shippingInfo + } + + /// Construct method. + /// - Parameters: + /// - paymentData: Payment Data Information. + /// - shippingInfo: Shipping Information Filled. + init(paymentData: OSPMTDataModel, shippingInfo: OSPMTContactInfoModel? = nil) { + self.paymentData = paymentData + self.shippingInfo = shippingInfo + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let paymentData = try container.decode(OSPMTDataModel.self, forKey: .paymentData) + let shippingInfo = try container.decodeIfPresent(OSPMTContactInfoModel.self, forKey: .shippingInfo) + self.init(paymentData: paymentData, shippingInfo: shippingInfo) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(paymentData, forKey: .paymentData) + try container.encodeIfPresent(shippingInfo, forKey: .shippingInfo) + } +} + +extension OSPMTScopeModel: Equatable { + /// Returns a Boolean value indicating whether two values are equal. + /// + /// Equality is the inverse of inequality. For any values `a` and `b`, + /// `a == b` implies that `a != b` is `false`. + /// + /// - Parameters: + /// - lhs: A value to compare. + /// - rhs: Another value to compare. + /// - Returns: The comparison result. + static func == (lhs: OSPMTScopeModel, rhs: OSPMTScopeModel) -> Bool { + lhs.paymentData == rhs.paymentData && lhs.shippingInfo == rhs.shippingInfo + } +} diff --git a/OSPaymentsLib/Models/OSPMTServiceProviderInfoModel.swift b/OSPaymentsLib/Models/OSPMTServiceProviderInfoModel.swift new file mode 100644 index 0000000..99a290b --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTServiceProviderInfoModel.swift @@ -0,0 +1,70 @@ +/// Enum indicating the payment processing status. +enum OSPMTProcessStatus: String { + case pending = "pending" + case success = "succeeded" + case fail = "failed" +} + +/// Model indicating the resuiting payment service provider's information. +struct OSPMTServiceProviderInfoModel: Codable { + let id: String + let status: OSPMTProcessStatus? + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case id + case status + } + + /// Constructor method. + /// - Parameters: + /// - id: Payment process identifier. + /// - status: Payment process status. + init(id: String, status: String) { + self.id = id + self.status = OSPMTProcessStatus(rawValue: status) + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let id = try container.decode(String.self, forKey: .id) + let status = try container.decode(String.self, forKey: .status) + self.init(id: id, status: status) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(id, forKey: .id) + try container.encode((status ?? .pending).rawValue, forKey: .status) + } +} + +extension OSPMTServiceProviderInfoModel: Equatable { + /// Returns a Boolean value indicating whether two values are equal. + /// + /// Equality is the inverse of inequality. For any values `a` and `b`, + /// `a == b` implies that `a != b` is `false`. + /// + /// - Parameters: + /// - lhs: A value to compare. + /// - rhs: Another value to compare. + /// - Returns: The comparison result. + static func == (lhs: OSPMTServiceProviderInfoModel, rhs: OSPMTServiceProviderInfoModel) -> Bool { + lhs.id == rhs.id && lhs.status == rhs.status + } +} diff --git a/OSPaymentsLib/Models/OSPMTTokenInfoModel.swift b/OSPaymentsLib/Models/OSPMTTokenInfoModel.swift new file mode 100644 index 0000000..b3167e7 --- /dev/null +++ b/OSPaymentsLib/Models/OSPMTTokenInfoModel.swift @@ -0,0 +1,47 @@ +/// Token Information Model +struct OSPMTTokenInfoModel: Codable, Equatable { + let token: String + let type: String + + /// Keys used to encode and decode the model. + enum CodingKeys: String, CodingKey { + case token, type + } + + /// Constructor method. + /// - Parameters: + /// - token: Token data text. + /// - type: Payment gateway (e.g. Payment Service Provider name). + init(token: String, type: String) { + self.token = token + self.type = type + } + + /// Creates a new instance by decoding from the given decoder. + /// + /// This initializer throws an error if reading from the decoder fails, or + /// if the data read is corrupted or otherwise invalid. + /// + /// - Parameter decoder: The decoder to read data from. + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let token = try container.decode(String.self, forKey: .token) + let type = try container.decode(String.self, forKey: .type) + self.init(token: token, type: type) + } + + /// Encodes this value into the given encoder. + /// + /// If the value fails to encode anything, `encoder` will encode an empty + /// keyed container in its place. + /// + /// This function throws an error if any values are invalid for the given + /// encoder's format. + /// + /// - Parameter encoder: The encoder to write data to. + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(token, forKey: .token) + try container.encode(type, forKey: .type) + } +} diff --git a/OSPaymentsLib/OSPMTApplePayHandler.swift b/OSPaymentsLib/OSPMTApplePayHandler.swift new file mode 100644 index 0000000..7bc4956 --- /dev/null +++ b/OSPaymentsLib/OSPMTApplePayHandler.swift @@ -0,0 +1,61 @@ +import Foundation + +/// Class resopnsible to manage the Apple Pay payment service requests. It delegates every operation type to its manager. +class OSPMTApplePayHandler: NSObject { + let configuration: OSPMTConfigurationModel + let availabilityBehaviour: OSPMTAvailabilityDelegate + let requestBehaviour: OSPMTRequestDelegate + + /// Constructor .method. + /// - Parameters: + /// - configuration: Configuration manager. + /// - availabilityBehaviour: Availability manager. + /// - requestBehaviour: Request trigger manager. + init(configuration: OSPMTConfigurationModel, availabilityBehaviour: OSPMTAvailabilityDelegate, requestBehaviour: OSPMTRequestDelegate) { + self.configuration = configuration + self.availabilityBehaviour = availabilityBehaviour + self.requestBehaviour = requestBehaviour + super.init() + } + + /// Constructor method. + /// - Parameter configurationSource: Configuration source, containing all values needed to configure. + convenience init(configurationSource: OSPMTConfiguration) { + let applePayConfiguration = OSPMTApplePayConfiguration(source: configurationSource) + let applePayAvailabilityBehaviour = OSPMTApplePayAvailabilityBehaviour(configuration: applePayConfiguration) + let applePayRequestBehaviour = OSPMTApplePayRequestBehaviour(configuration: applePayConfiguration) + self.init( + configuration: applePayConfiguration, availabilityBehaviour: applePayAvailabilityBehaviour, requestBehaviour: applePayRequestBehaviour + ) + } +} + +// MARK: - OSPMTHandlerProtocol Methods +extension OSPMTApplePayHandler: OSPMTHandlerDelegate { + /// Allows the configuration of the payment service. + /// - Returns: Returns a JSON mapping if successful or an error if anything failed. + func setupConfiguration() -> Result { + guard + let configurationData = try? JSONEncoder().encode(self.configuration), + let configurationText = String(data: configurationData, encoding: .utf8) + else { return .failure(.invalidConfiguration) } + return .success(configurationText) + } + + /// Checks for the Wallet and Payment availability. + /// - Returns: Returns `nil` if successful or an error otherwise. + func checkWalletAvailability() -> OSPMTError? { + self.availabilityBehaviour.checkWallet() + ?? self.availabilityBehaviour.checkPaymentAvailability() + ?? self.availabilityBehaviour.checkPaymentAvailabilityWithSetup() + } + + /// Sets Payment details and triggers its processing. + /// - Parameters: + /// - detailsModel: payment details information. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func set(_ detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) { + self.requestBehaviour.trigger(with: detailsModel, and: accessToken, completion) + } +} diff --git a/OSPaymentsLib/OSPMTPayments.swift b/OSPaymentsLib/OSPMTPayments.swift new file mode 100644 index 0000000..9539659 --- /dev/null +++ b/OSPaymentsLib/OSPMTPayments.swift @@ -0,0 +1,99 @@ +import Foundation + +/// Class that provides the bridge between the library and 3rd party consumers. +public class OSPMTPayments: NSObject { + private weak var delegate: OSPMTCallbackDelegate? + private let handler: OSPMTHandlerDelegate + + /// Constructor method. + /// - Parameters: + /// - delegate: Handles the asynchronous return calls. + /// - handler: Payment service handler. + init(delegate: OSPMTCallbackDelegate, handler: OSPMTHandlerDelegate) { + self.delegate = delegate + self.handler = handler + } + + /// Convenience method for Apple Pay. + /// - Parameters: + /// - delegate: Handles the asynchronous return calls. + /// - configurationSource: Configuration source, containing all values needed to configure. + public convenience init(applePayWithDelegate delegate: OSPMTCallbackDelegate, andConfiguration configurationSource: OSPMTConfiguration = Bundle.main.infoDictionary!) { + let applePayHandler = OSPMTApplePayHandler(configurationSource: configurationSource) + self.init(delegate: delegate, handler: applePayHandler) + } +} + +// MARK: - Action Methods to be called by Bridge +extension OSPMTPayments: OSPMTActionDelegate { + /// Sets up the payment configuration. + public func setupConfiguration() { + let result = self.handler.setupConfiguration() + + switch result { + case .success(let message): + self.delegate?.callback(result: message) + case .failure(let error): + self.delegate?.callback(error: error) + } + } + + /// Verifies the device is ready to process a payment, considering the configuration provided before. + public func checkWalletSetup() { + if let error = self.handler.checkWalletAvailability() { + self.delegate?.callback(error: error) + } else { + self.delegate?.callbackSuccess() + } + } + + /// Sets payment details and triggers the request process. + /// - Parameters: + /// - details: Payment details model serialized into a text field. + /// - accessToken: Authorisation token related with a full payment type. + public func set(_ details: String, and accessToken: String?) { + let detailsResult = self.decode(details) + switch detailsResult { + case .success(let detailsModel): + self.handler.set(detailsModel, and: accessToken) { [weak self] result in + guard let self = self else { return } + switch result { + case .success(let scopeModel): + let scopeResult = self.encode(scopeModel) + switch scopeResult { + case .success(let scopeText): + self.delegate?.callback(result: scopeText) + case .failure(let error): + self.delegate?.callback(error: error) + } + case .failure(let error): + self.delegate?.callback(error: error) + } + } + case .failure(let error): + self.delegate?.callback(error: error) + } + } +} + +extension OSPMTPayments { + /// Decodes the payment details information text into an `OSPMTDetailsModel` instance. If not successful, returns an error + /// - Parameter detailsText: Payment details information text. + /// - Returns: The resulting `OSPMTDetailsModel` or error. + func decode(_ detailsText: String) -> Result { + guard + let detailsData = detailsText.data(using: .utf8), + let detailsModel = try? JSONDecoder().decode(OSPMTDetailsModel.self, from: detailsData) + else { return .failure(.invalidDecodeDetails) } + return .success(detailsModel) + } + + /// Encondes the payment scope information model into text. If not successful, returns an error. + /// - Parameter scopeModel: Payment scope information model. + /// - Returns: The resulting text or error. + func encode(_ scopeModel: OSPMTScopeModel) -> Result { + guard let scopeData = try? JSONEncoder().encode(scopeModel), let scopeText = String(data: scopeData, encoding: .utf8) + else { return .failure(.invalidEncodeScope) } + return .success(scopeText) + } +} diff --git a/OSPaymentsLib/OSPaymentsLib.h b/OSPaymentsLib/OSPaymentsLib.h deleted file mode 100644 index 0a5367b..0000000 --- a/OSPaymentsLib/OSPaymentsLib.h +++ /dev/null @@ -1,12 +0,0 @@ - -#import - -//! Project version number for OSPaymentsLib. -FOUNDATION_EXPORT double OSPaymentsLibVersionNumber; - -//! Project version string for OSPaymentsLib. -FOUNDATION_EXPORT const unsigned char OSPaymentsLibVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/OSPaymentsLib/PrivacyInfo.xcprivacy b/OSPaymentsLib/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..960504a --- /dev/null +++ b/OSPaymentsLib/PrivacyInfo.xcprivacy @@ -0,0 +1,97 @@ + + + + + NSPrivacyTracking + + + NSPrivacyTrackingDomains + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeName + + NSPrivacyCollectedDataTypeLinked + + + NSPrivacyCollectedDataTypeTracking + + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeEmailAddress + + NSPrivacyCollectedDataTypeLinked + + + NSPrivacyCollectedDataTypeTracking + + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePhoneNumber + + NSPrivacyCollectedDataTypeLinked + + + NSPrivacyCollectedDataTypeTracking + + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePhysicalAddress + + NSPrivacyCollectedDataTypeLinked + + + NSPrivacyCollectedDataTypeTracking + + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePaymentInfo + + NSPrivacyCollectedDataTypeLinked + + + NSPrivacyCollectedDataTypeTracking + + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + NSPrivacyAccessedAPITypes + + + diff --git a/OSPaymentsLib/Protocols/OSPMTActionDelegate.swift b/OSPaymentsLib/Protocols/OSPMTActionDelegate.swift new file mode 100644 index 0000000..6b161cf --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTActionDelegate.swift @@ -0,0 +1,22 @@ +/// Protocol that provides the server actions the plugin provides. +public protocol OSPMTActionDelegate: AnyObject { + /// Sets up the payment configuration. + func setupConfiguration() + + /// Verifies the device is ready to process a payment, considering the configuration provided before. + func checkWalletSetup() + + /// Sets payment details and triggers the request proccess. + /// - Parameters: + /// - details: Payment details model serialized into a text field. + /// - accessToken: Authorisation token related with a full payment type. + func set(_ details: String, and accessToken: String?) +} + +public extension OSPMTActionDelegate { + /// Sets payment details and triggers the request proccess. This uses the default method without the `accessToken` parameter. + /// - Parameter details: Payment details model serialized into a text field. + func set(_ details: String) { + self.set(details, and: nil) + } +} diff --git a/OSPaymentsLib/Protocols/OSPMTAvailabilityDelegate.swift b/OSPaymentsLib/Protocols/OSPMTAvailabilityDelegate.swift new file mode 100644 index 0000000..e7ddf13 --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTAvailabilityDelegate.swift @@ -0,0 +1,98 @@ +import PassKit + +// MARK: - OSPMTWalletAvailabilityDelegate Protocol Methods +/// Protocol that is responsible to check if a Wallet is available to be used by the plugin. +protocol OSPMTWalletAvailabilityDelegate: AnyObject { + /// Verifies if the wallet is available for usage. + /// - Returns: A boolean indicating if the wallet is available. + static func isWalletAvailable() -> Bool +} + +// MARK: - OSPMTSetupAvailabilityDelegate Protocol and Related Methods +/// Protocol that is responsible to check if a Payment is available to be used by the plugin. +protocol OSPMTSetupAvailabilityDelegate: AnyObject { + /// Verifies if a payment is available for usage. + /// - Returns: A boolean indicating if a payment is available. + static func isPaymentAvailable() -> Bool +} + +/// Protocol that enhances the validation done by `OSPMTSetupAvailabilityDelegate` protocol and verifies Apple Pay availability. +protocol OSPMTApplePaySetupAvailabilityDelegate: OSPMTSetupAvailabilityDelegate { + /// Verifies if a payment is available for usage, given the passed payment networks and marchant capabilities + /// - Parameters: + /// - networks: Array of payment networks available by a merchant + /// - merchantCapabilities: Bit set containing the payment capabilities available by a merchant. + /// - Returns: A boolean indicating if the payment is available. + static func isPaymentAvailable(using networks: [PKPaymentNetwork]?, and merchantCapabilities: PKMerchantCapability?) -> Bool +} + +// MARK: - OSPMTAvailabilityDelegate Protocol Methods +/// Protocol that is responsible to verify if wallet and payment are ready to trigger a payment process. +protocol OSPMTAvailabilityDelegate: AnyObject { + /// Verifies if the wallet is ready to be used. + /// - Returns: A boolean indicating if it's ready or not. + func checkWallet() -> OSPMTError? + + /// Verifies if a payment request can be triggered. + /// - Parameter shouldVerifySetup: Indicates whether the plugin should also check its configuration properties. + /// - Returns: A boolean indicating if it's ready or not + func checkPayment(shouldVerifySetup: Bool) -> OSPMTError? +} + +extension OSPMTAvailabilityDelegate { + /// Verifies if a payment request can be triggered. It's the same as calling `checkPayment(shouldVerifySetup:)` with a `false` parameter. + /// - Returns: A boolean indicating if it's ready or not. + func checkPaymentAvailability() -> OSPMTError? { + self.checkPayment(shouldVerifySetup: false) + } + + /// Verifies if a payment request can be triggere, regarding its configuration properties. It's the same as calling `checkPayment(shouldVerifySetup:)` with a `true` parameter. + /// - Returns: A boolean indicating if it's ready or not. + func checkPaymentAvailabilityWithSetup() -> OSPMTError? { + self.checkPayment(shouldVerifySetup: true) + } +} + +// MARK: - OSPMTApplePayAvailabilityBehaviour Implementation Methods +/// Class responsible for verifying if Apple Wallet and Apple Pay are available and ready to be used. Apple Pay is also check against it's payment network and merchant capabilities. +class OSPMTApplePayAvailabilityBehaviour: OSPMTAvailabilityDelegate { + let configuration: OSPMTApplePayConfiguration + let walletAvailableBehaviour: OSPMTWalletAvailabilityDelegate.Type + let setupAvailableBehaviour: OSPMTApplePaySetupAvailabilityDelegate.Type + + /// Constructor method. + /// - Parameters: + /// - configuration: Apple Pay Configuration. + /// - walletAvailableBehaviour: Implementation of the protocol that verifies Apple Wallet availability. + /// - setupAvailableBehaviour: Implementation of the protocol that verifies Apple Pay payment availability. + init(configuration: OSPMTApplePayConfiguration, walletAvailableBehaviour: OSPMTWalletAvailabilityDelegate.Type = PKPassLibrary.self, setupAvailableBehaviour: OSPMTApplePaySetupAvailabilityDelegate.Type = PKPaymentAuthorizationController.self) { + self.configuration = configuration + self.walletAvailableBehaviour = walletAvailableBehaviour + self.setupAvailableBehaviour = setupAvailableBehaviour + } + + /// Verifies if the wallet is ready to be used. + /// - Returns: A boolean indicating if it's ready or not. + func checkWallet() -> OSPMTError? { + return !self.walletAvailableBehaviour.isWalletAvailable() ? .walletNotAvailable : nil + } + + /// Verifies if a payment request can be triggered. + /// - Parameter shouldVerifySetup: Indicates whether the plugin should also check its configuration properties. + /// - Returns: A boolean indicating if it's ready or not + func checkPayment(shouldVerifySetup: Bool) -> OSPMTError? { + var error: OSPMTError? + + if shouldVerifySetup { + if !self.setupAvailableBehaviour.isPaymentAvailable( + using: self.configuration.supportedNetworks, and: self.configuration.merchantCapabilities + ) { + error = .setupPaymentNotAvailable + } + } else if !self.setupAvailableBehaviour.isPaymentAvailable() { + error = .paymentNotAvailable + } + + return error + } +} diff --git a/OSPaymentsLib/Protocols/OSPMTCallbackDelegate.swift b/OSPaymentsLib/Protocols/OSPMTCallbackDelegate.swift new file mode 100644 index 0000000..2abd5c9 --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTCallbackDelegate.swift @@ -0,0 +1,24 @@ +/// Delegate for the callback return calls for the plugin +public protocol OSPMTCallbackDelegate: AnyObject { + func callback(result: String?, error: OSPMTError?) +} + +// MARK: OSPMTCallbackProtocol Default Implementation +extension OSPMTCallbackDelegate { + /// Triggers the callback when there's an error + /// - Parameter error: Error to be thrown + func callback(error: OSPMTError) { + self.callback(result: nil, error: error) + } + + /// Triggers the callback when there's a success text + /// - Parameter result: Text to be returned + func callback(result: String) { + self.callback(result: result, error: nil) + } + + /// Triggers the callback when there's a success without text + func callbackSuccess() { + self.callback(result: "") + } +} diff --git a/OSPaymentsLib/Protocols/OSPMTGatewayDelegate.swift b/OSPaymentsLib/Protocols/OSPMTGatewayDelegate.swift new file mode 100644 index 0000000..7fbd894 --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTGatewayDelegate.swift @@ -0,0 +1,47 @@ +import PassKit + +/// Delegate class that triggers the backend payment process request. +protocol OSPMTGatewayDelegate: AnyObject { + var urlRequest: URLRequest { get set } + var urlSession: URLSession { get } + + /// Triggers the process through the configured gateway. + /// - Parameters: + /// - payment: Apple Pay's payment request result. + /// - details: Payment details to trigger processing. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: Payment process result. If returns the process result in case of success or an error otherwise. + func process(_ payment: PKPayment, with details: OSPMTDetailsModel, and accessToken: String, _ completion: @escaping (Result) -> Void) +} + +extension OSPMTGatewayDelegate { + + /// Triggers the backend url request. + /// - Parameters: + /// - requestParameters: Model containing the request body to trigger + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: Payment process result. If returns the process result in case of success or an error otherwise. + func processURLRequest(_ requestParameters: OSPMTRequestParametersModel, and accessToken: String, _ completion: @escaping (Result) -> Void) { + self.urlRequest.httpMethod = "POST" + self.urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + self.urlRequest.setValue("application/json", forHTTPHeaderField: "Accept") + self.urlRequest.setValue(accessToken, forHTTPHeaderField: "Payments-Token") + + self.urlRequest.httpBody = try? JSONEncoder().encode(requestParameters) + let task = self.urlSession.dataTask(with: self.urlRequest) { data, response, error in + guard let response = response as? HTTPURLResponse, + response.statusCode == 200, + error == nil, + let data = data, + let responseModel = try? JSONDecoder().decode(OSPMTServiceProviderInfoModel.self, from: data), + responseModel.status != .fail + else { + completion(.failure(.paymentIssue)) + return + } + + completion(.success(responseModel)) + } + task.resume() + } +} diff --git a/OSPaymentsLib/Protocols/OSPMTHandlerDelegate.swift b/OSPaymentsLib/Protocols/OSPMTHandlerDelegate.swift new file mode 100644 index 0000000..9cbb498 --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTHandlerDelegate.swift @@ -0,0 +1,29 @@ +typealias OSPMTCompletionHandler = (Result) -> Void + +/// Protocol that provides all methods a Payment Service handler should implement. +protocol OSPMTHandlerDelegate: AnyObject { + /// Allows the configuration of the payment service. + /// - Returns: Returns a JSON mapping if successful or an error if anything failed. + func setupConfiguration() -> Result + + /// Checks for the Wallet and Payment availability. + /// - Returns: Returns `nil` if successful or an error otherwise. + func checkWalletAvailability() -> OSPMTError? + + /// Sets Payment details and triggers its processing. + /// - Parameters: + /// - detailsModel: payment details information. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func set(_ detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) +} + +extension OSPMTHandlerDelegate { + /// Sets Payment details and triggers its processing. It uses the default `set` method without the `accessToken` parameter. + /// - Parameters: + /// - detailsModel: payment details information. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func set(_ detailsModel: OSPMTDetailsModel, _ completion: @escaping OSPMTCompletionHandler) { + self.set(detailsModel, and: nil, completion) + } +} diff --git a/OSPaymentsLib/Protocols/OSPMTRequestDelegate.swift b/OSPaymentsLib/Protocols/OSPMTRequestDelegate.swift new file mode 100644 index 0000000..5922531 --- /dev/null +++ b/OSPaymentsLib/Protocols/OSPMTRequestDelegate.swift @@ -0,0 +1,174 @@ +import PassKit + +// MARK: - OSPMTRequestTriggerDelegate Protocol and Related Methods +typealias OSPMTRequestTriggerCompletion = ((Bool) -> Void) + +/// Protocol that is responsible to trigger a payment request.. +protocol OSPMTRequestTriggerDelegate: AnyObject { + /// Triggers a payment request. The result is processed asyncrhonously and returned by the `completion` parameters. + /// - Parameter completion: Block that returns the success of the payment request operation. + func triggerPayment(_ completion: @escaping OSPMTRequestTriggerCompletion) +} + +/// Protocol that enhances the validation done by `OSPMTRequestTriggerDelegate` protocol and triggers a payment request for Apple Pay.. +protocol OSPMTApplePayRequestTriggerDelegate: OSPMTRequestTriggerDelegate { + /// Creates an object responsible for dealing with the payment request process, delegating the details to the passed parameter. + /// - Parameters: + /// - detailsModel: Payment details. + /// - delegate: The object responsible for the request process' response. + /// - Returns: An instance of the object or an error, it the instatiation fails. + static func createRequestTriggerBehaviour(for detailsModel: OSPMTDetailsModel, andDelegate delegate: OSPMTApplePayRequestBehaviour?) -> Result +} + +/// Protocol that manages the process request, in order to process a payment transaction. +protocol OSPMTRequestDelegate: AnyObject { + /// Sets Payment details and triggers its processing. + /// - Parameters: + /// - detailsModel: payment details information. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func trigger(with detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) +} + +extension OSPMTRequestDelegate { + /// Sets Payment details and triggers its processing. It uses the default method without the `accessToken` parameter. + /// - Parameters: + /// - detailsModel: payment details information. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func trigger(with detailsModel: OSPMTDetailsModel, _ completion: @escaping OSPMTCompletionHandler) { + self.trigger(with: detailsModel, and: nil, completion) + } +} + +/// Class that implements the `OSPMTRequestDelegate` for Apple Pay, providing it the required that details to work. +class OSPMTApplePayRequestBehaviour: NSObject, OSPMTRequestDelegate { + let configuration: OSPMTApplePayConfiguration + var requestTriggerType: OSPMTApplePayRequestTriggerDelegate.Type + + var paymentStatus: PKPaymentAuthorizationStatus = .failure + var paymentScope: OSPMTScopeModel? + var paymentDetails: OSPMTDetailsModel? + var accessToken: String? + var completionHandler: OSPMTCompletionHandler! + + /// Constructor method. + /// - Parameters: + /// - configuration: Apple Pay configuration manager. + /// - requestTriggerType: Apple Pay request type, used to create a request trigger processor class. + init(configuration: OSPMTApplePayConfiguration, requestTriggerType: OSPMTApplePayRequestTriggerDelegate.Type = PKPaymentAuthorizationController.self) { + self.configuration = configuration + self.requestTriggerType = requestTriggerType + } + + /// Sets Payment details and triggers its processing. + /// - Parameters: + /// - detailsModel: payment details information. + /// - accessToken: Authorisation token related with a full payment type. + /// - completion: an async closure that can return a successful Payment Scope Model or an error otherwise. + func trigger(with detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) { + self.paymentDetails = detailsModel + self.accessToken = accessToken + self.completionHandler = completion + + let result = self.requestTriggerType.createRequestTriggerBehaviour(for: detailsModel, andDelegate: self) + switch result { + case .success(let paymentController): + paymentController.triggerPayment { [weak self] presented in + guard let self = self else { return } + + self.paymentStatus = .failure + if !presented { + completion(.failure(.paymentTriggerPresentationFailed)) + } + } + case .failure(let error): + completion(.failure(error)) + } + } +} + +extension OSPMTApplePayRequestBehaviour { + /// Converts payment details information into an Apple Pay `PKPaymentSummaryItem` array type. + /// - Parameter detailsModel: Payment details information. + /// - Returns: The corresponding value if success, nil otherwise. + func getPaymentSummaryItems(for detailsModel: OSPMTDetailsModel) -> [PKPaymentSummaryItem]? { + guard let label = self.configuration.merchantName else { return nil } + return [PKPaymentSummaryItem(label: label, amount: detailsModel.paymentAmount, type: detailsModel.paymentSummaryItemType)] + } + + /// Converts the shipping/billing contact information text into an Apple Pay `PKContactField` set type. + /// - Parameter text: The billing/shipping contact information. + /// - Returns: The corresponding value. + func getContactFields(for text: [String]?) -> Set { + var result = [PKContactField]() + if let text = text { + result.append(contentsOf: text.compactMap(PKContactField.convert(from:))) + } + return Set(result) + } +} + +// MARK: - Set up PKPaymentAuthorizationControllerDelegate conformance +extension OSPMTApplePayRequestBehaviour: PKPaymentAuthorizationControllerDelegate { + func paymentAuthorizationControllerDidFinish(_ controller: PKPaymentAuthorizationController) { + controller.dismiss() + // The payment sheet doesn't automatically dismiss once it has finished. Dismiss the payment sheet. + DispatchQueue.main.async { + if self.paymentStatus == .success, let paymentScope = self.paymentScope { + self.completionHandler(.success(paymentScope)) + } else { + self.completionHandler(.failure(.paymentCancelled)) + } + } + } + + func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void) { + func setPaymentResults(with errorArray: [OSPMTError], and scopeModel: OSPMTScopeModel?, _ completion: @escaping (PKPaymentAuthorizationResult) -> Void) { + if errorArray.isEmpty, let scopeModel = scopeModel { + self.paymentScope = scopeModel + self.paymentStatus = .success + } else { + self.paymentScope = nil + self.paymentStatus = .failure + } + + completion(PKPaymentAuthorizationResult(status: self.paymentStatus, errors: errorArray)) + } + + if let paymentDetails = paymentDetails, paymentDetails.gateway != nil { + guard let accessToken = self.accessToken, !accessToken.isEmpty else { + return completion(PKPaymentAuthorizationResult(status: self.paymentStatus, errors: [OSPMTError.tokenIssue])) + } + + guard let paymentGateway = self.configuration.gatewayModel, paymentGateway.gatewayEnum == paymentDetails.gateway else { + return completion(PKPaymentAuthorizationResult(status: self.paymentStatus, errors: [OSPMTError.gatewayNotConfigured])) + } + + guard let gatewayWrapper = OSPMTGatewayFactory.createWrapper(for: paymentGateway) else { + return completion(PKPaymentAuthorizationResult(status: self.paymentStatus, errors: [OSPMTError.gatewaySetFailed])) + } + + gatewayWrapper.process(payment, with: paymentDetails, and: accessToken) { result in + var errorArray = [OSPMTError]() + var paymentResultModel: OSPMTServiceProviderInfoModel? + + switch result { + case .success(let result): + paymentResultModel = result + case .failure(let error): + errorArray += [error] + } + + setPaymentResults(with: errorArray, and: payment.createScopeModel(for: paymentResultModel), completion) + } + } else { + setPaymentResults(with: [], and: payment.createScopeModel(), completion) + } + } + + /** + Despite the need to implement the method, this is not required by app's functionality. + For that reason, we're returning `nil` as the presentation window. + */ + func presentationWindow(for controller: PKPaymentAuthorizationController) -> UIWindow? { nil } +} diff --git a/OSPaymentsLibTests/ModelSpecs/OSPMTAddressModelSpec.swift b/OSPaymentsLibTests/ModelSpecs/OSPMTAddressModelSpec.swift new file mode 100644 index 0000000..ba53556 --- /dev/null +++ b/OSPaymentsLibTests/ModelSpecs/OSPMTAddressModelSpec.swift @@ -0,0 +1,221 @@ +import Nimble +import Quick + +@testable import OSPaymentsLib + +class OSPMTAddressModelSpec: QuickSpec { + struct TestConfiguration { + static let fullConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noPostalCodeConfig = [ + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noFullAddressConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noCountryCodeConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noCityConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noAdministrativeAreaConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.state.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noStateConfig = [ + OSPMTAddressModel.CodingKeys.postalCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.fullAddress.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.countryCode.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.city.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTAddressModel.CodingKeys.administrativeArea.rawValue: OSPMTTestConfigurations.dummyString + ] + + static let fullModel = OSPMTAddressModel( + postalCode: OSPMTTestConfigurations.dummyString, + fullAddress: OSPMTTestConfigurations.dummyString, + countryCode: OSPMTTestConfigurations.dummyString, + city: OSPMTTestConfigurations.dummyString, + administrativeArea: OSPMTTestConfigurations.dummyString, + state: OSPMTTestConfigurations.dummyString + ) + static let noAdministrativeAreaModel = OSPMTAddressModel( + postalCode: OSPMTTestConfigurations.dummyString, + fullAddress: OSPMTTestConfigurations.dummyString, + countryCode: OSPMTTestConfigurations.dummyString, + city: OSPMTTestConfigurations.dummyString, + state: OSPMTTestConfigurations.dummyString + ) + static let noStateModel = OSPMTAddressModel( + postalCode: OSPMTTestConfigurations.dummyString, + fullAddress: OSPMTTestConfigurations.dummyString, + countryCode: OSPMTTestConfigurations.dummyString, + city: OSPMTTestConfigurations.dummyString, + administrativeArea: OSPMTTestConfigurations.dummyString + ) + } + + override class func spec() { + describe("Given a full configuration") { + context("When decoding the Address Model") { + it("Should return a filled object") { + if let addressModel = OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.fullConfig) { + expect(addressModel).toNot(beNil()) + expect(addressModel.postalCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.fullAddress).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.countryCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.city).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.administrativeArea).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.state).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without Postal Code") { + context("When decoding the Address Model") { + it("Should return a nil value") { + if OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.noPostalCodeConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Full Address") { + context("When decoding the Address Model") { + it("Should return a nil value") { + if OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.noFullAddressConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Country Code") { + context("When decoding the Address Model") { + it("Should return a nil value") { + if OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.noCountryCodeConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without City") { + context("When decoding the Address Model") { + it("Should return a nil value") { + if OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.noCityConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Administrative Area") { + context("When decoding the Address Model") { + it("Should return a filled object") { + if let addressModel = OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.noAdministrativeAreaConfig) { + expect(addressModel).toNot(beNil()) + expect(addressModel.postalCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.fullAddress).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.countryCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.city).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.state).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without State") { + context("When decoding the Address Model") { + it("Should return a filled object") { + if let addressModel = OSPMTTestConfigurations.decode(for: OSPMTAddressModel.self, TestConfiguration.fullConfig) { + expect(addressModel).toNot(beNil()) + expect(addressModel.postalCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.fullAddress).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.countryCode).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.city).to(equal(OSPMTTestConfigurations.dummyString)) + expect(addressModel.administrativeArea).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full model") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let addressText = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(addressText).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without Adminsitrative Area") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let addressText = OSPMTTestConfigurations.encode(TestConfiguration.noAdministrativeAreaModel) { + expect(addressText).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without State") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let addressText = OSPMTTestConfigurations.encode(TestConfiguration.noStateModel) { + expect(addressText).toNot(beEmpty()) + } else { + fail() + } + } + } + } + } + +} diff --git a/OSPaymentsLibTests/ModelSpecs/OSPMTContactInfoModelSpec.swift b/OSPaymentsLibTests/ModelSpecs/OSPMTContactInfoModelSpec.swift new file mode 100644 index 0000000..d0c6583 --- /dev/null +++ b/OSPaymentsLibTests/ModelSpecs/OSPMTContactInfoModelSpec.swift @@ -0,0 +1,200 @@ +import Nimble +import Quick + +@testable import OSPaymentsLib + +class OSPMTContactInfoModelSpec: QuickSpec { + struct TestConfiguration { + static let fullConfig: [String: Any] = [ + OSPMTContactInfoModel.CodingKeys.address.rawValue: OSPMTAddressModelSpec.TestConfiguration.fullConfig, + OSPMTContactInfoModel.CodingKeys.phoneNumber.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.name.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.email.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noAddressConfig: [String: Any] = [ + OSPMTContactInfoModel.CodingKeys.phoneNumber.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.name.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.email.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noPhoneNumberConfig: [String: Any] = [ + OSPMTContactInfoModel.CodingKeys.address.rawValue: OSPMTTestConfigurations.dummyContactInfoModel, + OSPMTContactInfoModel.CodingKeys.name.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.email.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noNameConfig: [String: Any] = [ + OSPMTContactInfoModel.CodingKeys.address.rawValue: OSPMTTestConfigurations.dummyContactInfoModel, + OSPMTContactInfoModel.CodingKeys.phoneNumber.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.email.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noEmailConfig: [String: Any] = [ + OSPMTContactInfoModel.CodingKeys.address.rawValue: OSPMTTestConfigurations.dummyContactInfoModel, + OSPMTContactInfoModel.CodingKeys.phoneNumber.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTContactInfoModel.CodingKeys.name.rawValue: OSPMTTestConfigurations.dummyString + ] + + static let fullModel = OSPMTContactInfoModel( + address: OSPMTTestConfigurations.dummyAddressModel, + phoneNumber: OSPMTTestConfigurations.dummyString, + name: OSPMTTestConfigurations.dummyString, + email: OSPMTTestConfigurations.dummyString + ) + static let noAddressModel = OSPMTContactInfoModel( + phoneNumber: OSPMTTestConfigurations.dummyString, + name: OSPMTTestConfigurations.dummyString, + email: OSPMTTestConfigurations.dummyString + ) + static let noPhoneNumberModel = OSPMTContactInfoModel( + address: OSPMTTestConfigurations.dummyAddressModel, + name: OSPMTTestConfigurations.dummyString, + email: OSPMTTestConfigurations.dummyString + ) + static let noNameModel = OSPMTContactInfoModel( + address: OSPMTTestConfigurations.dummyAddressModel, + phoneNumber: OSPMTTestConfigurations.dummyString, + email: OSPMTTestConfigurations.dummyString + ) + static let noEmailModel = OSPMTContactInfoModel( + address: OSPMTTestConfigurations.dummyAddressModel, + phoneNumber: OSPMTTestConfigurations.dummyString, + name: OSPMTTestConfigurations.dummyString + ) + } + + override class func spec() { + describe("Given a full configuration") { + context("When decoding the Contact Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTContactInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.address).to(equal(OSPMTAddressModelSpec.TestConfiguration.fullModel)) + expect(model.phoneNumber).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.name).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.email).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without address") { + context("When decoding the Contact Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTContactInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.phoneNumber).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.name).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.email).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without phone number") { + context("When decoding the Contact Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTContactInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.address).to(equal(OSPMTAddressModelSpec.TestConfiguration.fullModel)) + expect(model.name).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.email).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without name") { + context("When decoding the Contact Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTContactInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.address).to(equal(OSPMTAddressModelSpec.TestConfiguration.fullModel)) + expect(model.phoneNumber).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.email).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without email") { + context("When decoding the Contact Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTContactInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.address).to(equal(OSPMTAddressModelSpec.TestConfiguration.fullModel)) + expect(model.phoneNumber).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.name).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full model") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without address") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.noAddressModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without phone number") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.noPhoneNumberModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without name") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.noNameModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without email") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.noEmailModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/ModelSpecs/OSPMTDataModelSpec.swift b/OSPaymentsLibTests/ModelSpecs/OSPMTDataModelSpec.swift new file mode 100644 index 0000000..cd6a248 --- /dev/null +++ b/OSPaymentsLibTests/ModelSpecs/OSPMTDataModelSpec.swift @@ -0,0 +1,141 @@ +import Nimble +import Quick + +@testable import OSPaymentsLib + +class OSPMTDataModelSpec: QuickSpec { + struct TestConfiguration { + static let fullConfig: [String: Any] = [ + OSPMTDataModel.CodingKeys.billingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig, + OSPMTDataModel.CodingKeys.cardDetails.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.cardNetwork.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.tokenData.rawValue: OSPMTTokenInfoModelSpec.TestConfiguration.fullConfig + ] + static let noBillingInfoConfig: [String: Any] = [ + OSPMTDataModel.CodingKeys.cardDetails.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.cardNetwork.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.tokenData.rawValue: OSPMTTokenInfoModelSpec.TestConfiguration.fullConfig + ] + static let noCardDetailsConfig: [String: Any] = [ + OSPMTDataModel.CodingKeys.billingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig, + OSPMTDataModel.CodingKeys.cardNetwork.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.tokenData.rawValue: OSPMTTokenInfoModelSpec.TestConfiguration.fullConfig + ] + static let noCardNetworkConfig: [String: Any] = [ + OSPMTDataModel.CodingKeys.billingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig, + OSPMTDataModel.CodingKeys.cardDetails.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.tokenData.rawValue: OSPMTTokenInfoModelSpec.TestConfiguration.fullConfig + ] + static let noTokenDataConfig: [String: Any] = [ + OSPMTDataModel.CodingKeys.billingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig, + OSPMTDataModel.CodingKeys.cardDetails.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTDataModel.CodingKeys.cardNetwork.rawValue: OSPMTTestConfigurations.dummyString + ] + + static let fullModel = OSPMTDataModel( + billingInfo: OSPMTContactInfoModelSpec.TestConfiguration.fullModel, + cardDetails: OSPMTTestConfigurations.dummyString, + cardNetwork: OSPMTTestConfigurations.dummyString, + tokenData: OSPMTTokenInfoModelSpec.TestConfiguration.fullModel + ) + static let noBillingModel = OSPMTDataModel( + cardDetails: OSPMTTestConfigurations.dummyString, + cardNetwork: OSPMTTestConfigurations.dummyString, + tokenData: OSPMTTokenInfoModelSpec.TestConfiguration.fullModel + ) + } + + override class func spec() { + describe("Given a full configuration") { + context("When decoding the Data Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTDataModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.billingInfo).toNot(beNil()) + expect(model.cardDetails).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.cardNetwork).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.tokenData).to(equal(OSPMTTokenInfoModelSpec.TestConfiguration.fullModel)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without Billing Info") { + context("When decoding the Data Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTDataModel.self, TestConfiguration.noBillingInfoConfig) { + expect(model).toNot(beNil()) + expect(model.billingInfo).to(beNil()) + expect(model.cardDetails).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.cardNetwork).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.tokenData).to(equal(OSPMTTokenInfoModelSpec.TestConfiguration.fullModel)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without Card Details") { + context("When decoding the Data Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTDataModel.self, TestConfiguration.noCardDetailsConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Card Network") { + context("When decoding the Data Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTDataModel.self, TestConfiguration.noCardNetworkConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Token Data") { + context("When decoding the Data Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTDataModel.self, TestConfiguration.noTokenDataConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full model") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without Billing Info") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.noBillingModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/ModelSpecs/OSPMTScopeModelSpec.swift b/OSPaymentsLibTests/ModelSpecs/OSPMTScopeModelSpec.swift new file mode 100644 index 0000000..42aa7ad --- /dev/null +++ b/OSPaymentsLibTests/ModelSpecs/OSPMTScopeModelSpec.swift @@ -0,0 +1,90 @@ +import Nimble +import Quick + +@testable import OSPaymentsLib +import PassKit + +class OSPMTScopeModelSpec: QuickSpec { + struct TestConfiguration { + static let fullConfig = [ + OSPMTScopeModel.CodingKeys.paymentData.rawValue: OSPMTDataModelSpec.TestConfiguration.fullConfig, + OSPMTScopeModel.CodingKeys.shippingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig + ] + static let noPaymentDataConfig = [OSPMTScopeModel.CodingKeys.shippingInfo.rawValue: OSPMTContactInfoModelSpec.TestConfiguration.fullConfig] + static let noShippingInfoConfig = [OSPMTScopeModel.CodingKeys.paymentData.rawValue: OSPMTDataModelSpec.TestConfiguration.fullConfig] + + static let fullModel = OSPMTScopeModel( + paymentData: OSPMTDataModelSpec.TestConfiguration.fullModel, + shippingInfo: OSPMTContactInfoModelSpec.TestConfiguration.fullModel + ) + static let noShippingInfoModel = OSPMTScopeModel(paymentData: OSPMTDataModelSpec.TestConfiguration.fullModel) + + static let paymentRequest = PKPaymentRequest() + } + + override class func spec() { + describe("Given a full configuration") { + context("When decoding the Data Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTScopeModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.paymentData).toNot(beNil()) + expect(model.shippingInfo).toNot(beNil()) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without Payment Data") { + context("When decoding the Data Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTScopeModel.self, TestConfiguration.noPaymentDataConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without Billing Info") { + context("When decoding the Data Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTScopeModel.self, TestConfiguration.noShippingInfoConfig) { + expect(model).toNot(beNil()) + expect(model.paymentData).toNot(beNil()) + expect(model.shippingInfo).to(beNil()) + } else { + fail() + } + } + } + } + + describe("Given a full model") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + + describe("Given a full model without Shipping Info") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/ModelSpecs/OSPMTTokenInfoModelSpec.swift b/OSPaymentsLibTests/ModelSpecs/OSPMTTokenInfoModelSpec.swift new file mode 100644 index 0000000..0ec8e34 --- /dev/null +++ b/OSPaymentsLibTests/ModelSpecs/OSPMTTokenInfoModelSpec.swift @@ -0,0 +1,69 @@ +import Nimble +import Quick + +@testable import OSPaymentsLib + +class OSPMTTokenInfoModelSpec: QuickSpec { + struct TestConfiguration { + static let fullConfig = [ + OSPMTTokenInfoModel.CodingKeys.token.rawValue: OSPMTTestConfigurations.dummyString, + OSPMTTokenInfoModel.CodingKeys.type.rawValue: OSPMTTestConfigurations.dummyString + ] + static let noTokenConfig = [OSPMTTokenInfoModel.CodingKeys.type.rawValue: OSPMTTestConfigurations.dummyString] + static let noTypeConfig = [OSPMTTokenInfoModel.CodingKeys.token.rawValue: OSPMTTestConfigurations.dummyString] + + static let fullModel = OSPMTTokenInfoModel(token: OSPMTTestConfigurations.dummyString, type: OSPMTTestConfigurations.dummyString) + } + + override class func spec() { + describe("Given a full configuration") { + context("When decoding the Token Info Model") { + it("Should return a filled object") { + if let model = OSPMTTestConfigurations.decode(for: OSPMTTokenInfoModel.self, TestConfiguration.fullConfig) { + expect(model).toNot(beNil()) + expect(model.token).to(equal(OSPMTTestConfigurations.dummyString)) + expect(model.type).to(equal(OSPMTTestConfigurations.dummyString)) + } else { + fail() + } + } + } + } + + describe("Given a full configuration without token") { + context("When decoding the Token Info Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTTokenInfoModel.self, TestConfiguration.noTokenConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full configuration without type") { + context("When decoding the Token Info Model") { + it("Should return a nil object") { + if OSPMTTestConfigurations.decode(for: OSPMTTokenInfoModel.self, TestConfiguration.noTypeConfig) != nil { + fail() + } else { + expect(true).to(beTruthy()) + } + } + } + } + + describe("Given a full model") { + context("When encoding it into JSON") { + it("Should return a filled object") { + if let text = OSPMTTestConfigurations.encode(TestConfiguration.fullModel) { + expect(text).toNot(beEmpty()) + } else { + fail() + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTApplePayAvailabilityBehaviourSpec.swift b/OSPaymentsLibTests/OSPMTApplePayAvailabilityBehaviourSpec.swift new file mode 100644 index 0000000..0c7e6f3 --- /dev/null +++ b/OSPaymentsLibTests/OSPMTApplePayAvailabilityBehaviourSpec.swift @@ -0,0 +1,109 @@ +import Nimble +import PassKit +import Quick +@testable import OSPaymentsLib + +class MockWalletAvailableBehaviour: OSPMTWalletAvailabilityDelegate { + static var result: Bool = false + + static func isWalletAvailable() -> Bool { + return Self.result + } +} + +class MockSetupAvailableBehaviour: OSPMTApplePaySetupAvailabilityDelegate { + static var setupAvailable: Bool = false + static var paymentAvailable: Bool = false + + static func isPaymentAvailable(using networks: [PKPaymentNetwork]?, and merchantCapabilities: PKMerchantCapability?) -> Bool { + return Self.setupAvailable + } + + static func isPaymentAvailable() -> Bool { + return Self.paymentAvailable + } +} + +class OSPMTApplePayAvailabilityBehaviourSpec: QuickSpec { + override class func spec() { + var applePayAvailabilityBehaviour: OSPMTApplePayAvailabilityBehaviour! + + let mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig) + + describe("Given an AvailabilityBehaviour") { + beforeEach { + applePayAvailabilityBehaviour = OSPMTApplePayAvailabilityBehaviour( + configuration: mockConfiguration, + walletAvailableBehaviour: MockWalletAvailableBehaviour.self, + setupAvailableBehaviour: MockSetupAvailableBehaviour.self + ) + } + + context("When a Wallet is not available") { + beforeEach { + MockWalletAvailableBehaviour.result = false + } + + it("should return a WalletNotAvailable error") { + let result = applePayAvailabilityBehaviour.checkWallet() + expect(result).to(equal(.walletNotAvailable)) + } + } + + context("When a Wallet is available") { + beforeEach { + MockWalletAvailableBehaviour.result = true + } + + it("should succeed and return nil") { + let result = applePayAvailabilityBehaviour.checkWallet() + expect(result).to(beNil()) + } + } + + context("When Payment is not available") { + beforeEach { + MockSetupAvailableBehaviour.paymentAvailable = false + } + + it("should return a PaymentNotAvailable error") { + let result = applePayAvailabilityBehaviour.checkPaymentAvailability() + expect(result).to(equal(.paymentNotAvailable)) + } + } + + context("When Payment is available") { + beforeEach { + MockSetupAvailableBehaviour.paymentAvailable = true + } + + it("should succeed and return nil") { + let result = applePayAvailabilityBehaviour.checkPaymentAvailability() + expect(result).to(beNil()) + } + } + + context("When Payment Setup is not available") { + beforeEach { + MockSetupAvailableBehaviour.setupAvailable = false + } + + it("should return a PaymentNotAvailable error") { + let result = applePayAvailabilityBehaviour.checkPaymentAvailabilityWithSetup() + expect(result).to(equal(.setupPaymentNotAvailable)) + } + } + + context("When Payment Setup is available") { + beforeEach { + MockSetupAvailableBehaviour.setupAvailable = true + } + + it("should succeed and return nil") { + let result = applePayAvailabilityBehaviour.checkPaymentAvailabilityWithSetup() + expect(result).to(beNil()) + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTApplePayConfigurationSpec.swift b/OSPaymentsLibTests/OSPMTApplePayConfigurationSpec.swift new file mode 100644 index 0000000..d889705 --- /dev/null +++ b/OSPaymentsLibTests/OSPMTApplePayConfigurationSpec.swift @@ -0,0 +1,118 @@ +import Nimble +import PassKit +import Quick +@testable import OSPaymentsLib + +class OSPMTApplePayConfigurationSpec: QuickSpec { + override class func spec() { + var applePayConfiguration: OSPMTApplePayConfiguration! + + describe("Given a correct configuration") { + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig) + } + + context("When checking the Supported Networks property") { + it("should return a valid value") { + expect(applePayConfiguration.supportedNetworks).to(equal([PKPaymentNetwork.visa, .masterCard])) + } + } + + context("When checking the Merchant Capabilities property") { + it("should return a valid value") { + expect(applePayConfiguration.merchantCapabilities).to(equal([PKMerchantCapability.capability3DS, .capabilityEMV])) + } + } + + context("When checking the Supported Countries property") { + it("should return a valid value") { + expect(applePayConfiguration.supportedCountries).to(equal(Set([OSPMTTestConfigurations.dummyString]))) + } + } + } + + describe("Given a configuration with both valid an invalid values") { + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityWithErrorConfig) + } + + context("When checking the Supported Networks property") { + it("should return a valid value without the invalid one") { + expect(applePayConfiguration.supportedNetworks).to(equal([PKPaymentNetwork.visa])) + } + } + + context("When checking the Merchant Capabilities property") { + it("should return a valid value without the invalid one") { + expect(applePayConfiguration.merchantCapabilities).to(equal(.capability3DS)) + } + } + } + + describe("Given a configuration with an invalid value") { + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.invalidNetworkCapabilityConfig) + } + + context("When checking the Supported Networks property") { + it("should return a nil value") { + expect(applePayConfiguration.supportedNetworks).to(beNil()) + } + } + + context("When checking the Merchant Capabilities property") { + it("should return a nil value") { + expect(applePayConfiguration.merchantCapabilities).to(beNil()) + } + } + } + + describe("Given an empty configuration") { + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.emptyNetworkCapabilityConfig) + } + + context("When checking the Supported Networks property") { + it("should return a nil value") { + expect(applePayConfiguration.supportedNetworks).to(beNil()) + } + } + + context("When checking the Merchant Capabilities property") { + it("should return a nil value") { + expect(applePayConfiguration.merchantCapabilities).to(beNil()) + } + } + + context("When checking the Supported Countries property") { + it("should return a nil value") { + expect(applePayConfiguration.supportedCountries).to(beNil()) + } + } + } + + describe("Given a nil configuration") { + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.nilNetworkCapabilityConfig) + } + + context("When checking the Supported Networks property") { + it("should return a nil value") { + expect(applePayConfiguration.supportedNetworks).to(beNil()) + } + } + + context("When checking the Merchant Capabilities property") { + it("should return a nil value") { + expect(applePayConfiguration.merchantCapabilities).to(beNil()) + } + } + + context("When checking the Supported Countries property") { + it("should return a nil value") { + expect(applePayConfiguration.supportedCountries).to(beNil()) + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTApplePayHandlerSpec.swift b/OSPaymentsLibTests/OSPMTApplePayHandlerSpec.swift new file mode 100644 index 0000000..64bfb0f --- /dev/null +++ b/OSPaymentsLibTests/OSPMTApplePayHandlerSpec.swift @@ -0,0 +1,192 @@ +import Nimble +import Quick +@testable import OSPaymentsLib + +class OSPMTMockAvailabilityBehaviour: OSPMTAvailabilityDelegate { + var error: OSPMTError? + + init(error: OSPMTError? = nil) { + self.error = error + } + + private func checkIfEqual(to error: OSPMTError) -> OSPMTError? { + self.error == error ? error : nil + } + + func checkWallet() -> OSPMTError? { + self.checkIfEqual(to: .walletNotAvailable) + } + + func checkPayment(shouldVerifySetup: Bool) -> OSPMTError? { + self.checkIfEqual(to: shouldVerifySetup ? .setupPaymentNotAvailable : .paymentNotAvailable) + } +} + +class OSPMTMockRequestBehaviour: OSPMTRequestDelegate { + var error: OSPMTError? + var scopeModel: OSPMTScopeModel? + + init(error: OSPMTError? = nil, scopeModel: OSPMTScopeModel? = nil) { + self.error = error + self.scopeModel = scopeModel + } + + func trigger(with detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) { + if let error = self.error { + completion(.failure(error)) + } else { + completion(.success(self.scopeModel ?? OSPMTTestConfigurations.dummyScopeModel)) + } + } +} + +class OSPMTApplePayHandlerSpec: QuickSpec { + override class func spec() { + var applePayHandler: OSPMTApplePayHandler! + var mockAvailabilityBehaviour: OSPMTMockAvailabilityBehaviour! + var mockRequestBehaviour: OSPMTMockRequestBehaviour! + + describe("Given a configuration") { + beforeEach { + applePayHandler = OSPMTApplePayHandler(configurationSource: OSPMTTestConfigurations.fullConfig) + } + + context("When Apple Pay Handler is initialized") { + it("should create the configuration property correctly") { + expect(applePayHandler).toNot(beNil()) + } + + context("and the configuration is setup") { + it("should return a string that matches the configuration") { + let result = applePayHandler.setupConfiguration() + + if case let .success(text) = result { + OSPMTTestConfigurations.fullConfig.forEach { item in + expect(text).toNot(beEmpty()) + if let value = item.value as? [String] { + expect(value).toNot(beEmpty()) + } + } + } else { + fail() + } + } + } + } + } + + describe("Given an AvailabilityBehaviour") { + var applePayConfiguration: OSPMTApplePayConfiguration! + + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.fullConfig) + mockRequestBehaviour = OSPMTMockRequestBehaviour() + } + context("When Wallet is not available for usage") { + beforeEach { + mockAvailabilityBehaviour = OSPMTMockAvailabilityBehaviour(error: .walletNotAvailable) + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return the walletNotAvailable error") { + let error = applePayHandler.checkWalletAvailability() + + expect(error).to(equal(.walletNotAvailable)) + } + } + + context("When Payment is not available for usage") { + beforeEach { + mockAvailabilityBehaviour = OSPMTMockAvailabilityBehaviour(error: .paymentNotAvailable) + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return the paymentNotAvailable error") { + let error = applePayHandler.checkWalletAvailability() + + expect(error).to(equal(.paymentNotAvailable)) + } + } + + context("When Payment is not available for usage") { + beforeEach { + mockAvailabilityBehaviour = OSPMTMockAvailabilityBehaviour(error: .setupPaymentNotAvailable) + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return the setupPaymentNotAvailable error") { + let error = applePayHandler.checkWalletAvailability() + + expect(error).to(equal(.setupPaymentNotAvailable)) + } + } + + context("When everything is available for usage") { + beforeEach { + mockAvailabilityBehaviour = OSPMTMockAvailabilityBehaviour() + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return a nil error") { + let error = applePayHandler.checkWalletAvailability() + + expect(error).to(beNil()) + } + } + } + + describe("Given an RequestBehaviour") { + var applePayConfiguration: OSPMTApplePayConfiguration! + + beforeEach { + applePayConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.fullConfig) + mockAvailabilityBehaviour = OSPMTMockAvailabilityBehaviour() + } + context("When an error occurs while triggering") { + beforeEach { + mockRequestBehaviour = OSPMTMockRequestBehaviour(error: .invalidConfiguration) + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return that same error") { + applePayHandler.set(OSPMTTestConfigurations.dummyDetailsModel) { result in + if case let .failure(error) = result { + expect(error).to(equal(mockRequestBehaviour.error)) + } else { + fail() + } + } + } + } + + context("When the trigger is successful") { + beforeEach { + mockRequestBehaviour = OSPMTMockRequestBehaviour(scopeModel: OSPMTTestConfigurations.dummyScopeModel) + applePayHandler = OSPMTApplePayHandler( + configuration: applePayConfiguration, availabilityBehaviour: mockAvailabilityBehaviour, requestBehaviour: mockRequestBehaviour + ) + } + + it("should return the resulting Payment Scope value") { + applePayHandler.set(OSPMTTestConfigurations.dummyDetailsModel) { result in + if case let .success(scopeModel) = result { + expect(scopeModel).to(equal(mockRequestBehaviour.scopeModel)) + } else { + fail() + } + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTApplePayRequestBehaviourSpec.swift b/OSPaymentsLibTests/OSPMTApplePayRequestBehaviourSpec.swift new file mode 100644 index 0000000..1347bd5 --- /dev/null +++ b/OSPaymentsLibTests/OSPMTApplePayRequestBehaviourSpec.swift @@ -0,0 +1,164 @@ +import Nimble +import PassKit +import Quick +@testable import OSPaymentsLib + +class MockRequestTriggerBehaviour: OSPMTApplePayRequestTriggerDelegate { + static var error: OSPMTError? + static var isCompleted: Bool = false + static var paymentScope: OSPMTScopeModel? + + required init() {} + + static func createRequestTriggerBehaviour(for detailsModel: OSPMTDetailsModel, andDelegate delegate: OSPMTApplePayRequestBehaviour?) -> Result { + if let error = error { + return .failure(error) + } else { + delegate?.paymentScope = Self.paymentScope + return .success(Self.init()) + } + } + + func triggerPayment(_ completion: @escaping OSPMTRequestTriggerCompletion) { + completion(Self.isCompleted) + } +} + +class OSPMTApplePayRequestBehaviourSpec: QuickSpec { + override class func spec() { + var applePayRequestBehaviour: OSPMTApplePayRequestBehaviour! + + var mockConfiguration: OSPMTApplePayConfiguration! + + describe("Given a Request Behaviour") { + context("When it's incorrectly configured") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + MockRequestTriggerBehaviour.error = .invalidConfiguration + } + + it("should return an InvalidConfiguration error") { + applePayRequestBehaviour.trigger(with: OSPMTTestConfigurations.dummyDetailsModel) { result in + if case let .failure(error) = result { + expect(error).to(equal(.invalidConfiguration)) + } else { + fail() + } + } + } + } + + context("When it's not possible to trigger Apple Pay") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + MockRequestTriggerBehaviour.error = nil + MockRequestTriggerBehaviour.isCompleted = false + } + + it("should return a PaymentTriggerPresentationFailed error") { + applePayRequestBehaviour.trigger(with: OSPMTTestConfigurations.dummyDetailsModel) { result in + if case let .failure(error) = result { + expect(error).to(equal(.paymentTriggerPresentationFailed)) + } else { + fail() + } + } + } + } + + context("When it's possible to trigger Apple Pay") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.validNetworkCapabilityConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + MockRequestTriggerBehaviour.error = nil + MockRequestTriggerBehaviour.isCompleted = true + MockRequestTriggerBehaviour.paymentScope = OSPMTTestConfigurations.dummyScopeModel + } + + it("should return a valid Scope Model") { + applePayRequestBehaviour.trigger(with: OSPMTTestConfigurations.dummyDetailsModel) { result in + if case let .success(scopeModel) = result { + expect(scopeModel).to(equal(OSPMTTestConfigurations.dummyScopeModel)) + } else { + fail() + } + } + } + } + + context("When checking the payment networks") { + context("and the configuration lacks the merchant's name") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.noMerchantNameConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + } + it("should return a nil value") { + let result = applePayRequestBehaviour.getPaymentSummaryItems(for: OSPMTTestConfigurations.dummyDetailsModel) + + expect(result).to(beNil()) + } + } + + context("and the configuration has the merchant's name") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.fullConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + } + it("should return a non empty value") { + let result = applePayRequestBehaviour.getPaymentSummaryItems(for: OSPMTTestConfigurations.dummyDetailsModel) + + expect(result).toNot(beEmpty()) + } + } + } + + context("When checking the contact fields") { + beforeEach { + mockConfiguration = OSPMTApplePayConfiguration(source: OSPMTTestConfigurations.fullConfig) + applePayRequestBehaviour = OSPMTApplePayRequestBehaviour( + configuration: mockConfiguration, requestTriggerType: MockRequestTriggerBehaviour.self + ) + } + context("and no contact is provided") { + it("should return a nil value") { + let result = applePayRequestBehaviour.getContactFields(for: OSPMTTestConfigurations.emptyContactFieldArray) + expect(result).to(beEmpty()) + } + } + + context("and a invalid contact is provided") { + it("should return a nil value") { + let result = applePayRequestBehaviour.getContactFields(for: OSPMTTestConfigurations.invalidContactFieldArray) + expect(result).to(beEmpty()) + } + } + + context("and a invalid contact and a valid is provided") { + it("should return the a array with the valid value") { + let result = applePayRequestBehaviour.getContactFields(for: OSPMTTestConfigurations.withInvalidContactFieldArray) + expect(result.count).to(equal(1)) + } + } + + context("and a valid contacts is provided") { + it("should return the a array with the valid value") { + let result = applePayRequestBehaviour.getContactFields(for: OSPMTTestConfigurations.validContactFieldArray) + expect(result.count).to(equal(2)) + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTGatewayFactorySpec.swift b/OSPaymentsLibTests/OSPMTGatewayFactorySpec.swift new file mode 100644 index 0000000..03f727b --- /dev/null +++ b/OSPaymentsLibTests/OSPMTGatewayFactorySpec.swift @@ -0,0 +1,39 @@ +import Nimble +import Quick +@testable import OSPaymentsLib + +class OSPMTGatewayFactorySpec: QuickSpec { + override class func spec() { + var model: OSPMTGatewayModel! + var wrapper: OSPMTGatewayDelegate! + + describe("Given a OSPMTGatewayModel") { + context("When given an invalid model") { + it("No Wrapper should be created") { + model = OSPMTTestConfigurations.invalidGatewayModel + wrapper = OSPMTGatewayFactory.createWrapper(for: model) + + expect(wrapper).to(beNil()) + } + } + + context("When given an invalid model Stripe") { + it("No Wrapper should be created") { + model = OSPMTTestConfigurations.invalidStripeModel + wrapper = OSPMTGatewayFactory.createWrapper(for: model) + + expect(wrapper).to(beNil()) + } + } + + context("When given a valid model Stripe") { + it("a OSPMTStripeWrapper should be created") { + model = OSPMTTestConfigurations.validStripeModel + wrapper = OSPMTGatewayFactory.createWrapper(for: model) + + expect(wrapper).toNot(beNil()) + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTPaymentsSpec.swift b/OSPaymentsLibTests/OSPMTPaymentsSpec.swift new file mode 100644 index 0000000..037467d --- /dev/null +++ b/OSPaymentsLibTests/OSPMTPaymentsSpec.swift @@ -0,0 +1,237 @@ +import Nimble +import Quick +@testable import OSPaymentsLib + +class OSPMTMockCallback: OSPMTCallbackDelegate { + var successText: String? + var error: OSPMTError? + + func callback(result: String?, error: OSPMTError?) { + self.successText = result + self.error = error + } +} + +class OSPMTMockHandler: OSPMTHandlerDelegate { + var successText: String? + var error: OSPMTError? + var scopeModel: OSPMTScopeModel? + + init(successText: String? = nil, error: OSPMTError? = nil, scopeModel: OSPMTScopeModel? = nil) { + self.successText = successText + self.error = error + self.scopeModel = scopeModel + } + + func setupConfiguration() -> Result { + if let error = self.error { + return .failure(error) + } else { + return .success(self.successText ?? "") + } + } + + func checkWalletAvailability() -> OSPMTError? { + return self.error + } + + func set(_ detailsModel: OSPMTDetailsModel, and accessToken: String?, _ completion: @escaping OSPMTCompletionHandler) { + if let error = self.error { + completion(.failure(error)) + } else if let scopeModel = self.scopeModel { + completion(.success(scopeModel)) + } + } +} + +class OSPMTPaymentsSpec: QuickSpec { + override class func spec() { + var mockDelegate: OSPMTMockCallback! + var mockHandler: OSPMTMockHandler! + var payments: OSPMTPayments! + + describe("Given a delegate") { + beforeEach { + mockDelegate = OSPMTMockCallback() + } + + describe("and a correctly configured handler") { + context("When the OSPMTPayments object is initialized") { + beforeEach { + mockHandler = OSPMTMockHandler( + successText: OSPMTTestConfigurations.dummyString, scopeModel: OSPMTTestConfigurations.dummyScopeModel + ) + payments = OSPMTPayments(delegate: mockDelegate, handler: mockHandler) + } + + it("Setup configuration should return a successful text message") { + payments.setupConfiguration() + + expect(mockDelegate.successText).to(equal(OSPMTTestConfigurations.dummyString)) + expect(mockDelegate.error).to(beNil()) + } + + it("Check wallet setup should return a successful empty message") { + payments.checkWalletSetup() + + expect(mockDelegate.successText).to(beEmpty()) + expect(mockDelegate.error).to(beNil()) + } + + it("Set payment details should return a successful scope model") { + if let detailsData = try? JSONSerialization.data(withJSONObject: OSPMTTestConfigurations.validDetailModel), + let detailsString = String(data: detailsData, encoding: .utf8) { + payments.set(detailsString) + + expect(mockDelegate.error).to(beNil()) + + let result = payments.encode(OSPMTTestConfigurations.dummyScopeModel) + if case let .success(scopeText) = result, + let scopeTextData = scopeText.data(using: .utf8), + let successTextData = mockDelegate.successText?.data(using: .utf8), + let scopeObject = try? JSONSerialization.jsonObject(with: scopeTextData) as? [String: Any], + let successTextObject = try? JSONSerialization.jsonObject(with: successTextData) as? [String: Any] { + expect(NSDictionary(dictionary: scopeObject)).to(equal(NSDictionary(dictionary: successTextObject))) + } else { + fail() + } + } else { + fail() + } + } + } + + context("When the OSPMTPayments object is initialized") { + context(""" + And payment details is set so that it should use the billing information + from the configuration and custom shipping information + """) { + beforeEach { + mockHandler = OSPMTMockHandler( + successText: OSPMTTestConfigurations.dummyString, + scopeModel: OSPMTTestConfigurations.useConfigurationBillingScopeModel + ) + payments = OSPMTPayments(delegate: mockDelegate, handler: mockHandler) + } + + it("Should return the values as expected") { + if let detailsData = try? JSONSerialization.data( + withJSONObject: OSPMTTestConfigurations.useConfigBillingContactDetailModel + ), + let detailsString = String(data: detailsData, encoding: .utf8) { + payments.set(detailsString) + + expect(mockDelegate.error).to(beNil()) + + let result = payments.encode(OSPMTTestConfigurations.useConfigurationBillingScopeModel) + if case let .success(scopeText) = result, + let scopeTextData = scopeText.data(using: .utf8), + let successTextData = mockDelegate.successText?.data(using: .utf8), + let scopeObject = try? JSONSerialization.jsonObject(with: scopeTextData) as? [String: Any], + let successTextObject = try? JSONSerialization.jsonObject(with: successTextData) as? [String: Any] { + expect(NSDictionary(dictionary: scopeObject)).to(equal(NSDictionary(dictionary: successTextObject))) + } else { + fail() + } + } else { + fail() + } + } + } + } + } + + describe("and a handler configured with an error") { + context("When the OSPMTPayments object is initialized") { + beforeEach { + mockHandler = OSPMTMockHandler(error: .invalidConfiguration) + payments = OSPMTPayments(delegate: mockDelegate, handler: mockHandler) + } + + it("Setup configuration should return an error") { + payments.setupConfiguration() + + expect(mockDelegate.error).to(equal(.invalidConfiguration)) + expect(mockDelegate.successText).to(beNil()) + } + + it("Check wallet setup should return an error") { + payments.checkWalletSetup() + + expect(mockDelegate.error).to(equal(.invalidConfiguration)) + expect(mockDelegate.successText).to(beNil()) + } + + it("Set payment details should return an error") { + if let detailsData = try? JSONSerialization.data(withJSONObject: OSPMTTestConfigurations.validDetailModel), + let detailsString = String(data: detailsData, encoding: .utf8) { + payments.set(detailsString) + + expect(mockDelegate.error).to(equal(.invalidConfiguration)) + expect(mockDelegate.successText).to(beNil()) + } else { + fail() + } + } + } + } + + describe("and set payment details is called") { + beforeEach { + mockHandler = OSPMTMockHandler(scopeModel: OSPMTTestConfigurations.dummyScopeModel) + payments = OSPMTPayments(delegate: mockDelegate, handler: mockHandler) + } + context("When an invalid detail model is passed as a parameter") { + it("should return a error") { + if let detailsData = try? JSONSerialization.data(withJSONObject: OSPMTTestConfigurations.invalidStatusDetailModel), + let detailsString = String(data: detailsData, encoding: .utf8) { + payments.set(detailsString) + + expect(mockDelegate.error).to(equal(.invalidDecodeDetails)) + expect(mockDelegate.successText).to(beNil()) + } else { + fail() + } + } + } + } + + describe("and an Apple Pay Handler correctly configured") { + context("When the OSPMTPayments object is initialized") { + it("Setup configuration should return a non empty text message") { + payments = OSPMTPayments(applePayWithDelegate: mockDelegate, andConfiguration: OSPMTTestConfigurations.fullConfig) + + payments.setupConfiguration() + + expect(mockDelegate.successText).toNot(beEmpty()) + expect(mockDelegate.error).to(beNil()) + } + + context("And Payment Gateway information is provided") { + it("Setup configuration should return a non empty text message") { + payments = OSPMTPayments(applePayWithDelegate: mockDelegate, andConfiguration: OSPMTTestConfigurations.dummyGatewayConfig) + + payments.setupConfiguration() + + expect(mockDelegate.successText).toNot(beEmpty()) + expect(mockDelegate.error).to(beNil()) + } + } + + context("And a Stripe Payment Gateway information is provided") { + it("Setup configuration should return a non empty text message") { + payments = OSPMTPayments( + applePayWithDelegate: mockDelegate, andConfiguration: OSPMTTestConfigurations.stripeGatewayConfig + ) + + payments.setupConfiguration() + + expect(mockDelegate.successText).toNot(beEmpty()) + expect(mockDelegate.error).to(beNil()) + } + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTStripeWrapperSpec.swift b/OSPaymentsLibTests/OSPMTStripeWrapperSpec.swift new file mode 100644 index 0000000..1fc6718 --- /dev/null +++ b/OSPaymentsLibTests/OSPMTStripeWrapperSpec.swift @@ -0,0 +1,180 @@ +import Nimble +import PassKit +import Quick +@testable import OSPaymentsLib + +class MockStripeAPIDelegate: OSPMTStripeAPIDelegate { + var paymentMethodId: String? + var error: OSPMTError? + + func set(_ publishableKey: String) {} + + func getPaymentMethodId(from payment: PKPayment, _ completion: @escaping (Result) -> Void) { + if let paymentMethodId = paymentMethodId { + completion(.success(paymentMethodId)) + } else if let error = error { + completion(.failure(error)) + } + } +} + +enum MockError: Error { + case generic +} + +class MockURLProtocol: URLProtocol { + override class func canInit(with request: URLRequest) -> Bool { + return true + } + + override class func canonicalRequest(for request: URLRequest) -> URLRequest { + return request + } + + static var requestHandler: ((URLRequest) throws -> (HTTPURLResponse, Data?))? + + override func startLoading() { + guard let handler = MockURLProtocol.requestHandler else { + fatalError("Handler is unavailable.") + } + + do { + let (response, data) = try handler(request) + client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed) + + if let data = data { + client?.urlProtocol(self, didLoad: data) + } + + client?.urlProtocolDidFinishLoading(self) + } catch { + client?.urlProtocol(self, didFailWithError: error) + } + } + + override func stopLoading() {} +} + +class OSPMTStripeWrapperSpec: QuickSpec { + override class func spec() { + var mockAPIDelegate: MockStripeAPIDelegate! + var mockPayment: PKPayment! + var mockDetailsModel: OSPMTDetailsModel! + var mockURL: URL! + + var stripeWrapper: OSPMTStripeWrapper! + + describe("Given a Stripe API Delegate object") { + beforeEach { + mockAPIDelegate = MockStripeAPIDelegate() + + let configuration = URLSessionConfiguration.default + configuration.protocolClasses = [MockURLProtocol.self] + let urlSession = URLSession.init(configuration: configuration) + + mockPayment = PKPayment() + + mockDetailsModel = OSPMTTestConfigurations.dummyDetailsModel + + mockURL = URL(string: OSPMTTestConfigurations.dummyString)! + + stripeWrapper = OSPMTStripeWrapper( + urlRequest: URLRequest(url: mockURL), + urlSession: urlSession, + publishableKey: OSPMTTestConfigurations.dummyString, + apiDelegate: mockAPIDelegate + ) + } + + context("When there's an error while obtaining a Payment Method ID") { + it("It should return a Stripe Payment Method Creation error") { + mockAPIDelegate.error = OSPMTError.stripePaymentMethodCreation + + stripeWrapper.process(mockPayment, with: mockDetailsModel, and: OSPMTTestConfigurations.dummyAccessToken) { result in + switch result { + case .failure(let errorResult): + expect(errorResult).to(equal(OSPMTError.stripePaymentMethodCreation)) + case .success: + fail() + } + } + } + } + + context("When a Payment Method ID is returned") { + beforeEach { + mockAPIDelegate.paymentMethodId = OSPMTTestConfigurations.dummyString + } + context("And there's an error on processing the Payment Request") { + it("It should return an 100 Status Code Error") { + MockURLProtocol.requestHandler = { request in + guard let url = request.url, url == mockURL else { + throw MockError.generic + } + + let response = HTTPURLResponse(url: mockURL, statusCode: 100, httpVersion: nil, headerFields: nil)! + return (response, OSPMTTestConfigurations.dummyString.data(using: .utf8)) + } + + stripeWrapper.process(mockPayment, with: mockDetailsModel, and: OSPMTTestConfigurations.dummyAccessToken) { result in + switch result { + case .failure(let errorResult): + expect(errorResult).to(equal(.paymentIssue)) + case .success: + fail() + } + } + } + + it("It should return an Failed Request Error") { + MockURLProtocol.requestHandler = { request in + guard let url = request.url, + url == mockURL, + let resultData = try? JSONEncoder().encode(OSPMTTestConfigurations.invalidPaymentProcessResultModel) + else { + throw MockError.generic + } + + let response = HTTPURLResponse(url: mockURL, statusCode: 200, httpVersion: nil, headerFields: nil)! + return (response, resultData) + } + + stripeWrapper.process(mockPayment, with: mockDetailsModel, and: OSPMTTestConfigurations.dummyAccessToken) { result in + switch result { + case .failure(let errorResult): + expect(errorResult).to(equal(.paymentIssue)) + case .success: + fail() + } + } + } + } + + context("And there's the Payment Request process is successful") { + it("It should return a success text") { + MockURLProtocol.requestHandler = { request in + guard let url = request.url, + url == mockURL, + let resultData = try? JSONEncoder().encode(OSPMTTestConfigurations.validPaymentProcessResultModel) + else { + throw MockError.generic + } + + let response = HTTPURLResponse(url: mockURL, statusCode: 200, httpVersion: nil, headerFields: nil)! + return (response, resultData) + } + + stripeWrapper.process(mockPayment, with: mockDetailsModel, and: OSPMTTestConfigurations.dummyAccessToken) { result in + switch result { + case .success(let resultModel): + expect(resultModel).to(equal(OSPMTTestConfigurations.validPaymentProcessResultModel)) + case .failure: + fail() + } + } + } + } + } + } + } +} diff --git a/OSPaymentsLibTests/OSPMTTestConfigurations.swift b/OSPaymentsLibTests/OSPMTTestConfigurations.swift new file mode 100644 index 0000000..2f61da2 --- /dev/null +++ b/OSPaymentsLibTests/OSPMTTestConfigurations.swift @@ -0,0 +1,190 @@ +@testable import OSPaymentsLib +import PassKit + +struct OSPMTTestConfigurations { + // MARK: - General Configurations + static let dummyString = "Dummy" + + // MARK: - OSPMTApplePayHandlerSpec Configurations + static let fullConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.merchantID: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantName: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantCountryCode: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.shippingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.billingSupportedContacts: [Self.dummyString, Self.dummyString] + ] + + static let noMerchantNameConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.merchantID: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantCountryCode: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.shippingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.billingSupportedContacts: [Self.dummyString, Self.dummyString] + ] + + // MARK: - OSPMTApplePayConfigurationSpec Configurations + static let networkVisa = "VISA" + static let networkMasterCard = "MasterCard" + static let capability3DS = "3DS" + static let capabilityEMV = "emv" + + static let validNetworkCapabilityConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.networkVisa, Self.networkMasterCard], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.capability3DS, Self.capabilityEMV], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [Self.dummyString] + ] + + static let validNetworkCapabilityWithErrorConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.networkVisa, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.capability3DS, Self.dummyString] + ] + + static let invalidNetworkCapabilityConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: Self.dummyString + ] + + static let emptyNetworkCapabilityConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [] + ] + + static let nilNetworkCapabilityConfig: OSPMTConfiguration = [:] + + static let dummyGatewayConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.merchantID: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantName: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantCountryCode: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.shippingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.billingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentGateway: [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentGatewayName: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentRequestURL: Self.dummyString + ], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentRequestURL: Self.dummyString + ] + + static let stripeGatewayConfig: OSPMTConfiguration = [ + OSPMTApplePayConfiguration.ConfigurationKeys.merchantID: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantName: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.merchantCountryCode: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentAllowedNetworks: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCapabilities: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentSupportedCardCountries: [Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.shippingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.billingSupportedContacts: [Self.dummyString, Self.dummyString], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentGateway: [ + OSPMTApplePayConfiguration.ConfigurationKeys.paymentGatewayName: OSPMTGateway.stripe.rawValue, + OSPMTApplePayConfiguration.ConfigurationKeys.paymentRequestURL: Self.dummyString, + OSPMTApplePayConfiguration.ConfigurationKeys.stripePublishableKey: Self.dummyString + ], + OSPMTApplePayConfiguration.ConfigurationKeys.paymentRequestURL: Self.dummyString + ] + + // MARK: - OSPMTApplePayRequestBehaviourSpec Configurations + static let dummyContact = OSPMTContact(isCustom: true, contactArray: [Self.dummyString]) + static let dummyDetailsModel = OSPMTDetailsModel( + amount: 1, currency: Self.dummyString, status: .final, shippingContact: dummyContact, billingContact: dummyContact + ) + static let dummyAddressModel = OSPMTAddressModel( + postalCode: Self.dummyString, fullAddress: Self.dummyString, countryCode: Self.dummyString, city: Self.dummyString + ) + static let dummyContactInfoModel = OSPMTContactInfoModel() + static let dummyTokenInfoModel = OSPMTTokenInfoModel(token: Self.dummyString, type: Self.dummyString) + static let dummyDataModel = OSPMTDataModel( + billingInfo: Self.dummyContactInfoModel, cardDetails: Self.dummyString, cardNetwork: Self.dummyString, tokenData: Self.dummyTokenInfoModel + ) + static let dummyScopeModel = OSPMTScopeModel(paymentData: Self.dummyDataModel, shippingInfo: Self.dummyContactInfoModel) + + static let emptyContactFieldArray = [String]() + static let invalidContactFieldArray = [Self.dummyString] + static let withInvalidContactFieldArray = [Self.dummyString, PKContactField.name.rawValue.lowercased()] + static let validContactFieldArray = [PKContactField.phoneNumber.rawValue.lowercased(), PKContactField.name.rawValue.lowercased()] + + // MARK: - OSPMTPaymentSpec Configurations + static let validDetailModel: [String: Any] = [ + OSPMTDetailsModel.CodingKeys.amount.rawValue: 1, + OSPMTDetailsModel.CodingKeys.currency.rawValue: Self.dummyString, + OSPMTDetailsModel.CodingKeys.status.rawValue: OSPMTStatus.final.rawValue, + OSPMTDetailsModel.CodingKeys.billingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: true, + OSPMTContact.CodingKeys.contactArray.rawValue: [Self.dummyString] + ], + OSPMTDetailsModel.CodingKeys.shippingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: true, + OSPMTContact.CodingKeys.contactArray.rawValue: [Self.dummyString] + ] + ] + + static let invalidStatusDetailModel: [String: Any] = [ + OSPMTDetailsModel.CodingKeys.amount.rawValue: 1, + OSPMTDetailsModel.CodingKeys.currency.rawValue: Self.dummyString, + OSPMTDetailsModel.CodingKeys.status.rawValue: Self.dummyString, + OSPMTDetailsModel.CodingKeys.billingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: true, + OSPMTContact.CodingKeys.contactArray.rawValue: [Self.dummyString] + ], + OSPMTDetailsModel.CodingKeys.shippingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: true, + OSPMTContact.CodingKeys.contactArray.rawValue: [Self.dummyString] + ] + ] + + static let useConfigBillingContactDetailModel: [String: Any] = [ + OSPMTDetailsModel.CodingKeys.amount.rawValue: 1, + OSPMTDetailsModel.CodingKeys.currency.rawValue: Self.dummyString, + OSPMTDetailsModel.CodingKeys.status.rawValue: OSPMTStatus.final.rawValue, + OSPMTDetailsModel.CodingKeys.billingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: false + ], + OSPMTDetailsModel.CodingKeys.shippingContact.rawValue: [ + OSPMTContact.CodingKeys.isCustom.rawValue: true, + OSPMTContact.CodingKeys.contactArray.rawValue: [Self.dummyString] + ] + ] + + static let useConfigurationBillingContactInfoModel = OSPMTContactInfoModel(name: Self.dummyString) + static let useConfigurationBillingScopeModel = OSPMTScopeModel( + paymentData: Self.dummyDataModel, shippingInfo: Self.useConfigurationBillingContactInfoModel + ) + + // MARK: - ModelSpec Methods + static func decode(for type: T.Type, _ dictionary: [String: Any]) -> T? { + guard + let data = try? JSONSerialization.data(withJSONObject: dictionary), + let model = try? JSONDecoder().decode(type, from: data) + else { return nil } + return model + } + + static func encode(_ model: T) -> String? { + guard let data = try? JSONEncoder().encode(model), let result = String(data: data, encoding: .utf8) else { return nil } + return result + } + + // MARK: - OSPMTGatewayFactorySpec Configurations + + static let validStripeModel = OSPMTGatewayModel( + gateway: OSPMTGateway.stripe.rawValue, publishableKey: Self.dummyString, requestURL: Self.dummyString + ) + static let invalidStripeModel = OSPMTGatewayModel( + gateway: OSPMTGateway.stripe.rawValue, publishableKey: nil, requestURL: Self.dummyString + ) + static let invalidGatewayModel = OSPMTGatewayModel( + gateway: Self.dummyString, publishableKey: Self.dummyString, requestURL: Self.dummyString + ) + + static let invalidPaymentProcessResultModel = OSPMTServiceProviderInfoModel(id: Self.dummyString, status: OSPMTProcessStatus.fail.rawValue) + static let validPaymentProcessResultModel = OSPMTServiceProviderInfoModel(id: Self.dummyString, status: OSPMTProcessStatus.success.rawValue) + + static let dummyAccessToken = "dummy" +} diff --git a/OSPaymentsLibTests/OSPaymentsLibTests.swift b/OSPaymentsLibTests/OSPaymentsLibTests.swift deleted file mode 100644 index 2cba307..0000000 --- a/OSPaymentsLibTests/OSPaymentsLibTests.swift +++ /dev/null @@ -1,30 +0,0 @@ - -import XCTest -@testable import OSPaymentsLib - -class OSPaymentsLibTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..e758791 --- /dev/null +++ b/Podfile @@ -0,0 +1,13 @@ +platform :ios, '14.0' + +target 'OSPaymentsLib' do + use_frameworks! + + # Pods for OSPaymentsLib + + target 'OSPaymentsLibTests' do + pod 'Quick', '7.5.0' + pod 'Nimble', '13.2.1' + end + +end diff --git a/Pods/CwlCatchException/LICENSE.txt b/Pods/CwlCatchException/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Pods/CwlCatchException/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Pods/CwlCatchException/README.md b/Pods/CwlCatchException/README.md new file mode 100644 index 0000000..ef38cab --- /dev/null +++ b/Pods/CwlCatchException/README.md @@ -0,0 +1,31 @@ +# CwlCatchException + +A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. + +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. + +## Requirements + +From version 2.0.0-beta.1, building CwlCatchException requires Swift 5 or newer, Swift Package Manager or CocoaPods. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlCatchException/tree/1.2.0). + +## Adding to your project + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0")) + +Or by adding `https://github.com/mattgallagher/CwlCatchException.git`, version 2.0.0 or later, to the list of Swift packages for any project in Xcode. + +### CocoaPods + +CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlCatchException into your Xcode project using CocoaPods, specify it in your Podfile: + +pod 'CwlCatchException', '~> 2.0' + +## Thanks + +Includes contributions from @alexbaev, @dnkoutso and @ejensen. \ No newline at end of file diff --git a/Pods/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift b/Pods/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift new file mode 100644 index 0000000..d6dbe4a --- /dev/null +++ b/Pods/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift @@ -0,0 +1,70 @@ +// +// CwlCatchException.swift +// CwlAssertionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +import Foundation + +#if SWIFT_PACKAGE || COCOAPODS +import CwlCatchExceptionSupport +#endif + +private func catchReturnTypeConverter(_ type: Exception.Type, block: () -> Void) -> Exception? { + return catchExceptionOfKind(type, block) as? Exception +} + +extension NSException { + public static func catchException(in block: () -> Void) -> Self? { + return catchReturnTypeConverter(self, block: block) + } +} + +public func catchExceptionAsError(in block: (() throws -> Output)) throws -> Output { + var result: Result? + + let exception = NSException.catchException { + result = Result(catching: block) + } + + if let exception = exception { + throw ExceptionError(exception) + } + + return try result!.get() +} + +// Adding conformance so that ExceptionError is fully Sendable as part of CustomNSError +extension NSException: @unchecked Sendable { } + +public struct ExceptionError: CustomNSError { + public let exception: NSException + public let domain = "com.cocoawithlove.catch-exception" + public let errorUserInfo: [String: Any] + + public init(_ exception: NSException) { + self.exception = exception + + if let userInfo = exception.userInfo { + self.errorUserInfo = [String: Any](uniqueKeysWithValues: userInfo.map { pair in + (pair.key.description, pair.value) + }) + } else { + self.errorUserInfo = [:] + } + } +} diff --git a/Pods/CwlCatchExceptionSupport/LICENSE.txt b/Pods/CwlCatchExceptionSupport/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Pods/CwlCatchExceptionSupport/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Pods/CwlCatchExceptionSupport/README.md b/Pods/CwlCatchExceptionSupport/README.md new file mode 100644 index 0000000..ef38cab --- /dev/null +++ b/Pods/CwlCatchExceptionSupport/README.md @@ -0,0 +1,31 @@ +# CwlCatchException + +A simple Swift wrapper around an Objective-C `@try`/`@catch` statement that selectively catches Objective-C exceptions by `NSException` subtype, rethrowing if any caught exception is not the expected subtype. + +Look at [CwlCatchExceptionTests.swift](https://github.com/mattgallagher/CwlCatchException/blob/master/Tests/CwlCatchExceptionTests/CwlCatchExceptionTests.swift) for syntax. + +## Requirements + +From version 2.0.0-beta.1, building CwlCatchException requires Swift 5 or newer, Swift Package Manager or CocoaPods. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlCatchException/tree/1.2.0). + +## Adding to your project + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlCatchException.git", from: Version("2.0.0")) + +Or by adding `https://github.com/mattgallagher/CwlCatchException.git`, version 2.0.0 or later, to the list of Swift packages for any project in Xcode. + +### CocoaPods + +CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlCatchException into your Xcode project using CocoaPods, specify it in your Podfile: + +pod 'CwlCatchException', '~> 2.0' + +## Thanks + +Includes contributions from @alexbaev, @dnkoutso and @ejensen. \ No newline at end of file diff --git a/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/CwlCatchException.m b/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/CwlCatchException.m new file mode 100644 index 0000000..4530e92 --- /dev/null +++ b/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/CwlCatchException.m @@ -0,0 +1,34 @@ +// +// CwlCatchException.m +// CwlAssertionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#import + +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ NS_NOESCAPE __nonnull inBlock)(void)) { + @try { + inBlock(); + } @catch (NSException *exception) { + if ([exception isKindOfClass:type]) { + return exception; + } else { + @throw; + } + } + return nil; +} diff --git a/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h b/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h new file mode 100644 index 0000000..b93dcd2 --- /dev/null +++ b/Pods/CwlCatchExceptionSupport/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h @@ -0,0 +1,23 @@ +// +// CwlCatchException.h +// CwlCatchException +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#import + +NSException* __nullable catchExceptionOfKind(Class __nonnull type, void (^ NS_NOESCAPE __nonnull inBlock)(void)); diff --git a/Pods/CwlMachBadInstructionHandler/LICENSE.txt b/Pods/CwlMachBadInstructionHandler/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Pods/CwlMachBadInstructionHandler/README.md b/Pods/CwlMachBadInstructionHandler/README.md new file mode 100644 index 0000000..dd3fef1 --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/README.md @@ -0,0 +1,59 @@ +# CwlPreconditionTesting + +A Mach exception handler, written in Swift and Objective-C, that allows `EXC_BAD_INSTRUCTION` (as raised by Swift's `assertionFailure`/`preconditionFailure`/`fatalError`) to be caught and tested. + +NOTE: the iOS code runs in the simulator *only*. It is for logic testing and cannot be deployed to the device due to the Mach exception API being private on iOS. + +For an extended discussion of this code, please see the Cocoa with Love article: + +[Partial functions in Swift, Part 2: Catching precondition failures](http://cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html) + +## Requirements + +From version 2.0.0-beta.1, building CwlPreconditionTesting requires Swift 5 or newer and the Swift Package Manager, or CocoaPods. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlPreconditionTesting/tree/1.2.0). + +## Adding to your project + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: Version("2.0.0")) + +Or by adding `https://github.com/mattgallagher/CwlPreconditionTesting.git`, version 2.0.0 or later, to the list of Swift packages for any project in Xcode. + +### CocoaPods + +CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlPreconditionTesting into your Xcode project using CocoaPods, specify it in your Podfile: + +pod 'CwlPreconditionTesting', '~> 2.0' + +## Usage + +On macOS and iOS you can use the regular version: + +```swift +import CwlPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +on tvOS, Linux and other platforms, you can use the POSIX version: + +```swift +import CwlPosixPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +**Warning**: this POSIX version can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring. You should disable the "Debug Executable" setting for the tests in Xcode. The POSIX version of the signal handler is also whole process (rather than correctly scoped to the thread where the "catch" occurs). + +## Thanks + +Includes contributions from @abbeycode, @dnkoutso, @jeffh and @ikesyo. Extra thanks to @saagarjha for help with the ARM64 additions. \ No newline at end of file diff --git a/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m new file mode 100644 index 0000000..0af0e8e --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m @@ -0,0 +1,56 @@ +// +// CwlMachBadExceptionHandler.m +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_VISION + +#import "mach_excServer.h" +#import "CwlMachBadInstructionHandler.h" + +@protocol BadInstructionReply ++(int)receiveReply:(bad_instruction_exception_reply_t)reply; +@end + +/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. +kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; + Class badInstructionClass = NSClassFromString(@"BadInstructionException"); + return [badInstructionClass receiveReply:reply]; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { + assert(false); + return KERN_FAILURE; +} + +// The mach port should be configured so that this function is never used. +kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { + assert(false); + return KERN_FAILURE; +} + +NDR_record_t mach_ndr_record(void) { + return NDR_record; +} + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h new file mode 100644 index 0000000..ade03df --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h @@ -0,0 +1,80 @@ +// +// CwlMachBadInstructionHandler.h +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#import + +#if TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_VISION + +#import + +extern bool _swift_disableExclusivityChecking; +extern bool _swift_reportFatalErrorsToDebugger; + +NS_ASSUME_NONNULL_BEGIN + +extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +// The request_mach_exception_raise_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. +typedef struct +{ + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t thread; + mach_msg_port_descriptor_t task; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + int flavor; + mach_msg_type_number_t old_stateCnt; + natural_t old_state[224]; +} request_mach_exception_raise_t; + +// The reply_mach_exception_raise_state_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. +typedef struct +{ + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + int flavor; + mach_msg_type_number_t new_stateCnt; + natural_t new_state[224]; +} reply_mach_exception_raise_state_t; + +typedef struct +{ + mach_port_t exception_port; + exception_type_t exception; + mach_exception_data_type_t const * _Nullable code; + mach_msg_type_number_t codeCnt; + int32_t * _Nullable flavor; + natural_t const * _Nullable old_state; + mach_msg_type_number_t old_stateCnt; + thread_state_t _Nullable new_state; + mach_msg_type_number_t * _Nullable new_stateCnt; +} bad_instruction_exception_reply_t; + +NDR_record_t mach_ndr_record(void); + +NS_ASSUME_NONNULL_END + +#endif diff --git a/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.c b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.c new file mode 100644 index 0000000..c6f4141 --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.c @@ -0,0 +1,536 @@ +/* + * IDENTIFICATION: + * stub generated Sun Jan 29 19:05:29 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ + +/* Module mach_exc */ + +#define __MIG_check__Request__mach_exc_subsystem__ 1 + +#import "mach_excServer.h" +#if TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_VISION + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __DeclareRcvRpc +#define __DeclareRcvRpc(_NUM_, _NAME_) +#endif /* __DeclareRcvRpc */ + +#ifndef __BeforeRcvRpc +#define __BeforeRcvRpc(_NUM_, _NAME_) +#endif /* __BeforeRcvRpc */ + +#ifndef __AfterRcvRpc +#define __AfterRcvRpc(_NUM_, _NAME_) +#endif /* __AfterRcvRpc */ + +#ifndef __DeclareRcvSimple +#define __DeclareRcvSimple(_NUM_, _NAME_) +#endif /* __DeclareRcvSimple */ + +#ifndef __BeforeRcvSimple +#define __BeforeRcvSimple(_NUM_, _NAME_) +#endif /* __BeforeRcvSimple */ + +#ifndef __AfterRcvSimple +#define __AfterRcvSimple(_NUM_, _NAME_) +#endif /* __AfterRcvSimple */ + +#define novalue void + +#define msgh_request_port msgh_local_port +#define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) +#define msgh_reply_port msgh_remote_port +#define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) + +#define MIG_RETURN_ERROR(X, code) {\ + ((mig_reply_error_t *)X)->RetCode = code;\ + ((mig_reply_error_t *)X)->NDR = NDR_record;\ + return;\ + } + +/* Forward Declarations */ + + +mig_internal novalue _Xmach_exception_raise + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _Xmach_exception_raise_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _Xmach_exception_raise_state_identity + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__mach_exc_subsystem__ +#if !defined(__MIG_check__Request__mach_exception_raise_t__defined) +#define __MIG_check__Request__mach_exception_raise_t__defined + +mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_t(__attribute__((__unused__)) __Request__mach_exception_raise_t *In0P) +{ + + typedef __Request__mach_exception_raise_t __Request; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + msgh_size = In0P->Head.msgh_size; + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 2) || + (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 16)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR || + In0P->thread.disposition != 17) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR || + In0P->task.disposition != 17) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined) + if (In0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined */ +#if __MigTypeCheck + if ( In0P->codeCnt > 2 ) + return MIG_BAD_ARGUMENTS; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 16)) / 8 < In0P->codeCnt) || + (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 16) + (8 * In0P->codeCnt))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__mach_exception_raise_t__defined) */ +#endif /* __MIG_check__Request__mach_exc_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine mach_exception_raise */ +mig_internal novalue _Xmach_exception_raise + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t thread; + mach_msg_port_descriptor_t task; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__mach_exception_raise_t __Request; + typedef __Reply__mach_exception_raise_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__mach_exception_raise_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__mach_exception_raise_t__defined */ + + __DeclareRcvRpc(2405, "mach_exception_raise") + __BeforeRcvRpc(2405, "mach_exception_raise") + +#if defined(__MIG_check__Request__mach_exception_raise_t__defined) + check_result = __MIG_check__Request__mach_exception_raise_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__mach_exception_raise_t__defined) */ + + OutP->RetCode = catch_mach_exception_raise(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt); + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(2405, "mach_exception_raise") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__mach_exc_subsystem__ +#if !defined(__MIG_check__Request__mach_exception_raise_state_t__defined) +#define __MIG_check__Request__mach_exception_raise_state_t__defined + +mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_t **In1PP) +{ + + typedef __Request__mach_exception_raise_state_t __Request; + __Request *In1P; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + unsigned int msgh_size_delta; + +#if __MigTypeCheck + msgh_size = In0P->Head.msgh_size; + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined) + if (In0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined */ + msgh_size_delta = (8 * In0P->codeCnt); +#if __MigTypeCheck + if ( In0P->codeCnt > 2 ) + return MIG_BAD_ARGUMENTS; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 8 < In0P->codeCnt) || + (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912) + (8 * In0P->codeCnt))) + return MIG_BAD_ARGUMENTS; + msgh_size -= msgh_size_delta; +#endif /* __MigTypeCheck */ + + *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16); + +#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined) + if (In0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined */ +#if __MigTypeCheck + if ( In1P->old_stateCnt > 224 ) + return MIG_BAD_ARGUMENTS; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 4 < In1P->old_stateCnt) || + (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 912) + (4 * In1P->old_stateCnt))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */ +#endif /* __MIG_check__Request__mach_exc_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine mach_exception_raise_state */ +mig_internal novalue _Xmach_exception_raise_state + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + int flavor; + mach_msg_type_number_t old_stateCnt; + natural_t old_state[224]; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__mach_exception_raise_state_t __Request; + typedef __Reply__mach_exception_raise_state_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Request *In1P; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__mach_exception_raise_state_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__mach_exception_raise_state_t__defined */ + + __DeclareRcvRpc(2406, "mach_exception_raise_state") + __BeforeRcvRpc(2406, "mach_exception_raise_state") + +#if defined(__MIG_check__Request__mach_exception_raise_state_t__defined) + check_result = __MIG_check__Request__mach_exception_raise_state_t((__Request *)In0P, (__Request **)&In1P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */ + + OutP->new_stateCnt = 224; + + OutP->RetCode = catch_mach_exception_raise_state(In0P->Head.msgh_request_port, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt); + if (OutP->RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, OutP->RetCode); + } + + OutP->NDR = NDR_record; + + + OutP->flavor = In1P->flavor; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 896) + (((4 * OutP->new_stateCnt))); + + __AfterRcvRpc(2406, "mach_exception_raise_state") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__mach_exc_subsystem__ +#if !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) +#define __MIG_check__Request__mach_exception_raise_state_identity_t__defined + +mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_identity_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t **In1PP) +{ + + typedef __Request__mach_exception_raise_state_identity_t __Request; + __Request *In1P; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + unsigned int msgh_size_delta; + +#if __MigTypeCheck + msgh_size = In0P->Head.msgh_size; + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 2) || + (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR || + In0P->thread.disposition != 17) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR || + In0P->task.disposition != 17) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined) + if (In0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined */ + msgh_size_delta = (8 * In0P->codeCnt); +#if __MigTypeCheck + if ( In0P->codeCnt > 2 ) + return MIG_BAD_ARGUMENTS; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 8 < In0P->codeCnt) || + (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912) + (8 * In0P->codeCnt))) + return MIG_BAD_ARGUMENTS; + msgh_size -= msgh_size_delta; +#endif /* __MigTypeCheck */ + + *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16); + +#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined) + if (In0P->NDR.int_rep != NDR_record.int_rep) + __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep); +#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined */ +#if __MigTypeCheck + if ( In1P->old_stateCnt > 224 ) + return MIG_BAD_ARGUMENTS; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 4 < In1P->old_stateCnt) || + (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 912) + (4 * In1P->old_stateCnt))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */ +#endif /* __MIG_check__Request__mach_exc_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine mach_exception_raise_state_identity */ +mig_internal novalue _Xmach_exception_raise_state_identity + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t thread; + mach_msg_port_descriptor_t task; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + int flavor; + mach_msg_type_number_t old_stateCnt; + natural_t old_state[224]; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__mach_exception_raise_state_identity_t __Request; + typedef __Reply__mach_exception_raise_state_identity_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Request *In1P; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__mach_exception_raise_state_identity_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__mach_exception_raise_state_identity_t__defined */ + + __DeclareRcvRpc(2407, "mach_exception_raise_state_identity") + __BeforeRcvRpc(2407, "mach_exception_raise_state_identity") + +#if defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) + check_result = __MIG_check__Request__mach_exception_raise_state_identity_t((__Request *)In0P, (__Request **)&In1P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */ + + OutP->new_stateCnt = 224; + + OutP->RetCode = catch_mach_exception_raise_state_identity(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt); + if (OutP->RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, OutP->RetCode); + } + + OutP->NDR = NDR_record; + + + OutP->flavor = In1P->flavor; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 896) + (((4 * OutP->new_stateCnt))); + + __AfterRcvRpc(2407, "mach_exception_raise_state_identity") +} + + + +/* Description of this subsystem, for use in direct RPC */ +const struct catch_mach_exc_subsystem catch_mach_exc_subsystem = { + mach_exc_server_routine, + 2405, + 2408, + (mach_msg_size_t)sizeof(union __ReplyUnion__catch_mach_exc_subsystem), + (vm_address_t)0, + { + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _Xmach_exception_raise, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _Xmach_exception_raise_state, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _Xmach_exception_raise_state_identity, 11, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_identity_t)}, + } +}; + +mig_external boolean_t mach_exc_server + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + register mig_routine_t routine; + + OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); + OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; + /* Minimal size: routine() will update it if different */ + OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); + OutHeadP->msgh_local_port = MACH_PORT_NULL; + OutHeadP->msgh_id = InHeadP->msgh_id + 100; + OutHeadP->msgh_reserved = 0; + + if ((InHeadP->msgh_id > 2407) || (InHeadP->msgh_id < 2405) || + ((routine = catch_mach_exc_subsystem.routine[InHeadP->msgh_id - 2405].stub_routine) == 0)) { + ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; + ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; + return FALSE; + } + (*routine) (InHeadP, OutHeadP); + return TRUE; +} + +mig_external mig_routine_t mach_exc_server_routine + (mach_msg_header_t *InHeadP) +{ + register int msgh_id; + + msgh_id = InHeadP->msgh_id - 2405; + + if ((msgh_id > 2) || (msgh_id < 0)) + return 0; + + return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; +} + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ diff --git a/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.h b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.h new file mode 100644 index 0000000..941b227 --- /dev/null +++ b/Pods/CwlMachBadInstructionHandler/Sources/CwlMachBadInstructionHandler/mach_excServer.h @@ -0,0 +1,329 @@ +#ifdef __APPLE__ +#import "TargetConditionals.h" +#if TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_VISION + +#ifndef _mach_exc_server_ +#define _mach_exc_server_ + +/* Module mach_exc */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef mach_exc_MSG_COUNT +#define mach_exc_MSG_COUNT 3 +#endif /* mach_exc_MSG_COUNT */ + +#include +#include +#include +#include + +#ifdef __BeforeMigServerHeader +__BeforeMigServerHeader +#endif /* __BeforeMigServerHeader */ + + +/* Routine mach_exception_raise */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t catch_mach_exception_raise +( + mach_port_t exception_port, + mach_port_t thread, + mach_port_t task, + exception_type_t exception, + mach_exception_data_t code, + mach_msg_type_number_t codeCnt +); + +/* Routine mach_exception_raise_state */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t catch_mach_exception_raise_state +( + mach_port_t exception_port, + exception_type_t exception, + const mach_exception_data_t code, + mach_msg_type_number_t codeCnt, + int *flavor, + const thread_state_t old_state, + mach_msg_type_number_t old_stateCnt, + thread_state_t new_state, + mach_msg_type_number_t *new_stateCnt +); + +/* Routine mach_exception_raise_state_identity */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t catch_mach_exception_raise_state_identity +( + mach_port_t exception_port, + mach_port_t thread, + mach_port_t task, + exception_type_t exception, + mach_exception_data_t code, + mach_msg_type_number_t codeCnt, + int *flavor, + thread_state_t old_state, + mach_msg_type_number_t old_stateCnt, + thread_state_t new_state, + mach_msg_type_number_t *new_stateCnt +); + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +boolean_t mach_exc_server( + mach_msg_header_t *InHeadP, + mach_msg_header_t *OutHeadP); + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +mig_routine_t mach_exc_server_routine( + mach_msg_header_t *InHeadP); + + +/* Description of this subsystem, for use in direct RPC */ +extern const struct catch_mach_exc_subsystem { + mig_server_routine_t server; /* Server routine */ + mach_msg_id_t start; /* Min routine number */ + mach_msg_id_t end; /* Max routine number + 1 */ + unsigned int maxsize; /* Max msg size */ + vm_address_t reserved; /* Reserved */ + struct routine_descriptor /*Array of routine descriptors */ + routine[3]; +} catch_mach_exc_subsystem; + +/* typedefs for all requests */ + +#ifndef __Request__mach_exc_subsystem__defined +#define __Request__mach_exc_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t thread; + mach_msg_port_descriptor_t task; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + } __Request__mach_exception_raise_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + int flavor; + mach_msg_type_number_t old_stateCnt; + natural_t old_state[224]; + } __Request__mach_exception_raise_state_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t thread; + mach_msg_port_descriptor_t task; + /* end of the kernel processed data */ + NDR_record_t NDR; + exception_type_t exception; + mach_msg_type_number_t codeCnt; + int64_t code[2]; + int flavor; + mach_msg_type_number_t old_stateCnt; + natural_t old_state[224]; + } __Request__mach_exception_raise_state_identity_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__mach_exc_subsystem__defined */ + + +/* union of all requests */ + +#ifndef __RequestUnion__catch_mach_exc_subsystem__defined +#define __RequestUnion__catch_mach_exc_subsystem__defined +union __RequestUnion__catch_mach_exc_subsystem { + __Request__mach_exception_raise_t Request_mach_exception_raise; + __Request__mach_exception_raise_state_t Request_mach_exception_raise_state; + __Request__mach_exception_raise_state_identity_t Request_mach_exception_raise_state_identity; +}; +#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__mach_exc_subsystem__defined +#define __Reply__mach_exc_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__mach_exception_raise_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + int flavor; + mach_msg_type_number_t new_stateCnt; + natural_t new_state[224]; + } __Reply__mach_exception_raise_state_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + int flavor; + mach_msg_type_number_t new_stateCnt; + natural_t new_state[224]; + } __Reply__mach_exception_raise_state_identity_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__mach_exc_subsystem__defined */ + + +/* union of all replies */ + +#ifndef __ReplyUnion__catch_mach_exc_subsystem__defined +#define __ReplyUnion__catch_mach_exc_subsystem__defined +union __ReplyUnion__catch_mach_exc_subsystem { + __Reply__mach_exception_raise_t Reply_mach_exception_raise; + __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state; + __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity; +}; +#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */ + +#ifndef subsystem_to_name_map_mach_exc +#define subsystem_to_name_map_mach_exc \ + { "mach_exception_raise", 2405 },\ + { "mach_exception_raise_state", 2406 },\ + { "mach_exception_raise_state_identity", 2407 } +#endif + +#ifdef __AfterMigServerHeader +__AfterMigServerHeader +#endif /* __AfterMigServerHeader */ + +#endif /* _mach_exc_server_ */ + +#endif /* TARGET_OS_OSX || TARGET_OS_IOS */ +#endif /* __APPLE__ */ diff --git a/Pods/CwlPosixPreconditionTesting/LICENSE.txt b/Pods/CwlPosixPreconditionTesting/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Pods/CwlPosixPreconditionTesting/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Pods/CwlPosixPreconditionTesting/README.md b/Pods/CwlPosixPreconditionTesting/README.md new file mode 100644 index 0000000..dd3fef1 --- /dev/null +++ b/Pods/CwlPosixPreconditionTesting/README.md @@ -0,0 +1,59 @@ +# CwlPreconditionTesting + +A Mach exception handler, written in Swift and Objective-C, that allows `EXC_BAD_INSTRUCTION` (as raised by Swift's `assertionFailure`/`preconditionFailure`/`fatalError`) to be caught and tested. + +NOTE: the iOS code runs in the simulator *only*. It is for logic testing and cannot be deployed to the device due to the Mach exception API being private on iOS. + +For an extended discussion of this code, please see the Cocoa with Love article: + +[Partial functions in Swift, Part 2: Catching precondition failures](http://cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html) + +## Requirements + +From version 2.0.0-beta.1, building CwlPreconditionTesting requires Swift 5 or newer and the Swift Package Manager, or CocoaPods. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlPreconditionTesting/tree/1.2.0). + +## Adding to your project + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: Version("2.0.0")) + +Or by adding `https://github.com/mattgallagher/CwlPreconditionTesting.git`, version 2.0.0 or later, to the list of Swift packages for any project in Xcode. + +### CocoaPods + +CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlPreconditionTesting into your Xcode project using CocoaPods, specify it in your Podfile: + +pod 'CwlPreconditionTesting', '~> 2.0' + +## Usage + +On macOS and iOS you can use the regular version: + +```swift +import CwlPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +on tvOS, Linux and other platforms, you can use the POSIX version: + +```swift +import CwlPosixPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +**Warning**: this POSIX version can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring. You should disable the "Debug Executable" setting for the tests in Xcode. The POSIX version of the signal handler is also whole process (rather than correctly scoped to the thread where the "catch" occurs). + +## Thanks + +Includes contributions from @abbeycode, @dnkoutso, @jeffh and @ikesyo. Extra thanks to @saagarjha for help with the ARM64 additions. \ No newline at end of file diff --git a/Pods/CwlPosixPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift b/Pods/CwlPosixPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift new file mode 100644 index 0000000..0ee63e5 --- /dev/null +++ b/Pods/CwlPosixPreconditionTesting/Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift @@ -0,0 +1,119 @@ +// +// CwlCatchBadInstructionPosix.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 8/02/2016. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if arch(x86_64) || arch(arm64) + +import Foundation + +// This file is an alternative implementation to CwlCatchBadInstruction.swift that uses a SIGILL signal action and setenv/longjmp instead of a Mach exception handler and Objective-C exception raising. +// +// WARNING: +// This code is quick and dirty. It's a proof of concept for using a SIGILL handler and setjmp/longjmp where Mach exceptions and the Obj-C runtime aren't available. I ran the automated tests when I first wrote this code but I don't personally use it at all so by the time you're reading this comment, it probably broke and I didn't notice. +// Obvious limitations: +// * It doesn't work when debugging with lldb. +// * It doesn't scope correctly to the thread (it's global) +// * In violation of rules for signal handlers, it writes to the "red zone" on the stack +// * It isn't re-entrant +// * Plus all of the same caveats as the Mach exceptions version (doesn't play well with other handlers, probably leaks ARC memory, etc) +// Treat it like a loaded shotgun. Don't point it at your face. + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +let callThreadExit = { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} as @convention(c) () -> Void + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.bindMemory(to: ucontext64_t.self, capacity: 1) else { return } + + #if arch(x86_64) + // 1. Decrement the stack pointer + context.pointee.uc_mcontext64.pointee.__ss.__rsp -= UInt64(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext64.pointee.__ss.__rsp + if let ump = UnsafeMutablePointer(bitPattern: UInt(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + context.pointee.uc_mcontext64.pointee.__ss.__rip = unsafeBitCast(callThreadExit, to: UInt64.self) + #elseif arch(arm64) + // 1. Set the link register to the current address. + context.pointee.uc_mcontext64.pointee.__ss.__lr = context.pointee.uc_mcontext64.pointee.__ss.__pc + + // 2. Set the Instruction Pointer to the new function's address. + context.pointee.uc_mcontext64.pointee.__ss.__pc = unsafeBitCast(callThreadExit, to: UInt64.self) + #endif +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +#if arch(x86_64) +public let nativeSignal = SIGILL +#elseif arch(arm64) +public let nativeSignal = SIGTRAP +#endif + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + let action = __sigaction_u(__sa_sigaction: sigIllHandler) + var sigActionNew = sigaction(__sigaction_u: action, sa_mask: sigset_t(), sa_flags: SA_SIGINFO) + + // Install the signal action + if sigaction(nativeSignal, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") + } + + defer { + // Restore the previous signal action + if sigaction(nativeSignal, &sigActionPrev, nil) != 0 { + fatalError("Sigaction error: \(errno)") + } + } + + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t? = nil + let e = pthread_create(&handlerThread, nil, { arg in + arg.bindMemory(to: (() -> Void).self, capacity: 1).pointee() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") + + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread!, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 + } + + return caught ? BadInstructionException() : nil +} + +#endif diff --git a/Pods/CwlPreconditionTesting/LICENSE.txt b/Pods/CwlPreconditionTesting/LICENSE.txt new file mode 100644 index 0000000..693a2fe --- /dev/null +++ b/Pods/CwlPreconditionTesting/LICENSE.txt @@ -0,0 +1,15 @@ +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Pods/CwlPreconditionTesting/README.md b/Pods/CwlPreconditionTesting/README.md new file mode 100644 index 0000000..dd3fef1 --- /dev/null +++ b/Pods/CwlPreconditionTesting/README.md @@ -0,0 +1,59 @@ +# CwlPreconditionTesting + +A Mach exception handler, written in Swift and Objective-C, that allows `EXC_BAD_INSTRUCTION` (as raised by Swift's `assertionFailure`/`preconditionFailure`/`fatalError`) to be caught and tested. + +NOTE: the iOS code runs in the simulator *only*. It is for logic testing and cannot be deployed to the device due to the Mach exception API being private on iOS. + +For an extended discussion of this code, please see the Cocoa with Love article: + +[Partial functions in Swift, Part 2: Catching precondition failures](http://cocoawithlove.com/blog/2016/02/02/partial-functions-part-two-catching-precondition-failures.html) + +## Requirements + +From version 2.0.0-beta.1, building CwlPreconditionTesting requires Swift 5 or newer and the Swift Package Manager, or CocoaPods. + +For use with older versions of Swift or other package managers, [use version 1.2.0 or older](https://github.com/mattgallagher/CwlPreconditionTesting/tree/1.2.0). + +## Adding to your project + +### Swift Package Manager + +Add the following to the `dependencies` array in your "Package.swift" file: + + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: Version("2.0.0")) + +Or by adding `https://github.com/mattgallagher/CwlPreconditionTesting.git`, version 2.0.0 or later, to the list of Swift packages for any project in Xcode. + +### CocoaPods + +CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate CwlPreconditionTesting into your Xcode project using CocoaPods, specify it in your Podfile: + +pod 'CwlPreconditionTesting', '~> 2.0' + +## Usage + +On macOS and iOS you can use the regular version: + +```swift +import CwlPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +on tvOS, Linux and other platforms, you can use the POSIX version: + +```swift +import CwlPosixPreconditionTesting + +let e = catchBadInstruction { + precondition(false, "THIS PRECONDITION FAILURE IS EXPECTED") +} +``` + +**Warning**: this POSIX version can't be used when lldb is attached since lldb's Mach exception handler blocks the SIGILL from ever occurring. You should disable the "Debug Executable" setting for the tests in Xcode. The POSIX version of the signal handler is also whole process (rather than correctly scoped to the thread where the "catch" occurs). + +## Thanks + +Includes contributions from @abbeycode, @dnkoutso, @jeffh and @ikesyo. Extra thanks to @saagarjha for help with the ARM64 additions. \ No newline at end of file diff --git a/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift new file mode 100644 index 0000000..002219d --- /dev/null +++ b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlBadInstructionException.swift @@ -0,0 +1,92 @@ +// +// CwlBadInstructionException.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if (os(macOS) || os(iOS) || os(visionOS)) && (arch(x86_64) || arch(arm64)) + +import Foundation + +#if SWIFT_PACKAGE || COCOAPODS + import CwlMachBadInstructionHandler +#endif + +var raiseBadInstructionException = { + BadInstructionException().raise() +} as @convention(c) () -> Void + +/// A simple NSException subclass. It's not required to subclass NSException (since the exception type is represented in the name) but this helps for identifying the exception through runtime type. +@objc(BadInstructionException) +public class BadInstructionException: NSException { + static var name: String = "com.cocoawithlove.BadInstruction" + + init() { + super.init(name: NSExceptionName(rawValue: BadInstructionException.name), reason: nil, userInfo: nil) + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. + @objc(receiveReply:) + public class func receiveReply(_ reply: bad_instruction_exception_reply_t) -> CInt { + let old_state = UnsafeRawPointer(reply.old_state!).bindMemory(to: NativeThreadState.self, capacity: 1) + let old_stateCnt: mach_msg_type_number_t = reply.old_stateCnt + let new_state = UnsafeMutableRawPointer(reply.new_state!).bindMemory(to: NativeThreadState.self, capacity: 1) + let new_stateCnt: UnsafeMutablePointer = reply.new_stateCnt! + + // Make sure we've been given enough memory + guard + old_stateCnt == nativeThreadStateCount, + new_stateCnt.pointee >= nativeThreadStateCount + else { + return KERN_INVALID_ARGUMENT + } + + // 0. Copy over the state. + new_state.pointee = old_state.pointee + +#if arch(x86_64) + // 1. Decrement the stack pointer + new_state.pointee.__rsp -= UInt64(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + guard let pointer = UnsafeMutablePointer(bitPattern: UInt(new_state.pointee.__rsp)) else { + return KERN_INVALID_ARGUMENT + } + pointer.pointee = old_state.pointee.__rip + + // 3. Set the Instruction Pointer to the new function's address + new_state.pointee.__rip = unsafeBitCast(raiseBadInstructionException, to: UInt64.self) + +#elseif arch(arm64) + // 1. Set the link register to the current address. + new_state.pointee.__lr = old_state.pointee.__pc + + // 2. Set the Instruction Pointer to the new function's address. + new_state.pointee.__pc = unsafeBitCast(raiseBadInstructionException, to: UInt64.self) +#endif + + new_stateCnt.pointee = nativeThreadStateCount + + return KERN_SUCCESS + } +} + +#endif diff --git a/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift new file mode 100644 index 0000000..833abc1 --- /dev/null +++ b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift @@ -0,0 +1,170 @@ +// +// CwlCatchBadInstruction.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if (os(macOS) || os(iOS) || os(visionOS)) && (arch(x86_64) || arch(arm64)) + +import Foundation +import Swift + +#if SWIFT_PACKAGE || COCOAPODS + import CwlCatchException + import CwlMachBadInstructionHandler +#endif + +private enum PthreadError: Error { case code(Int32) } +private enum MachExcServer: Error { case code(kern_return_t) } + +/// A quick function for converting Mach error results into Swift errors +private func kernCheck(_ f: () -> Int32) throws { + let r = f() + guard r == KERN_SUCCESS else { + throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) + } +} + +extension request_mach_exception_raise_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) + } + } + } +} + +extension reply_mach_exception_raise_state_t { + mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { + return withUnsafeMutablePointer(to: &self) { p -> R in + return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in + return block(ptr) + } + } + } +} + +/// A structure used to store context associated with the Mach message port +private struct MachContext { + var masks = execTypesCountTuple() + var count: mach_msg_type_number_t = 0 + var ports = execTypesCountTuple() + var behaviors = execTypesCountTuple() + var flavors = execTypesCountTuple() + var currentExceptionPort: mach_port_t = 0 + var handlerThread: pthread_t? = nil + + static func internalMutablePointers(_ m: UnsafeMutablePointer>, _ c: UnsafeMutablePointer, _ p: UnsafeMutablePointer>, _ b: UnsafeMutablePointer>, _ f: UnsafeMutablePointer>, _ block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return m.withMemoryRebound(to: exception_mask_t.self, capacity: 1) { masksPtr in + return c.withMemoryRebound(to: mach_msg_type_number_t.self, capacity: 1) { countPtr in + return p.withMemoryRebound(to: mach_port_t.self, capacity: 1) { portsPtr in + return b.withMemoryRebound(to: exception_behavior_t.self, capacity: 1) { behaviorsPtr in + return f.withMemoryRebound(to: thread_state_flavor_t.self, capacity: 1) { flavorsPtr in + return block(masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } + } + } + } + } + } + + mutating func withUnsafeMutablePointers(in block: @escaping (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { + return MachContext.internalMutablePointers(&masks, &count, &ports, &behaviors, &flavors, block) + } +} + +/// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). +private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { + let context = arg.assumingMemoryBound(to: MachContext.self).pointee + mach_msg_server(unsafeBitCast(mach_exc_server as (@convention(c) (UnsafeMutablePointer, UnsafeMutablePointer) -> boolean_t), to: (@convention(c) (UnsafeMutablePointer?, UnsafeMutablePointer?) -> boolean_t).self), 4096, context.currentExceptionPort, MACH_MSG_OPTION_NONE) + return nil +} + +/// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(in block: @escaping () -> Void) -> BadInstructionException? { + // Suppress Swift runtime's direct triggering of the debugger and exclusivity checking which crashes when we throw past it + let previousExclusivity = _swift_disableExclusivityChecking + let previousReporting = _swift_reportFatalErrorsToDebugger + _swift_disableExclusivityChecking = true + _swift_reportFatalErrorsToDebugger = false + defer { + _swift_reportFatalErrorsToDebugger = previousReporting + _swift_disableExclusivityChecking = previousExclusivity + } + + var context = MachContext() + var result: BadInstructionException? = nil + do { + var handlerThread: pthread_t? = nil + defer { + // 8. Wait for the thread to terminate *if* we actually made it to the creation point + // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. + if handlerThread != nil { + pthread_join(handlerThread!, nil) + } + } + + try kernCheck { + // 1. Create the mach port + mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) + } + defer { + // 7. Cleanup the mach port + // When the reference count for the right goes down to 0, it triggers the right to be deallocated + mach_port_mod_refs(mach_task_self_, context.currentExceptionPort, MACH_PORT_RIGHT_RECEIVE, -1) + // All rights deallocated, can deallocate the name/port + mach_port_deallocate(mach_task_self_, context.currentExceptionPort) + } + + try kernCheck { + // 2. Configure the mach port + mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) + } + + let currentExceptionPtr = context.currentExceptionPort + try kernCheck { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 3. Apply the mach port as the handler for this thread + thread_swap_exception_ports(mach_thread_self(), nativeMachExceptionMask, currentExceptionPtr, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), nativeThreadState, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + defer { context.withUnsafeMutablePointers { masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr in + // 6. Unapply the mach port + _ = thread_swap_exception_ports(mach_thread_self(), nativeMachExceptionMask, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, countPtr, portsPtr, behaviorsPtr, flavorsPtr) + } } + + try withUnsafeMutablePointer(to: &context) { c throws in + // 4. Create the thread + let e = pthread_create(&handlerThread, nil, machMessageHandler, c) + guard e == 0 else { throw PthreadError.code(e) } + + // 5. Run the block + result = BadInstructionException.catchException(in: block) + } + } catch { + // Should never be reached but this is testing code, don't try to recover, just abort + fatalError("Mach port error: \(error)") + } + + return result +} + +#endif + diff --git a/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift new file mode 100644 index 0000000..ad01ccf --- /dev/null +++ b/Pods/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift @@ -0,0 +1,64 @@ +// +// CwlDarwinDefinitions.swift +// CwlPreconditionTesting +// +// Created by Matt Gallagher on 2016/01/10. +// Copyright © 2016 Matt Gallagher ( https://www.cocoawithlove.com ). All rights reserved. +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// + +#if (os(macOS) || os(iOS) || os(visionOS)) && (arch(x86_64) || arch(arm64)) + +import Darwin + +// From /usr/include/mach/message.h +// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ +// #define MACH_MSGH_BITS_REMOTE(bits) \ +// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) +// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ +// ((remote) | ((local) << 8)) +public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 +public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } +public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } + +// From /usr/include/mach/exception_types.h +// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ +// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) +//public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION + +#if arch(x86_64) +// From /usr/include/mach/i386/thread_status.h +// #define x86_threadStateCount ((mach_msg_type_number_t) \ +// ( sizeof (x86_NativeThreadState) / sizeof (int) )) +public let nativeThreadState = x86_THREAD_STATE64 +public let nativeThreadStateCount = UInt32(MemoryLayout.size / MemoryLayout.size) +typealias NativeThreadState = x86_thread_state64_t +public let nativeMachExceptionMask = exception_mask_t(EXC_MASK_BAD_INSTRUCTION) +#elseif arch(arm64) +public let nativeThreadState = ARM_THREAD_STATE64 +public let nativeThreadStateCount = UInt32(MemoryLayout.size / MemoryLayout.size) +typealias NativeThreadState = arm_thread_state64_t +public let nativeMachExceptionMask = exception_mask_t(EXC_MASK_BREAKPOINT) +#endif + +public let EXC_TYPES_COUNT = 14 +public struct execTypesCountTuple { + // From /usr/include/mach/i386/exception.h + // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ + public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + public init() { + } +} + +#endif diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..c24fbd1 --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,40 @@ +PODS: + - CwlCatchException (2.2.0): + - CwlCatchExceptionSupport (~> 2.2.0) + - CwlCatchExceptionSupport (2.2.0) + - CwlMachBadInstructionHandler (2.2.0) + - CwlPosixPreconditionTesting (2.2.0) + - CwlPreconditionTesting (2.2.1): + - CwlCatchException (~> 2.2.0) + - CwlMachBadInstructionHandler (~> 2.2.0) + - CwlPosixPreconditionTesting (~> 2.2.0) + - Nimble (13.2.1): + - CwlPreconditionTesting (~> 2.2.0) + - Quick (7.5.0) + +DEPENDENCIES: + - Nimble (= 13.2.1) + - Quick (= 7.5.0) + +SPEC REPOS: + trunk: + - CwlCatchException + - CwlCatchExceptionSupport + - CwlMachBadInstructionHandler + - CwlPosixPreconditionTesting + - CwlPreconditionTesting + - Nimble + - Quick + +SPEC CHECKSUMS: + CwlCatchException: 51bf8319009a31104ea6f0568730d1ecc25b6454 + CwlCatchExceptionSupport: 1345d6adb01a505933f2bc972dab60dcb9ce3e50 + CwlMachBadInstructionHandler: ea1030428925d9bf340882522af30712fb4bf356 + CwlPosixPreconditionTesting: a125dee731883f2582715f548c6b6c92c7fde145 + CwlPreconditionTesting: ccfd08aca58d14e04062b2a3dd2fd52e09857453 + Nimble: 9e81a67096dab1d1f5160d7a3f8fa7a1eeec38fd + Quick: 2b651168441479b949ba987f3cee41a9cc53aa32 + +PODFILE CHECKSUM: 5e290fe0b5d1284128dec7e8e8c54647d651c52c + +COCOAPODS: 1.15.2 diff --git a/Pods/Nimble/LICENSE b/Pods/Nimble/LICENSE new file mode 100644 index 0000000..82b84bf --- /dev/null +++ b/Pods/Nimble/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Pods/Nimble/README.md b/Pods/Nimble/README.md new file mode 100644 index 0000000..8137a10 --- /dev/null +++ b/Pods/Nimble/README.md @@ -0,0 +1,2129 @@ +# Nimble + +[![Build Status](https://github.com/Quick/Nimble/actions/workflows/ci-xcode.yml/badge.svg)](https://github.com/Quick/Nimble/actions/workflows/ci-xcode.yml) +[![CocoaPods](https://img.shields.io/cocoapods/v/Nimble.svg)](https://cocoapods.org/pods/Nimble) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platforms](https://img.shields.io/cocoapods/p/Nimble.svg)](https://cocoapods.org/pods/Nimble) + +Use Nimble to express the expected outcomes of Swift +or Objective-C expressions. Inspired by +[Cedar](https://github.com/pivotal/cedar). + +```swift +// Swift +expect(1 + 1).to(equal(2)) +expect(1.2).to(beCloseTo(1.1, within: 0.1)) +expect(3) > 2 +expect("seahorse").to(contain("sea")) +expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) +expect(ocean.isClean).toEventually(beTruthy()) +``` + +# How to Use Nimble + + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest) +- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto) + - [Custom Failure Messages](#custom-failure-messages) + - [Type Safety](#type-safety) + - [Operator Overloads](#operator-overloads) + - [Lazily Computed Values](#lazily-computed-values) + - [C Primitives](#c-primitives) + - [Async/Await Support](#asyncawait-support) + - [Async Matchers](#async-matchers) + - [Polling Expectations](#polling-expectations) + - [Using Polling Expectations in Async Tests](#using-polling-expectations-in-async-tests) + - [Verifying a Matcher will Never or Always Match](#verifying-a-matcher-will-never-or-always-match) + - [Waiting for a Callback to be Called](#waiting-for-a-callback-to-be-called) + - [Changing the Timeout and Polling Intervals](#changing-the-timeout-and-polling-intervals) + - [Changing default Timeout and Poll Intervals](#changing-default-timeout-and-poll-intervals) + - [Quick](#quick) + - [XCTest](#xctest) + - [Objective-C Support](#objective-c-support) + - [Disabling Objective-C Shorthand](#disabling-objective-c-shorthand) +- [Using `require` to demand that a matcher pass before continuing](#using-require-to-demand-that-a-matcher-pass-before-continuing) + - [Polling with `require`.](#polling-with-require) + - [Using `require` with Async expressions and Async matchers](#using-require-with-async-expressions-and-async-matchers) + - [Using `unwrap` to replace `require(...).toNot(beNil())`](#using-unwrap-to-replace-requiretonotbenil) + - [Throwing a Custom Error from Require](#throwing-a-custom-error-from-require) +- [Built-in Matcher Functions](#built-in-matcher-functions) + - [Type Checking](#type-checking) + - [Equivalence](#equivalence) + - [Identity](#identity) + - [Comparisons](#comparisons) + - [Types/Classes](#typesclasses) + - [Truthiness](#truthiness) + - [Swift Assertions](#swift-assertions) + - [Swift Error Handling](#swift-error-handling) + - [Exceptions](#exceptions) + - [Collection Membership](#collection-membership) + - [Strings](#strings) + - [Collection Elements](#collection-elements) + - [Swift](#swift) + - [Objective-C](#objective-c) + - [Collection Count](#collection-count) + - [Notifications](#notifications) + - [Result](#result) + - [Matching a value to any of a group of matchers](#matching-a-value-to-any-of-a-group-of-matchers) + - [Custom Validation](#custom-validation) + - [Mapping a Value to Another Value](#mapping-a-value-to-another-value) +- [Writing Your Own Matchers](#writing-your-own-matchers) + - [MatcherResult](#matcherresult) + - [Lazy Evaluation](#lazy-evaluation) + - [Type Checking via Swift Generics](#type-checking-via-swift-generics) + - [Customizing Failure Messages](#customizing-failure-messages) + - [Basic Customization](#basic-customization) + - [Full Customization](#full-customization) + - [Asynchronous Matchers](#asynchronous-matchers) + - [Supporting Objective-C](#supporting-objective-c) + - [Properly Handling `nil` in Objective-C Matchers](#properly-handling-nil-in-objective-c-matchers) +- [Installing Nimble](#installing-nimble) + - [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule) + - [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods) + - [Installing Nimble via Swift Package Manager](#installing-nimble-via-swift-package-manager) + - [Xcode](#xcode) + - [Package.Swift](#packageswift) + - [Using Nimble without XCTest](#using-nimble-without-xctest) + - [Privacy Statement](#privacy-statement) + + + +# Some Background: Expressing Outcomes Using Assertions in XCTest + +Apple's Xcode includes the XCTest framework, which provides +assertion macros to test whether code behaves properly. +For example, to assert that `1 + 1 = 2`, XCTest has you write: + +```swift +// Swift + +XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two") +``` + +Or, in Objective-C: + +```objc +// Objective-C + +XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two"); +``` + +XCTest assertions have a couple of drawbacks: + +1. **Not enough macros.** There's no easy way to assert that a string + contains a particular substring, or that a number is less than or + equal to another. +2. **It's hard to write asynchronous tests.** XCTest forces you to write + a lot of boilerplate code. + +Nimble addresses these concerns. + +# Nimble: Expectations Using `expect(...).to` + +Nimble allows you to express expectations using a natural, +easily understood language: + +```swift +// Swift + +import Nimble + +expect(seagull.squawk).to(equal("Squee!")) +``` + +```objc +// Objective-C + +@import Nimble; + +expect(seagull.squawk).to(equal(@"Squee!")); +``` + +> The `expect` function autocompletes to include `file:` and `line:`, + but these parameters are optional. Use the default values to have + Xcode highlight the correct line when an expectation is not met. + +To perform the opposite expectation--to assert something is *not* +equal--use `toNot` or `notTo`: + +```swift +// Swift + +import Nimble + +expect(seagull.squawk).toNot(equal("Oh, hello there!")) +expect(seagull.squawk).notTo(equal("Oh, hello there!")) +``` + +```objc +// Objective-C + +@import Nimble; + +expect(seagull.squawk).toNot(equal(@"Oh, hello there!")); +expect(seagull.squawk).notTo(equal(@"Oh, hello there!")); +``` + +## Custom Failure Messages + +Would you like to add more information to the test's failure messages? Use the `description` optional argument to add your own text: + +```swift +// Swift + +expect(1 + 1).to(equal(3)) +// failed - expected to equal <3>, got <2> + +expect(1 + 1).to(equal(3), description: "Make sure libKindergartenMath is loaded") +// failed - Make sure libKindergartenMath is loaded +// expected to equal <3>, got <2> +``` + +Or the *WithDescription version in Objective-C: + +```objc +// Objective-C + +@import Nimble; + +expect(@(1+1)).to(equal(@3)); +// failed - expected to equal <3.0000>, got <2.0000> + +expect(@(1+1)).toWithDescription(equal(@3), @"Make sure libKindergartenMath is loaded"); +// failed - Make sure libKindergartenMath is loaded +// expected to equal <3.0000>, got <2.0000> +``` + +## Type Safety + +Nimble makes sure you don't compare two types that don't match: + +```swift +// Swift + +// Does not compile: +expect(1 + 1).to(equal("Squee!")) +``` + +> Nimble uses generics--only available in Swift--to ensure + type correctness. That means type checking is + not available when using Nimble in Objective-C. :sob: + +## Operator Overloads + +Tired of so much typing? With Nimble, you can use overloaded operators +like `==` for equivalence, or `>` for comparisons: + +```swift +// Swift + +// Passes if squawk does not equal "Hi!": +expect(seagull.squawk) != "Hi!" + +// Passes if 10 is greater than 2: +expect(10) > 2 +``` + +> Operator overloads are only available in Swift, so you won't be able + to use this syntax in Objective-C. :broken_heart: + +## Lazily Computed Values + +The `expect` function doesn't evaluate the value it's given until it's +time to match. So Nimble can test whether an expression raises an +exception once evaluated: + +```swift +// Swift + +// Note: Swift currently doesn't have exceptions. +// Only Objective-C code can raise exceptions +// that Nimble will catch. +// (see https://github.com/Quick/Nimble/issues/220#issuecomment-172667064) +let exception = NSException( + name: NSInternalInconsistencyException, + reason: "Not enough fish in the sea.", + userInfo: ["something": "is fishy"]) +expect { exception.raise() }.to(raiseException()) + +// Also, you can customize raiseException to be more specific +expect { exception.raise() }.to(raiseException(named: NSInternalInconsistencyException)) +expect { exception.raise() }.to(raiseException( + named: NSInternalInconsistencyException, + reason: "Not enough fish in the sea")) +expect { exception.raise() }.to(raiseException( + named: NSInternalInconsistencyException, + reason: "Not enough fish in the sea", + userInfo: ["something": "is fishy"])) +``` + +Objective-C works the same way, but you must use the `expectAction` +macro when making an expectation on an expression that has no return +value: + +```objc +// Objective-C + +NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException + reason:@"Not enough fish in the sea." + userInfo:nil]; +expectAction(^{ [exception raise]; }).to(raiseException()); + +// Use the property-block syntax to be more specific. +expectAction(^{ [exception raise]; }).to(raiseException().named(NSInternalInconsistencyException)); +expectAction(^{ [exception raise]; }).to(raiseException(). + named(NSInternalInconsistencyException). + reason("Not enough fish in the sea")); +expectAction(^{ [exception raise]; }).to(raiseException(). + named(NSInternalInconsistencyException). + reason("Not enough fish in the sea"). + userInfo(@{@"something": @"is fishy"})); + +// You can also pass a block for custom matching of the raised exception +expectAction(exception.raise()).to(raiseException().satisfyingBlock(^(NSException *exception) { + expect(exception.name).to(beginWith(NSInternalInconsistencyException)); +})); +``` + +## C Primitives + +Some testing frameworks make it hard to test primitive C values. +In Nimble, it just works: + +```swift +// Swift + +let actual: CInt = 1 +let expectedValue: CInt = 1 +expect(actual).to(equal(expectedValue)) +``` + +In fact, Nimble uses type inference, so you can write the above +without explicitly specifying both types: + +```swift +// Swift + +expect(1 as CInt).to(equal(1)) +``` + +> In Objective-C, Nimble only supports Objective-C objects. To + make expectations on primitive C values, wrap then in an object + literal: + +```objc +expect(@(1 + 1)).to(equal(@2)); +``` + +## Async/Await Support + +Nimble makes it easy to await for an async function to complete. Simply pass +the async function in to `expect`: + +```swift +// Swift +await expect { await aFunctionReturning1() }.to(equal(1)) +``` + +The async function is awaited on first, before passing it to the matcher. This +enables the matcher to run synchronous code like before, without caring about +whether the value it's processing was abtained async or not. + +Async support is Swift-only, and it requires that you execute the test in an +async context. For XCTest, this is as simple as marking your test function with +`async`. If you use Quick, all tests in Quick 6 are executed in an async context. +In Quick 7 and later, only tests that are in an `AsyncSpec` subclass will be +executed in an async context. + +To avoid a compiler errors when using synchronous `expect` in asynchronous contexts, +`expect` with async expressions does not support autoclosures. However, the `expecta` +(expect async) function is provided as an alternative, which does support autoclosures. + +```swift +// Swift +await expecta(await aFunctionReturning1()).to(equal(1))) +``` + +Similarly, if you're ever in a situation where you want to force the compiler to +produce a `SyncExpectation`, you can use the `expects` (expect sync) function to +produce a `SyncExpectation`. Like so: + +```swift +// Swift +expects(someNonAsyncFunction()).to(equal(1))) + +expects(await someAsyncFunction()).to(equal(1)) // Compiler error: 'async' call in an autoclosure that does not support concurrency +``` + +### Async Matchers + +In addition to asserting on async functions prior to passing them to a +synchronous matcher, you can also write matchers that directly take in an +async value. These are called `AsyncMatcher`s. This is most obviously useful +when directly asserting against an actor. In addition to writing your own +async matchers, Nimble currently ships with async versions of the following +matchers: + +- `allPass` +- `containElementSatisfying` +- `satisfyAllOf` and the `&&` operator overload accept both `AsyncMatcher` and + synchronous `Matcher`s. +- `satisfyAnyOf` and the `||` operator overload accept both `AsyncMatcher` and + synchronous `Matcher`s. + +Note: Async/Await support is different than the `toEventually`/`toEventuallyNot` +feature described below. + +## Polling Expectations + +In Nimble, it's easy to make expectations on values that are updated +asynchronously. Just use `toEventually` or `toEventuallyNot`: + +```swift +// Swift +DispatchQueue.main.async { + ocean.add("dolphins") + ocean.add("whales") +} +expect(ocean).toEventually(contain("dolphins", "whales")) +``` + + +```objc +// Objective-C + +dispatch_async(dispatch_get_main_queue(), ^{ + [ocean add:@"dolphins"]; + [ocean add:@"whales"]; +}); +expect(ocean).toEventually(contain(@"dolphins", @"whales")); +``` + +Note: toEventually triggers its polls on the main thread. Blocking the main +thread will cause Nimble to stop the run loop. This can cause test pollution +for whatever incomplete code that was running on the main thread. Blocking the +main thread can be caused by blocking IO, calls to sleep(), deadlocks, and +synchronous IPC. + +In the above example, `ocean` is constantly re-evaluated. If it ever +contains dolphins and whales, the expectation passes. If `ocean` still +doesn't contain them, even after being continuously re-evaluated for one +whole second, the expectation fails. + +### Using Polling Expectations in Async Tests + +You can easily use `toEventually` or `toEventuallyNot` in async contexts as +well. You only need to add an `await` statement to the beginning of the line: + +```swift +// Swift +DispatchQueue.main.async { + ocean.add("dolphins") + ocean.add("whales") +} +await expect(ocean).toEventually(contain("dolphens", "whiles")) +``` + +Starting in Nimble 12, `toEventually` et. al. now also supports async +expectations. For example, the following test is now supported: + +```swift +actor MyActor { + private var counter = 0 + + func access() -> Int { + counter += 1 + return counter + } +} + +let subject = MyActor() +await expect { await subject.access() }.toEventually(equal(2)) +``` + +### Verifying a Matcher will Never or Always Match + +You can also test that a value always or never matches throughout the length of the timeout. Use `toNever` and `toAlways` for this: + +```swift +// Swift +ocean.add("dolphins") +expect(ocean).toAlways(contain("dolphins")) +expect(ocean).toNever(contain("hares")) +``` + +```objc +// Objective-C +[ocean add:@"dolphins"] +expect(ocean).toAlways(contain(@"dolphins")) +expect(ocean).toNever(contain(@"hares")) +``` + +### Waiting for a Callback to be Called + +You can also provide a callback by using the `waitUntil` function: + +```swift +// Swift + +waitUntil { done in + ocean.goFish { success in + expect(success).to(beTrue()) + done() + } +} +``` + +```objc +// Objective-C + +waitUntil(^(void (^done)(void)){ + [ocean goFishWithHandler:^(BOOL success){ + expect(success).to(beTrue()); + done(); + }]; +}); +``` + +`waitUntil` also optionally takes a timeout parameter: + +```swift +// Swift + +waitUntil(timeout: .seconds(10)) { done in + ocean.goFish { success in + expect(success).to(beTrue()) + done() + } +} +``` + +```objc +// Objective-C + +waitUntilTimeout(10, ^(void (^done)(void)){ + [ocean goFishWithHandler:^(BOOL success){ + expect(success).to(beTrue()); + done(); + }]; +}); +``` + +Note: `waitUntil` triggers its timeout code on the main thread. Blocking the main +thread will cause Nimble to stop the run loop to continue. This can cause test +pollution for whatever incomplete code that was running on the main thread. +Blocking the main thread can be caused by blocking IO, calls to sleep(), +deadlocks, and synchronous IPC. + +### Changing the Timeout and Polling Intervals + +Sometimes it takes more than a second for a value to update. In those +cases, use the `timeout` parameter: + +```swift +// Swift + +// Waits three seconds for ocean to contain "starfish": +expect(ocean).toEventually(contain("starfish"), timeout: .seconds(3)) + +// Evaluate someValue every 0.2 seconds repeatedly until it equals 100, or fails if it timeouts after 5.5 seconds. +expect(someValue).toEventually(equal(100), timeout: .milliseconds(5500), pollInterval: .milliseconds(200)) +``` + +```objc +// Objective-C + +// Waits three seconds for ocean to contain "starfish": +expect(ocean).withTimeout(3).toEventually(contain(@"starfish")); +``` + +### Changing default Timeout and Poll Intervals + +In some cases (e.g. when running on slower machines) it can be useful to modify +the default timeout and poll interval values. This can be done as follows: + +```swift +// Swift + +// Increase the global timeout to 5 seconds: +Nimble.PollingDefaults.timeout = .seconds(5) + +// Slow the polling interval to 0.1 seconds: +Nimble.PollingDefaults.pollInterval = .milliseconds(100) +``` + +You can set these globally at test startup in two ways: + +#### Quick + +If you use [Quick](https://github.com/Quick/Quick), add a [`QuickConfiguration` subclass](https://github.com/Quick/Quick/blob/main/Documentation/en-us/ConfiguringQuick.md) which sets your desired `PollingDefaults`. + +```swift +import Quick +import Nimble + +class PollingConfiguration: QuickConfiguration { + override class func configure(_ configuration: QCKConfiguration) { + Nimble.PollingDefaults.timeout = .seconds(5) + Nimble.PollingDefaults.pollInterval = .milliseconds(100) + } +} +``` + +#### XCTest + +If you use [XCTest](https://developer.apple.com/documentation/xctest), add an object that conforms to [`XCTestObservation`](https://developer.apple.com/documentation/xctest/xctestobservation) and implement [`testBundleWillStart(_:)`](https://developer.apple.com/documentation/xctest/xctestobservation/1500772-testbundlewillstart). + +Additionally, you will need to register this observer with the [`XCTestObservationCenter`](https://developer.apple.com/documentation/xctest/xctestobservationcenter) at test startup. To do this, set the `NSPrincipalClass` key in your test bundle's Info.plist and implement a class with that same name. + +For example + +```xml + + + + + + + NSPrincipalClass + MyTests.TestSetup + + +``` + +```swift +// TestSetup.swift +import XCTest +import Nimble + +@objc +class TestSetup: NSObject { + override init() { + XCTestObservationCenter.shared.register(PollingConfigurationTestObserver()) + } +} + +class PollingConfigurationTestObserver: NSObject, XCTestObserver { + func testBundleWillStart(_ testBundle: Bundle) { + Nimble.PollingDefaults.timeout = .seconds(5) + Nimble.PollingDefaults.pollInterval = .milliseconds(100) + } +} +``` + +In Linux, you can implement `LinuxMain` to set the PollingDefaults before calling `XCTMain`. + +## Objective-C Support + +Nimble has full support for Objective-C. However, there are two things +to keep in mind when using Nimble in Objective-C: + +1. All parameters passed to the `expect` function, as well as matcher + functions like `equal`, must be Objective-C objects or can be converted into + an `NSObject` equivalent: + + ```objc + // Objective-C + + @import Nimble; + + expect(@(1 + 1)).to(equal(@2)); + expect(@"Hello world").to(contain(@"world")); + + // Boxed as NSNumber * + expect(2).to(equal(2)); + expect(1.2).to(beLessThan(2.0)); + expect(true).to(beTruthy()); + + // Boxed as NSString * + expect("Hello world").to(equal("Hello world")); + + // Boxed as NSRange + expect(NSMakeRange(1, 10)).to(equal(NSMakeRange(1, 10))); + ``` + +2. To make an expectation on an expression that does not return a value, + such as `-[NSException raise]`, use `expectAction` instead of + `expect`: + + ```objc + // Objective-C + + expectAction(^{ [exception raise]; }).to(raiseException()); + ``` + +The following types are currently converted to an `NSObject` type: + + - **C Numeric types** are converted to `NSNumber *` + - `NSRange` is converted to `NSValue *` + - `char *` is converted to `NSString *` + +For the following matchers: + +- `equal` +- `beGreaterThan` +- `beGreaterThanOrEqual` +- `beLessThan` +- `beLessThanOrEqual` +- `beCloseTo` +- `beTrue` +- `beFalse` +- `beTruthy` +- `beFalsy` +- `haveCount` + + +If you would like to see more, [file an issue](https://github.com/Quick/Nimble/issues). + +## Disabling Objective-C Shorthand + +Nimble provides a shorthand for expressing expectations using the +`expect` function. To disable this shorthand in Objective-C, define the +`NIMBLE_DISABLE_SHORT_SYNTAX` macro somewhere in your code before +importing Nimble: + +```objc +#define NIMBLE_DISABLE_SHORT_SYNTAX 1 + +@import Nimble; + +NMB_expect(^{ return seagull.squawk; }, __FILE__, __LINE__).to(NMB_equal(@"Squee!")); +``` + +> Disabling the shorthand is useful if you're testing functions with + names that conflict with Nimble functions, such as `expect` or + `equal`. If that's not the case, there's no point in disabling the + shorthand. + +# Using `require` to demand that a matcher pass before continuing + +Nimble 13.1 added the `require` dsl to complement `expect`. `require` +looks similar to `expect` and works with matchers just like `expect` does. The +difference is that `require` requires that the matcher passes - if the matcher +doesn't pass, then `require` will throw an error. Additionally, if `require` +does pass, then it'll return the result of running the expression. + +For example, in testing a function that returns an array, you might need to +first guarantee that there are exactly 3 items in the array before continuing +to assert on it. Instead of writing code that needlessly duplicates an assertion +and a conditional like so: + +```swift +let collection = myFunction() +expect(collection).to(haveCount(3)) +guard collection.count == 3 else { return } +// ... +``` + +You can replace that with: + +```swift +let collection = try require(myFunction()).to(haveCount(3)) +// ... +``` + +## Polling with `require`. + +Because `require` does everything you can do with `expect`, you can also use +`require` to [poll matchers](#polling-expectations) using `toEventually`, +`eventuallyTo`, `toEventuallyNot`, `toNotEventually`, `toNever`, `neverTo`, +`toAlways`, and `alwaysTo`. These work exactly the same as they do when using +`expect`, except that they throw if they fail, and they return the value of the +expression when they pass. + +## Using `require` with Async expressions and Async matchers + +`require` also works with both async expressions +(`require { await someExpression() }.to(...)`), and async matchers +(`require().to(someAsyncMatcher())`). + +Note that to prevent compiler confusion, +you cannot use `require` with async autoclosures. That is, +`require(await someExpression())` will not compile. You can instead either +make the closure explicit (`require { await someExpression() }`), or use the +`requirea` function, which does accept autoclosures. +Similarly, if you ever wish to use the sync version of `require` when the +compiler is trying to force you to use the async version, you can use the +`requires` function, which only allows synchronous expressions. + +## Using `unwrap` to replace `require(...).toNot(beNil())` + +It's very common to require that a value not be nil. Instead of writing +`try require(...).toNot(beNil())`, Nimble provides the `unwrap` function. This +expression throws an error if the expression evaluates to nil, or returns the +non-nil result when it passes. For example: + +```swift +let value = try unwrap(nil as Int?) // throws +let value = try unwrap(1 as Int?) // returns 1 +``` + +Additionally, there is also the `pollUnwrap` function, which aliases to +`require(...).toEventuallyNot(beNil())`. This is extremely useful for verifying +that a value that is updated on a background thread was eventually set to a +non-nil value. + +Note: As with `require`, there are `unwraps`, `unwrapa`, `pollUnwraps`, and +`pollUnwrapa` variants for allowing you to use autoclosures specifically with +synchronous or asynchronous code. + +## Throwing a Custom Error from Require + +By default, if the matcher fails in a `require`, then a `RequireError` will be +thrown. You can override this behavior and throw a custom error by passing a +non-nil `Error` value to the `customError` parameter: + +```swift +try require(1).to(equal(2)) // throws a `RequireError` +try require(customError: MyCustomError(), 1).to(equal(2)) // throws a `MyCustomError` +``` + +# Built-in Matcher Functions + +Nimble includes a wide variety of matcher functions. + +## Type Checking + +Nimble supports checking the type membership of any kind of object, whether +Objective-C conformant or not: + +```swift +// Swift + +protocol SomeProtocol{} +class SomeClassConformingToProtocol: SomeProtocol{} +struct SomeStructConformingToProtocol: SomeProtocol{} + +// The following tests pass +expect(1).to(beAKindOf(Int.self)) +expect("turtle").to(beAKindOf(String.self)) + +let classObject = SomeClassConformingToProtocol() +expect(classObject).to(beAKindOf(SomeProtocol.self)) +expect(classObject).to(beAKindOf(SomeClassConformingToProtocol.self)) +expect(classObject).toNot(beAKindOf(SomeStructConformingToProtocol.self)) + +let structObject = SomeStructConformingToProtocol() +expect(structObject).to(beAKindOf(SomeProtocol.self)) +expect(structObject).to(beAKindOf(SomeStructConformingToProtocol.self)) +expect(structObject).toNot(beAKindOf(SomeClassConformingToProtocol.self)) +``` + +```objc +// Objective-C + +// The following tests pass +NSMutableArray *array = [NSMutableArray array]; +expect(array).to(beAKindOf([NSArray class])); +expect(@1).toNot(beAKindOf([NSNull class])); +``` + +Objects can be tested for their exact types using the `beAnInstanceOf` matcher: + +```swift +// Swift + +protocol SomeProtocol{} +class SomeClassConformingToProtocol: SomeProtocol{} +struct SomeStructConformingToProtocol: SomeProtocol{} + +// Unlike the 'beKindOf' matcher, the 'beAnInstanceOf' matcher only +// passes if the object is the EXACT type requested. The following +// tests pass -- note its behavior when working in an inheritance hierarchy. +expect(1).to(beAnInstanceOf(Int.self)) +expect("turtle").to(beAnInstanceOf(String.self)) + +let classObject = SomeClassConformingToProtocol() +expect(classObject).toNot(beAnInstanceOf(SomeProtocol.self)) +expect(classObject).to(beAnInstanceOf(SomeClassConformingToProtocol.self)) +expect(classObject).toNot(beAnInstanceOf(SomeStructConformingToProtocol.self)) + +let structObject = SomeStructConformingToProtocol() +expect(structObject).toNot(beAnInstanceOf(SomeProtocol.self)) +expect(structObject).to(beAnInstanceOf(SomeStructConformingToProtocol.self)) +expect(structObject).toNot(beAnInstanceOf(SomeClassConformingToProtocol.self)) +``` + +## Equivalence + +```swift +// Swift + +// Passes if 'actual' is equivalent to 'expected': +expect(actual).to(equal(expected)) +expect(actual) == expected + +// Passes if 'actual' is not equivalent to 'expected': +expect(actual).toNot(equal(expected)) +expect(actual) != expected +``` + +```objc +// Objective-C + +// Passes if 'actual' is equivalent to 'expected': +expect(actual).to(equal(expected)) + +// Passes if 'actual' is not equivalent to 'expected': +expect(actual).toNot(equal(expected)) +``` + +Values must be `Equatable`, `Comparable`, or subclasses of `NSObject`. +`equal` will always fail when used to compare one or more `nil` values. + +## Identity + +```swift +// Swift + +// Passes if 'actual' has the same pointer address as 'expected': +expect(actual).to(beIdenticalTo(expected)) +expect(actual) === expected + +// Passes if 'actual' does not have the same pointer address as 'expected': +expect(actual).toNot(beIdenticalTo(expected)) +expect(actual) !== expected +``` + +It is important to remember that `beIdenticalTo` only makes sense when comparing +types with reference semantics, which have a notion of identity. In Swift, +that means types that are defined as a `class`. + +This matcher will not work when comparing types with value semantics such as +those defined as a `struct` or `enum`. If you need to compare two value types, +consider what it means for instances of your type to be identical. This may mean +comparing individual properties or, if it makes sense to do so, conforming your type +to `Equatable` and using Nimble's equivalence matchers instead. + + +```objc +// Objective-C + +// Passes if 'actual' has the same pointer address as 'expected': +expect(actual).to(beIdenticalTo(expected)); + +// Passes if 'actual' does not have the same pointer address as 'expected': +expect(actual).toNot(beIdenticalTo(expected)); +``` + +## Comparisons + +```swift +// Swift + +expect(actual).to(beLessThan(expected)) +expect(actual) < expected + +expect(actual).to(beLessThanOrEqualTo(expected)) +expect(actual) <= expected + +expect(actual).to(beGreaterThan(expected)) +expect(actual) > expected + +expect(actual).to(beGreaterThanOrEqualTo(expected)) +expect(actual) >= expected +``` + +```objc +// Objective-C + +expect(actual).to(beLessThan(expected)); +expect(actual).to(beLessThanOrEqualTo(expected)); +expect(actual).to(beGreaterThan(expected)); +expect(actual).to(beGreaterThanOrEqualTo(expected)); +``` + +> Values given to the comparison matchers above must implement + `Comparable`. + +Because of how computers represent floating point numbers, assertions +that two floating point numbers be equal will sometimes fail. To express +that two numbers should be close to one another within a certain margin +of error, use `beCloseTo`: + +```swift +// Swift + +expect(actual).to(beCloseTo(expected, within: delta)) +``` + +```objc +// Objective-C + +expect(actual).to(beCloseTo(expected).within(delta)); +``` + +For example, to assert that `10.01` is close to `10`, you can write: + +```swift +// Swift + +expect(10.01).to(beCloseTo(10, within: 0.1)) +``` + +```objc +// Objective-C + +expect(@(10.01)).to(beCloseTo(@10).within(0.1)); +``` + +There is also an operator shortcut available in Swift: + +```swift +// Swift + +expect(actual) ≈ expected +expect(actual) ≈ (expected, delta) + +``` +(Type option+x to get `≈` on a U.S. keyboard) + +The former version uses the default delta of 0.0001. Here is yet another way to do this: + +```swift +// Swift + +expect(actual) ≈ expected ± delta +expect(actual) == expected ± delta + +``` +(Type option+shift+= to get `±` on a U.S. keyboard) + +If you are comparing arrays of floating point numbers, you'll find the following useful: + +```swift +// Swift + +expect([0.0, 2.0]) ≈ [0.0001, 2.0001] +expect([0.0, 2.0]).to(beCloseTo([0.1, 2.1], within: 0.1)) + +``` + +> Values given to the `beCloseTo` matcher must conform to `FloatingPoint`. + +## Types/Classes + +```swift +// Swift + +// Passes if 'instance' is an instance of 'aClass': +expect(instance).to(beAnInstanceOf(aClass)) + +// Passes if 'instance' is an instance of 'aClass' or any of its subclasses: +expect(instance).to(beAKindOf(aClass)) +``` + +```objc +// Objective-C + +// Passes if 'instance' is an instance of 'aClass': +expect(instance).to(beAnInstanceOf(aClass)); + +// Passes if 'instance' is an instance of 'aClass' or any of its subclasses: +expect(instance).to(beAKindOf(aClass)); +``` + +> Instances must be Objective-C objects: subclasses of `NSObject`, + or Swift objects bridged to Objective-C with the `@objc` prefix. + +For example, to assert that `dolphin` is a kind of `Mammal`: + +```swift +// Swift + +expect(dolphin).to(beAKindOf(Mammal)) +``` + +```objc +// Objective-C + +expect(dolphin).to(beAKindOf([Mammal class])); +``` + +> `beAnInstanceOf` uses the `-[NSObject isMemberOfClass:]` method to + test membership. `beAKindOf` uses `-[NSObject isKindOfClass:]`. + +## Truthiness + +```swift +// Passes if 'actual' is not nil, true, or an object with a boolean value of true: +expect(actual).to(beTruthy()) + +// Passes if 'actual' is only true (not nil or an object conforming to Boolean true): +expect(actual).to(beTrue()) + +// Passes if 'actual' is nil, false, or an object with a boolean value of false: +expect(actual).to(beFalsy()) + +// Passes if 'actual' is only false (not nil or an object conforming to Boolean false): +expect(actual).to(beFalse()) + +// Passes if 'actual' is nil: +expect(actual).to(beNil()) +``` + +```objc +// Objective-C + +// Passes if 'actual' is not nil, true, or an object with a boolean value of true: +expect(actual).to(beTruthy()); + +// Passes if 'actual' is only true (not nil or an object conforming to Boolean true): +expect(actual).to(beTrue()); + +// Passes if 'actual' is nil, false, or an object with a boolean value of false: +expect(actual).to(beFalsy()); + +// Passes if 'actual' is only false (not nil or an object conforming to Boolean false): +expect(actual).to(beFalse()); + +// Passes if 'actual' is nil: +expect(actual).to(beNil()); +``` + +## Swift Assertions + +If you're using Swift, you can use the `throwAssertion` matcher to check if an assertion is thrown (e.g. `fatalError()`). This is made possible by [@mattgallagher](https://github.com/mattgallagher)'s [CwlPreconditionTesting](https://github.com/mattgallagher/CwlPreconditionTesting) library. + +```swift +// Swift + +// Passes if 'somethingThatThrows()' throws an assertion, +// such as by calling 'fatalError()' or if a precondition fails: +expect { try somethingThatThrows() }.to(throwAssertion()) +expect { () -> Void in fatalError() }.to(throwAssertion()) +expect { precondition(false) }.to(throwAssertion()) + +// Passes if throwing an NSError is not equal to throwing an assertion: +expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion()) + +// Passes if the code after the precondition check is not run: +var reachedPoint1 = false +var reachedPoint2 = false +expect { + reachedPoint1 = true + precondition(false, "condition message") + reachedPoint2 = true +}.to(throwAssertion()) + +expect(reachedPoint1) == true +expect(reachedPoint2) == false +``` + +Notes: + +* This feature is only available in Swift. +* The tvOS simulator is supported, but using a different mechanism, requiring you to turn off the `Debug executable` scheme setting for your tvOS scheme's Test configuration. + +## Swift Error Handling + +You can use the `throwError` matcher to check if an error is thrown. + +```swift +// Swift + +// Passes if 'somethingThatThrows()' throws an 'Error': +expect { try somethingThatThrows() }.to(throwError()) + +// Passes if 'somethingThatThrows()' throws an error within a particular domain: +expect { try somethingThatThrows() }.to(throwError { (error: Error) in + expect(error._domain).to(equal(NSCocoaErrorDomain)) +}) + +// Passes if 'somethingThatThrows()' throws a particular error enum case: +expect { try somethingThatThrows() }.to(throwError(NSCocoaError.PropertyListReadCorruptError)) + +// Passes if 'somethingThatThrows()' throws an error of a particular type: +expect { try somethingThatThrows() }.to(throwError(errorType: NimbleError.self)) +``` + +When working directly with `Error` values, using the `matchError` matcher +allows you to perform certain checks on the error itself without having to +explicitly cast the error. + +The `matchError` matcher allows you to check whether or not the error: + +- is the same _type_ of error you are expecting. +- represents a particular error value that you are expecting. + +This can be useful when using `Result` or `Promise` types, for example. + +```swift +// Swift + +let actual: Error = ... + +// Passes if 'actual' represents any error value from the NimbleErrorEnum type: +expect(actual).to(matchError(NimbleErrorEnum.self)) + +// Passes if 'actual' represents the case 'timeout' from the NimbleErrorEnum type: +expect(actual).to(matchError(NimbleErrorEnum.timeout)) + +// Passes if 'actual' contains an NSError equal to the one provided: +expect(actual).to(matchError(NSError(domain: "err", code: 123, userInfo: nil))) +``` + +Note: This feature is only available in Swift. + +## Exceptions + +```swift +// Swift + +// Passes if 'actual', when evaluated, raises an exception: +expect(actual).to(raiseException()) + +// Passes if 'actual' raises an exception with the given name: +expect(actual).to(raiseException(named: name)) + +// Passes if 'actual' raises an exception with the given name and reason: +expect(actual).to(raiseException(named: name, reason: reason)) + +// Passes if 'actual' raises an exception which passes expectations defined in the given closure: +// (in this case, if the exception's name begins with "a r") +expect { exception.raise() }.to(raiseException { (exception: NSException) in + expect(exception.name).to(beginWith("a r")) +}) +``` + +```objc +// Objective-C + +// Passes if 'actual', when evaluated, raises an exception: +expect(actual).to(raiseException()) + +// Passes if 'actual' raises an exception with the given name +expect(actual).to(raiseException().named(name)) + +// Passes if 'actual' raises an exception with the given name and reason: +expect(actual).to(raiseException().named(name).reason(reason)) + +// Passes if 'actual' raises an exception and it passes expectations defined in the given block: +// (in this case, if name begins with "a r") +expect(actual).to(raiseException().satisfyingBlock(^(NSException *exception) { + expect(exception.name).to(beginWith(@"a r")); +})); +``` + +Note: Swift currently doesn't have exceptions (see [#220](https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)). +Only Objective-C code can raise exceptions that Nimble will catch. + +## Collection Membership + +```swift +// Swift + +// Passes if all of the expected values are members of 'actual': +expect(actual).to(contain(expected...)) + +// Passes if 'actual' is empty (i.e. it contains no elements): +expect(actual).to(beEmpty()) +``` + +```objc +// Objective-C + +// Passes if expected is a member of 'actual': +expect(actual).to(contain(expected)); + +// Passes if 'actual' is empty (i.e. it contains no elements): +expect(actual).to(beEmpty()); +``` + +> In Swift `contain` takes any number of arguments. The expectation + passes if all of them are members of the collection. In Objective-C, + `contain` only takes one argument [for now](https://github.com/Quick/Nimble/issues/27). + +For example, to assert that a list of sea creature names contains +"dolphin" and "starfish": + +```swift +// Swift + +expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish")) +``` + +```objc +// Objective-C + +expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin")); +expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish")); +``` + +> `contain` and `beEmpty` expect collections to be instances of + `NSArray`, `NSSet`, or a Swift collection composed of `Equatable` elements. + +To test whether a set of elements is present at the beginning or end of +an ordered collection, use `beginWith` and `endWith`: + +```swift +// Swift + +// Passes if the elements in expected appear at the beginning of 'actual': +expect(actual).to(beginWith(expected...)) + +// Passes if the the elements in expected come at the end of 'actual': +expect(actual).to(endWith(expected...)) +``` + +```objc +// Objective-C + +// Passes if the elements in expected appear at the beginning of 'actual': +expect(actual).to(beginWith(expected)); + +// Passes if the the elements in expected come at the end of 'actual': +expect(actual).to(endWith(expected)); +``` + +> `beginWith` and `endWith` expect collections to be instances of + `NSArray`, or ordered Swift collections composed of `Equatable` + elements. + + Like `contain`, in Objective-C `beginWith` and `endWith` only support + a single argument [for now](https://github.com/Quick/Nimble/issues/27). + +For code that returns collections of complex objects without a strict +ordering, there is the `containElementSatisfying` matcher: + +```swift +// Swift + +struct Turtle { + let color: String +} + +let turtles: [Turtle] = functionThatReturnsSomeTurtlesInAnyOrder() + +// This set of matchers passes regardless of whether the array is +// [{color: "blue"}, {color: "green"}] or [{color: "green"}, {color: "blue"}]: + +expect(turtles).to(containElementSatisfying({ turtle in + return turtle.color == "green" +})) +expect(turtles).to(containElementSatisfying({ turtle in + return turtle.color == "blue" +}, "that is a turtle with color 'blue'")) + +// The second matcher will incorporate the provided string in the error message +// should it fail +``` + +Note: in Swift, `containElementSatisfying` also has a variant that takes in an +async function. + +```objc +// Objective-C + +@interface Turtle : NSObject +@property (nonatomic, readonly, nonnull) NSString *color; +@end + +@implementation Turtle +@end + +NSArray * __nonnull turtles = functionThatReturnsSomeTurtlesInAnyOrder(); + +// This set of matchers passes regardless of whether the array is +// [{color: "blue"}, {color: "green"}] or [{color: "green"}, {color: "blue"}]: + +expect(turtles).to(containElementSatisfying(^BOOL(id __nonnull object) { + return [[turtle color] isEqualToString:@"green"]; +})); +expect(turtles).to(containElementSatisfying(^BOOL(id __nonnull object) { + return [[turtle color] isEqualToString:@"blue"]; +})); +``` + +For asserting on if the given `Comparable` value is inside of a `Range`, use the `beWithin` matcher. + +```swift +// Swift + +// Passes if 5 is within the range 1 through 10, inclusive +expect(5).to(beWithin(1...10)) + +// Passes if 5 is not within the range 2 through 4. +expect(5).toNot(beWithin(2..<5)) +``` + +## Strings + +```swift +// Swift + +// Passes if 'actual' contains 'substring': +expect(actual).to(contain(substring)) + +// Passes if 'actual' begins with 'prefix': +expect(actual).to(beginWith(prefix)) + +// Passes if 'actual' ends with 'suffix': +expect(actual).to(endWith(suffix)) + +// Passes if 'actual' represents the empty string, "": +expect(actual).to(beEmpty()) + +// Passes if 'actual' matches the regular expression defined in 'expected': +expect(actual).to(match(expected)) +``` + +```objc +// Objective-C + +// Passes if 'actual' contains 'substring': +expect(actual).to(contain(expected)); + +// Passes if 'actual' begins with 'prefix': +expect(actual).to(beginWith(prefix)); + +// Passes if 'actual' ends with 'suffix': +expect(actual).to(endWith(suffix)); + +// Passes if 'actual' represents the empty string, "": +expect(actual).to(beEmpty()); + +// Passes if 'actual' matches the regular expression defined in 'expected': +expect(actual).to(match(expected)) +``` + +## Collection Elements + +Nimble provides a means to check that all elements of a collection pass a given expectation. + +### Swift + +In Swift, the collection must be an instance of a type conforming to +`Sequence`. + +```swift +// Swift + +// Providing a custom function: +expect([1, 2, 3, 4]).to(allPass { $0 < 5 }) + +// Composing the expectation with another matcher: +expect([1, 2, 3, 4]).to(allPass(beLessThan(5))) +``` + +There are also variants of `allPass` that check against async matchers, and +that take in async functions: + +```swift +// Swift + +// Providing a custom function: +expect([1, 2, 3, 4]).to(allPass { await asyncFunctionReturningBool($0) }) + +// Composing the expectation with another matcher: +expect([1, 2, 3, 4]).to(allPass(someAsyncMatcher())) +``` + +### Objective-C + +In Objective-C, the collection must be an instance of a type which implements +the `NSFastEnumeration` protocol, and whose elements are instances of a type +which subclasses `NSObject`. + +Additionally, unlike in Swift, there is no override to specify a custom +matcher function. + +```objc +// Objective-C + +expect(@[@1, @2, @3, @4]).to(allPass(beLessThan(@5))); +``` + +## Collection Count + +```swift +// Swift + +// Passes if 'actual' contains the 'expected' number of elements: +expect(actual).to(haveCount(expected)) + +// Passes if 'actual' does _not_ contain the 'expected' number of elements: +expect(actual).notTo(haveCount(expected)) +``` + +```objc +// Objective-C + +// Passes if 'actual' contains the 'expected' number of elements: +expect(actual).to(haveCount(expected)) + +// Passes if 'actual' does _not_ contain the 'expected' number of elements: +expect(actual).notTo(haveCount(expected)) +``` + +For Swift, the actual value must be an instance of a type conforming to `Collection`. +For example, instances of `Array`, `Dictionary`, or `Set`. + +For Objective-C, the actual value must be one of the following classes, or their subclasses: + + - `NSArray`, + - `NSDictionary`, + - `NSSet`, or + - `NSHashTable`. + +## Notifications + +```swift +// Swift +let testNotification = Notification(name: Notification.Name("Foo"), object: nil) + +// Passes if the closure in expect { ... } posts a notification to the default +// notification center. +expect { + NotificationCenter.default.post(testNotification) +}.to(postNotifications(equal([testNotification]))) + +// Passes if the closure in expect { ... } posts a notification to a given +// notification center +let notificationCenter = NotificationCenter() +expect { + notificationCenter.post(testNotification) +}.to(postNotifications(equal([testNotification]), from: notificationCenter)) + +// Passes if the closure in expect { ... } posts a notification with the provided names to a given +// notification center. Make sure to use this when running tests on Catalina, +// using DistributedNotificationCenter as there is currently no way +// of observing notifications without providing specific names. +let distributedNotificationCenter = DistributedNotificationCenter() +expect { + distributedNotificationCenter.post(testNotification) +}.toEventually(postDistributedNotifications(equal([testNotification]), + from: distributedNotificationCenter, + names: [testNotification.name])) +``` + +> This matcher is only available in Swift. + +## Result + +```swift +// Swift +let aResult: Result = .success("Hooray") + +// passes if result is .success +expect(aResult).to(beSuccess()) + +// passes if result value is .success and validates Success value +expect(aResult).to(beSuccess { value in + expect(value).to(equal("Hooray")) +}) + + +enum AnError: Error { + case somethingHappened +} +let otherResult: Result = .failure(.somethingHappened) + +// passes if result is .failure +expect(otherResult).to(beFailure()) + +// passes if result value is .failure and validates error +expect(otherResult).to(beFailure { error in + expect(error).to(matchError(AnError.somethingHappened)) +}) +``` + +> This matcher is only available in Swift. + +## Matching a value to any of a group of matchers + +```swift +// Swift + +// passes if actual is either less than 10 or greater than 20 +expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20))) + +// can include any number of matchers -- the following will pass +// **be careful** -- too many matchers can be the sign of an unfocused test +expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7))) + +// in Swift you also have the option to use the || operator to achieve a similar function +expect(82).to(beLessThan(50) || beGreaterThan(80)) +``` + +Note: In swift, you can mix and match synchronous and asynchronous matchers +using by `satisfyAnyOf`/`||`. + +```objc +// Objective-C + +// passes if actual is either less than 10 or greater than 20 +expect(actual).to(satisfyAnyOf(beLessThan(@10), beGreaterThan(@20))) + +// can include any number of matchers -- the following will pass +// **be careful** -- too many matchers can be the sign of an unfocused test +expect(@6).to(satisfyAnyOf(equal(@2), equal(@3), equal(@4), equal(@5), equal(@6), equal(@7))) +``` + +Note: This matcher allows you to chain any number of matchers together. This provides flexibility, + but if you find yourself chaining many matchers together in one test, consider whether you + could instead refactor that single test into multiple, more precisely focused tests for + better coverage. + +## Custom Validation + +```swift +// Swift + +// passes if .succeeded is returned from the closure +expect { + guard case .enumCaseWithAssociatedValueThatIDontCareAbout = actual else { + return .failed(reason: "wrong enum case") + } + + return .succeeded +}.to(succeed()) + +// passes if .failed is returned from the closure +expect { + guard case .enumCaseWithAssociatedValueThatIDontCareAbout = actual else { + return .failed(reason: "wrong enum case") + } + + return .succeeded +}.notTo(succeed()) +``` + +The `String` provided with `.failed()` is shown when the test fails. + +When using `toEventually()` be careful not to make state changes or run process intensive code since this closure will be ran many times. + +## Mapping a Value to Another Value + +Sometimes, you only want to match against a property or group of properties. +For example, if you wanted to check that only one or a few properties of a value +are equal to something else. For this, use the `map` matcher to convert a value +to another value and check it with a matcher. + +```swift +// Swift + +expect(someValue).to(map(\.someProperty, equal(expectedProperty))) + +// or, for checking multiple different properties: + +expect(someValue).to(satisfyAllOf( + map(\.firstProperty, equal(expectedFirstProperty)), + map({ $0.secondProperty }, equal(expectedSecondProperty)) +)) +``` + +The `map` matcher takes in either a closure or a keypath literal, and a matcher +to compose with. It also works with async closures and async matchers. + +In most cases, it is simpler and easier to not use map (that is, prefer +`expect(someValue.property).to(equal(1))` to +`expect(someValue).to(map(\.property, equal(1)))`). But `map` is incredibly +useful when combined with `satisfyAllOf`/`satisfyAnyOf`, especially for checking +a value that cannot conform to `Equatable` (or you don't want to make it +conform to `Equatable`). However, if you find yourself reusing `map` many times +to do a fuzzy-equals of a given type, you will find writing a custom matcher to +be much easier to use and maintain. + +# Writing Your Own Matchers + +In Nimble, matchers are Swift functions that take an expected +value and return a `Matcher` closure. Take `equal`, for example: + +```swift +// Swift + +public func equal(expectedValue: T?) -> Matcher { + // Can be shortened to: + // Matcher { actual in ... } + // + // But shown with types here for clarity. + return Matcher { (actualExpression: Expression) throws -> MatcherResult in + let msg = ExpectationMessage.expectedActualValueTo("equal <\(expectedValue)>") + if let actualValue = try actualExpression.evaluate() { + return MatcherResult( + bool: actualValue == expectedValue!, + message: msg + ) + } else { + return MatcherResult( + status: .fail, + message: msg.appendedBeNilHint() + ) + } + } +} +``` + +The return value of a `Matcher` closure is a `MatcherResult` that indicates +whether the actual value matches the expectation and what error message to +display on failure. + +> The actual `equal` matcher function does not match when + `expected` are nil; the example above has been edited for brevity. + +Since matchers are just Swift functions, you can define them anywhere: +at the top of your test file, in a file shared by all of your tests, or +in an Xcode project you distribute to others. + +> If you write a matcher you think everyone can use, consider adding it + to Nimble's built-in set of matchers by sending a pull request! Or + distribute it yourself via GitHub. + +For examples of how to write your own matchers, just check out the +[`Matchers` directory](https://github.com/Quick/Nimble/tree/main/Sources/Nimble/Matchers) +to see how Nimble's built-in set of matchers are implemented. You can +also check out the tips below. + +## MatcherResult + +`MatcherResult` is the return struct that `Matcher` return to indicate +success and failure. A `MatcherResult` is made up of two values: +`MatcherStatus` and `ExpectationMessage`. + +Instead of a boolean, `MatcherStatus` captures a trinary set of values: + +```swift +// Swift + +public enum MatcherStatus { +// The matcher "passes" with the given expression +// eg - expect(1).to(equal(1)) +case matches + +// The matcher "fails" with the given expression +// eg - expect(1).toNot(equal(1)) +case doesNotMatch + +// The matcher never "passes" with the given expression, even if negated +// eg - expect(nil as Int?).toNot(equal(1)) +case fail + +// ... +} +``` + +Meanwhile, `ExpectationMessage` provides messaging semantics for error reporting. + +```swift +// Swift + +public indirect enum ExpectationMessage { +// Emits standard error message: +// eg - "expected to , got " +case expectedActualValueTo(/* message: */ String) + +// Allows any free-form message +// eg - "" +case fail(/* message: */ String) + +// ... +} +``` + +Matchers should usually depend on either `.expectedActualValueTo(..)` or +`.fail(..)` when reporting errors. Special cases can be used for the other enum +cases. + +Finally, if your Matcher utilizes other Matchers, you can utilize +`.appended(details:)` and `.appended(message:)` methods to annotate an existing +error with more details. + +A common message to append is failing on nils. For that, `.appendedBeNilHint()` +can be used. + +## Lazy Evaluation + +`actualExpression` is a lazy, memoized closure around the value provided to the +`expect` function. The expression can either be a closure or a value directly +passed to `expect(...)`. In order to determine whether that value matches, +custom matchers should call `actualExpression.evaluate()`: + +```swift +// Swift + +public func beNil() -> Matcher { + // Matcher.simpleNilable(..) automatically generates ExpectationMessage for + // us based on the string we provide to it. Also, the 'Nilable' postfix indicates + // that this Matcher supports matching against nil actualExpressions, instead of + // always resulting in a MatcherStatus.fail result -- which is true for + // Matcher.simple(..) + return Matcher.simpleNilable("be nil") { actualExpression in + let actualValue = try actualExpression.evaluate() + return MatcherStatus(bool: actualValue == nil) + } +} +``` + +In the above example, `actualExpression` is not `nil` -- it is a closure +that returns a value. The value it returns, which is accessed via the +`evaluate()` method, may be `nil`. If that value is `nil`, the `beNil` +matcher function returns `true`, indicating that the expectation passed. + +## Type Checking via Swift Generics + +Using Swift's generics, matchers can constrain the type of the actual value +passed to the `expect` function by modifying the return type. + +For example, the following matcher, `haveDescription`, only accepts actual +values that implement the `Printable` protocol. It checks their `description` +against the one provided to the matcher function, and passes if they are the same: + +```swift +// Swift + +public func haveDescription(description: String) -> Matcher { + return Matcher.simple("have description") { actual in + return MatcherStatus(bool: actual.evaluate().description == description) + } +} +``` + +## Customizing Failure Messages + +When using `Matcher.simple(..)` or `Matcher.simpleNilable(..)`, Nimble +outputs the following failure message when an expectation fails: + +```swift +// where `message` is the first string argument and +// `actual` is the actual value received in `expect(..)` +"expected to \(message), got <\(actual)>" +``` + +You can customize this message by modifying the way you create a `Matcher`. + +### Basic Customization + +For slightly more complex error messaging, receive the created failure message +with `Matcher.define(..)`: + +```swift +// Swift + +public func equal(_ expectedValue: T?) -> Matcher { + return Matcher.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in + let actualValue = try actualExpression.evaluate() + let matches = actualValue == expectedValue && expectedValue != nil + if expectedValue == nil || actualValue == nil { + if expectedValue == nil && actualValue != nil { + return MatcherResult( + status: .fail, + message: msg.appendedBeNilHint() + ) + } + return MatcherResult(status: .fail, message: msg) + } + return MatcherResult(bool: matches, message: msg) + } +} +``` + +In the example above, `msg` is defined based on the string given to +`Matcher.define`. The code looks akin to: + +```swift +// Swift + +let msg = ExpectationMessage.expectedActualValueTo("equal <\(stringify(expectedValue))>") +``` + +### Full Customization + +To fully customize the behavior of the Matcher, use the overload that expects +a `MatcherResult` to be returned. + +Along with `MatcherResult`, there are other `ExpectationMessage` enum values you can use: + +```swift +public indirect enum ExpectationMessage { +// Emits standard error message: +// eg - "expected to , got " +case expectedActualValueTo(/* message: */ String) + +// Allows any free-form message +// eg - "" +case fail(/* message: */ String) + +// Emits standard error message with a custom actual value instead of the default. +// eg - "expected to , got " +case expectedCustomValueTo(/* message: */ String, /* actual: */ String) + +// Emits standard error message without mentioning the actual value +// eg - "expected to " +case expectedTo(/* message: */ String) + +// ... +} +``` + +For matchers that compose other matchers, there are a handful of helper +functions to annotate messages. + +`appended(message: String)` is used to append to the original failure message: + +```swift +// produces "expected to be true, got (use beFalse() for inverse)" +// appended message do show up inline in Xcode. +.expectedActualValueTo("be true").appended(message: " (use beFalse() for inverse)") +``` + +For a more comprehensive message that spans multiple lines, use +`appended(details: String)` instead: + +```swift +// produces "expected to be true, got \n\nuse beFalse() for inverse\nor use beNil()" +// details do not show inline in Xcode, but do show up in test logs. +.expectedActualValueTo("be true").appended(details: "use beFalse() for inverse\nor use beNil()") +``` + +## Asynchronous Matchers + +To write matchers against async expressions, return an instance of +`AsyncMatcher`. The closure passed to `AsyncMatcher` is async, and the +expression you evaluate is also asynchronous and needs to be awaited on. + +```swift +// Swift + +actor CallRecorder { + private(set) var calls: [Arguments] = [] + + func record(call: Arguments) { + calls.append(call) + } +} + +func beCalled(with arguments: Argument) -> AsyncMatcher> { + AsyncMatcher { (expression: AsyncExpression>) in + let message = ExpectationMessage.expectedActualValueTo("be called with \(arguments)") + guard let calls = try await expression.evaluate()?.calls else { + return MatcherResult(status: .fail, message: message.appendedBeNilHint()) + } + + return MatcherResult(bool: calls.contains(args), message: message.appended(details: "called with \(calls)")) + } +} +``` + +In this example, we created an actor to act as an object to record calls to an +async function. Then, we created the `beCalled(with:)` matcher to check if the +actor has received a call with the given arguments. + +## Supporting Objective-C + +To use a custom matcher written in Swift from Objective-C, you'll have +to extend the `NMBMatcher` class, adding a new class method for your +custom matcher. The example below defines the class method +`+[NMBMatcher beNilMatcher]`: + +```swift +// Swift + +extension NMBMatcher { + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() + } + } +} +``` + +The above allows you to use the matcher from Objective-C: + +```objc +// Objective-C + +expect(actual).to([NMBMatcher beNilMatcher]()); +``` + +To make the syntax easier to use, define a C function that calls the +class method: + +```objc +// Objective-C + +FOUNDATION_EXPORT NMBMatcher *beNil() { + return [NMBMatcher beNilMatcher]; +} +``` + +### Properly Handling `nil` in Objective-C Matchers + +When supporting Objective-C, make sure you handle `nil` appropriately. +Like [Cedar](https://github.com/pivotal/cedar/issues/100), +**most matchers do not match with nil**. This is to bring prevent test +writers from being surprised by `nil` values where they did not expect +them. + +Nimble provides the `beNil` matcher function for test writer that want +to make expectations on `nil` objects: + +```objc +// Objective-C + +expect(nil).to(equal(nil)); // fails +expect(nil).to(beNil()); // passes +``` + +If your matcher does not want to match with nil, you use `Matcher.define` or `Matcher.simple`. +Using those factory methods will automatically generate expected value failure messages when they're nil. + +```swift +public func beginWith(_ startingElement: S.Element) -> Matcher where S.Element: Equatable { + return Matcher.simple("begin with <\(startingElement)>") { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { return .fail } + + var actualGenerator = actualValue.makeIterator() + return MatcherStatus(bool: actualGenerator.next() == startingElement) + } +} + +extension NMBMatcher { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBMatcher { actualExpression in + let actual = try actualExpression.evaluate() + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return try beginWith(expected).satisfies(expr).toObjectiveC() + } + } +} +``` + +# Installing Nimble + +> Nimble can be used on its own, or in conjunction with its sister + project, [Quick](https://github.com/Quick/Quick). To install both + Quick and Nimble, follow [the installation instructions in the Quick + Documentation](https://github.com/Quick/Quick/blob/main/Documentation/en-us/InstallingQuick.md). + +Nimble can currently be installed in one of two ways: using CocoaPods, or with +git submodules. + +## Installing Nimble as a Submodule + +To use Nimble as a submodule to test your macOS, iOS or tvOS applications, follow +these 4 easy steps: + +1. Clone the Nimble repository +2. Add Nimble.xcodeproj to the Xcode workspace for your project +3. Link Nimble.framework to your test target +4. Start writing expectations! + +For more detailed instructions on each of these steps, +read [How to Install Quick](https://github.com/Quick/Quick#how-to-install-quick). +Ignore the steps involving adding Quick to your project in order to +install just Nimble. + +## Installing Nimble via CocoaPods + +To use Nimble in CocoaPods to test your macOS, iOS, tvOS or watchOS applications, add +Nimble to your podfile and add the ```use_frameworks!``` line to enable Swift +support for CocoaPods. + +```ruby +platform :ios, '8.0' + +source 'https://github.com/CocoaPods/Specs.git' + +# Whatever pods you need for your app go here + +target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do + use_frameworks! + pod 'Nimble' +end +``` + +Finally run `pod install`. + +## Installing Nimble via Swift Package Manager + +### Xcode + +To install Nimble via Xcode's Swift Package Manager Integration: +Select your project configuration, then the project tab, then the Package +Dependencies tab. Click on the "plus" button at the bottom of the list, +then follow the wizard to add Quick to your project. Specify +`https://github.com/Quick/Nimble.git` as the url, and be sure to add +Nimble as a dependency of your unit test target, not your app target. + +### Package.Swift + +To use Nimble with Swift Package Manager to test your applications, add Nimble +to your `Package.Swift` and link it with your test target: + +```swift +// swift-tools-version:5.5 + +import PackageDescription + +let package = Package( + name: "MyAwesomeLibrary", + products: [ + // ... + ], + dependencies: [ + // ... + .package(url: "https://github.com/Quick/Nimble.git", from: "12.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "MyAwesomeLibrary", + dependencies: ...), + .testTarget( + name: "MyAwesomeLibraryTests", + dependencies: ["MyAwesomeLibrary", "Nimble"]), + ] +) +``` + +Please note that if you install Nimble using Swift Package Manager, then `raiseException` is not available. + +## Using Nimble without XCTest + +Nimble is integrated with XCTest to allow it work well when used in Xcode test +bundles, however it can also be used in a standalone app. After installing +Nimble using one of the above methods, there are two additional steps required +to make this work. + +1. Create a custom assertion handler and assign an instance of it to the + global `NimbleAssertionHandler` variable. For example: + +```swift +class MyAssertionHandler : AssertionHandler { + func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + if (!assertion) { + print("Expectation failed: \(message.stringValue)") + } + } +} +``` +```swift +// Somewhere before you use any assertions +NimbleAssertionHandler = MyAssertionHandler() +``` + +2. Add a post-build action to fix an issue with the Swift XCTest support + library being unnecessarily copied into your app + * Edit your scheme in Xcode, and navigate to Build -> Post-actions + * Click the "+" icon and select "New Run Script Action" + * Open the "Provide build settings from" dropdown and select your target + * Enter the following script contents: +``` +rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib" +``` + +You can now use Nimble assertions in your code and handle failures as you see +fit. + +## Privacy Statement + +Nimble is a library that is only used for testing and should never be included +in the binary submitted to App Store Connect. + +Despite not being shipped to Apple, Nimble does not and will never collect any +kind of analytics or tracking. diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift new file mode 100644 index 0000000..a28bf2b --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -0,0 +1,16 @@ +/// Protocol for the assertion handler that Nimble uses for all expectations. +public protocol AssertionHandler { + func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) +} + +/// Global backing interface for assertions that Nimble creates. +/// Defaults to a private test handler that passes through to XCTest. +/// +/// If XCTest is not available, you must assign your own assertion handler +/// before using any matchers, otherwise Nimble will abort the program. +/// +/// @see AssertionHandler +public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + // swiftlint:disable:previous identifier_name + return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() +}() diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift new file mode 100644 index 0000000..94a9030 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift @@ -0,0 +1,19 @@ +/// AssertionDispatcher allows multiple AssertionHandlers to receive +/// assertion messages. +/// +/// @warning Does not fully dispatch if one of the handlers raises an exception. +/// This is possible with XCTest-based assertion handlers. +/// +public class AssertionDispatcher: AssertionHandler { + let handlers: [AssertionHandler] + + public init(handlers: [AssertionHandler]) { + self.handlers = handlers + } + + public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { + for handler in handlers { + handler.assert(assertion, message: message, location: location) + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder+Async.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder+Async.swift new file mode 100644 index 0000000..8633444 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder+Async.swift @@ -0,0 +1,79 @@ +/// Allows you to temporarily replace the current Nimble assertion handler with +/// the one provided for the scope of the closure. +/// +/// Once the closure finishes, then the original Nimble assertion handler is restored. +/// +/// @warning +/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions. +/// +/// @see AssertionHandler +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () async throws -> Void) async { + let environment = NimbleEnvironment.activeInstance + let oldRecorder = environment.assertionHandler + _ = NMBExceptionCapture(handler: nil, finally: ({ + environment.assertionHandler = oldRecorder + })) + environment.assertionHandler = tempAssertionHandler + + do { + try await closure() + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) + } +} + +/// Captures expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about expectations +/// that occur within a closure. +/// +/// @warning +/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherFailingExpectations +public func gatherExpectations(silently: Bool = false, closure: () async -> Void) async -> [AssertionRecord] { + let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler + let recorder = AssertionRecorder() + let handlers: [AssertionHandler] + + if silently { + handlers = [recorder] + } else { + handlers = [recorder, previousRecorder] + } + + let dispatcher = AssertionDispatcher(handlers: handlers) + await withAssertionHandler(dispatcher, closure: closure) + return recorder.assertions +} + +/// Captures failed expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about failed +/// expectations that occur within a closure. +/// +/// @warning +/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherExpectations +/// @see raiseException source for an example use case. +public func gatherFailingExpectations(silently: Bool = false, closure: () async -> Void) async -> [AssertionRecord] { + let assertions = await gatherExpectations(silently: silently, closure: closure) + return assertions.filter { assertion in + !assertion.success + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift new file mode 100644 index 0000000..239393e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -0,0 +1,140 @@ +/// A data structure that stores information about an assertion when +/// AssertionRecorder is set as the Nimble assertion handler. +/// +/// @see AssertionRecorder +/// @see AssertionHandler +public struct AssertionRecord: CustomStringConvertible { + /// Whether the assertion succeeded or failed + public let success: Bool + /// The failure message the assertion would display on failure. + public let message: FailureMessage + /// The source location the expectation occurred on. + public let location: SourceLocation + + public var description: String { + return "AssertionRecord { success=\(success), message='\(message.stringValue)', location=\(location) }" + } +} + +/// An AssertionHandler that silently records assertions that Nimble makes. +/// This is useful for testing failure messages for matchers. +/// +/// @see AssertionHandler +public class AssertionRecorder: AssertionHandler { + /// All the assertions that were captured by this recorder + public var assertions = [AssertionRecord]() + + public init() {} + + public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { + assertions.append( + AssertionRecord( + success: assertion, + message: message, + location: location)) + } +} + +extension NMBExceptionCapture { + internal func tryBlockThrows(_ unsafeBlock: () throws -> Void) throws { + var catchedError: Error? + tryBlock { + do { + try unsafeBlock() + } catch { + catchedError = error + } + } + if let error = catchedError { + throw error + } + } +} + +/// Allows you to temporarily replace the current Nimble assertion handler with +/// the one provided for the scope of the closure. +/// +/// @warning +/// This form of `withAssertionHandler` does not work in any kind of +/// async context. Use the async form of `withAssertionHandler` +/// if you are running tests in an async context. +/// +/// Once the closure finishes, then the original Nimble assertion handler is restored. +/// +/// @see AssertionHandler +public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, + file: FileString = #file, + line: UInt = #line, + closure: () throws -> Void) { + let environment = NimbleEnvironment.activeInstance + let oldRecorder = environment.assertionHandler + let capturer = NMBExceptionCapture(handler: nil, finally: ({ + environment.assertionHandler = oldRecorder + })) + environment.assertionHandler = tempAssertionHandler + + do { + try capturer.tryBlockThrows { + try closure() + } + } catch { + let failureMessage = FailureMessage() + failureMessage.stringValue = "unexpected error thrown: <\(error)>" + let location = SourceLocation(file: file, line: line) + tempAssertionHandler.assert(false, message: failureMessage, location: location) + } +} + +/// Captures expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about expectations +/// that occur within a closure. +/// +/// @warning +/// This form of `gatherExpectations` does not work in any kind of +/// async context. Use the async form of `gatherExpectations` +/// if you are running tests in an async context. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherFailingExpectations +public func gatherExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { + let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler + let recorder = AssertionRecorder() + let handlers: [AssertionHandler] + + if silently { + handlers = [recorder] + } else { + handlers = [recorder, previousRecorder] + } + + let dispatcher = AssertionDispatcher(handlers: handlers) + withAssertionHandler(dispatcher, closure: closure) + return recorder.assertions +} + +/// Captures failed expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about failed +/// expectations that occur within a closure. +/// +/// @warning +/// This form of `gatherFailingExpectations` does not work in any kind of +/// async context. Use the async form of `gatherFailingExpectations` +/// if you are running tests in an async context. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherExpectations +/// @see raiseException source for an example use case. +public func gatherFailingExpectations(silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { + let assertions = gatherExpectations(silently: silently, closure: closure) + return assertions.filter { assertion in + !assertion.success + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift new file mode 100644 index 0000000..44ced65 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift @@ -0,0 +1,183 @@ +#if !os(WASI) + +#if canImport(Darwin) +import class Foundation.NSObject +import typealias Foundation.TimeInterval + +private func from(objcMatcher: NMBMatcher) -> Matcher { + return Matcher { actualExpression in + let result = objcMatcher.satisfies(({ try actualExpression.evaluate() }), + location: actualExpression.location) + return result.toSwift() + } +} + +// Equivalent to Expectation, but for Nimble's Objective-C interface +public class NMBExpectation: NSObject { + internal let _actualBlock: () -> NSObject? + internal var _negative: Bool + internal let _file: FileString + internal let _line: UInt + internal var _timeout: NimbleTimeInterval = .seconds(1) + + @objc public init(actualBlock: @escaping () -> NSObject?, negative: Bool, file: FileString, line: UInt) { + self._actualBlock = actualBlock + self._negative = negative + self._file = file + self._line = line + } + + private var expectValue: SyncExpectation { + return expect(file: _file, line: _line, self._actualBlock() as NSObject?) + } + + @objc public var withTimeout: (TimeInterval) -> NMBExpectation { + return { timeout in self._timeout = timeout.nimbleInterval + return self + } + } + + @objc public var to: (NMBMatcher) -> NMBExpectation { + return { matcher in + self.expectValue.to(from(objcMatcher: matcher)) + return self + } + } + + @objc public var toWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in + self.expectValue.to(from(objcMatcher: matcher), description: description) + return self + } + } + + @objc public var toNot: (NMBMatcher) -> NMBExpectation { + return { matcher in + self.expectValue.toNot(from(objcMatcher: matcher)) + return self + } + } + + @objc public var toNotWithDescription: (NMBMatcher, String) -> NMBExpectation { + return { matcher, description in + self.expectValue.toNot(from(objcMatcher: matcher), description: description) + return self + } + } + + @objc public var notTo: (NMBMatcher) -> NMBExpectation { return toNot } + + @objc public var notToWithDescription: (NMBMatcher, String) -> NMBExpectation { return toNotWithDescription } + + @objc public var toEventually: (NMBMatcher) -> Void { + return { matcher in + self.expectValue.toEventually( + from(objcMatcher: matcher), + timeout: self._timeout, + description: nil + ) + } + } + + @objc public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { + return { matcher, description in + self.expectValue.toEventually( + from(objcMatcher: matcher), + timeout: self._timeout, + description: description + ) + } + } + + @objc public var toEventuallyNot: (NMBMatcher) -> Void { + return { matcher in + self.expectValue.toEventuallyNot( + from(objcMatcher: matcher), + timeout: self._timeout, + description: nil + ) + } + } + + @objc public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { + return { matcher, description in + self.expectValue.toEventuallyNot( + from(objcMatcher: matcher), + timeout: self._timeout, + description: description + ) + } + } + + @objc public var toNotEventually: (NMBMatcher) -> Void { + return toEventuallyNot + } + + @objc public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void { + return toEventuallyNotWithDescription + } + + @objc public var toNever: (NMBMatcher) -> Void { + return { matcher in + self.expectValue.toNever( + from(objcMatcher: matcher), + until: self._timeout, + description: nil + ) + } + } + + @objc public var toNeverWithDescription: (NMBMatcher, String) -> Void { + return { matcher, description in + self.expectValue.toNever( + from(objcMatcher: matcher), + until: self._timeout, + description: description + ) + } + } + + @objc public var neverTo: (NMBMatcher) -> Void { + return toNever + } + + @objc public var neverToWithDescription: (NMBMatcher, String) -> Void { + return toNeverWithDescription + } + + @objc public var toAlways: (NMBMatcher) -> Void { + return { matcher in + self.expectValue.toAlways( + from(objcMatcher: matcher), + until: self._timeout, + description: nil + ) + } + } + + @objc public var toAlwaysWithDescription: (NMBMatcher, String) -> Void { + return { matcher, description in + self.expectValue.toAlways( + from(objcMatcher: matcher), + until: self._timeout, + description: description + ) + } + } + + @objc public var alwaysTo: (NMBMatcher) -> Void { + return toAlways + } + + @objc public var alwaysToWithDescription: (NMBMatcher, String) -> Void { + return toAlwaysWithDescription + } + + @objc public class func failWithMessage(_ message: String, file: FileString, line: UInt) { + fail(message, location: SourceLocation(file: file, line: line)) + } +} + +#endif + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift new file mode 100644 index 0000000..aa515f2 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -0,0 +1,55 @@ +#if !os(WASI) +import Dispatch +import class Foundation.Thread +#endif +import class Foundation.NSObject + +/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this +/// class' existence +internal class NimbleEnvironment: NSObject { + #if os(WASI) + static var activeInstance: NimbleEnvironment = NimbleEnvironment() + #else + static var activeInstance: NimbleEnvironment { + get { + let env = Thread.current.threadDictionary["NimbleEnvironment"] + if let env = env as? NimbleEnvironment { + return env + } else { + let newEnv = NimbleEnvironment() + self.activeInstance = newEnv + return newEnv + } + } + set { + Thread.current.threadDictionary["NimbleEnvironment"] = newValue + } + } + #endif + + // swiftlint:disable:next todo + // TODO: eventually migrate the global to this environment value + var assertionHandler: AssertionHandler { + get { return NimbleAssertionHandler } + set { NimbleAssertionHandler = newValue } + } + + var suppressTVOSAssertionWarning: Bool = false + var suppressWatchOSAssertionWarning: Bool = false + #if !os(WASI) + var awaiter: Awaiter + #endif + + override init() { + #if !os(WASI) + let timeoutQueue = DispatchQueue.global(qos: .userInitiated) + awaiter = Awaiter( + waitLock: AssertionWaitLock(), + asyncQueue: .main, + timeoutQueue: timeoutQueue + ) + #endif + + super.init() + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift new file mode 100644 index 0000000..286ae7e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -0,0 +1,94 @@ +import Foundation +import XCTest + +/// Default handler for Nimble. This assertion handler passes failures along to +/// XCTest. +public class NimbleXCTestHandler: AssertionHandler { + public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { + if !assertion { + recordFailure("\(message.stringValue)\n", location: location) + } + } +} + +/// Alternative handler for Nimble. This assertion handler passes failures along +/// to XCTest by attempting to reduce the failure message size. +public class NimbleShortXCTestHandler: AssertionHandler { + public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { + if !assertion { + let msg: String + if let actual = message.actualValue { + msg = "got: \(actual) \(message.postfixActual)" + } else { + msg = "expected \(message.to) \(message.postfixMessage)" + } + recordFailure("\(msg)\n", location: location) + } + } +} + +/// Fallback handler in case XCTest is unavailable. This assertion handler will abort +/// the program if it is invoked. +class NimbleXCTestUnavailableHandler: AssertionHandler { + func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { + fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.") + } +} + +#if canImport(Darwin) +/// Helper class providing access to the currently executing XCTestCase instance, if any +@objc final public class CurrentTestCaseTracker: NSObject, XCTestObservation { + @objc public static let sharedInstance = CurrentTestCaseTracker() + + private(set) var currentTestCase: XCTestCase? + + private var stashed_swift_reportFatalErrorsToDebugger: Bool = false + + @objc public func testCaseWillStart(_ testCase: XCTestCase) { + #if (os(macOS) || os(iOS) || os(visionOS)) && !SWIFT_PACKAGE + stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger + _swift_reportFatalErrorsToDebugger = false + #endif + + currentTestCase = testCase + } + + @objc public func testCaseDidFinish(_ testCase: XCTestCase) { + currentTestCase = nil + + #if (os(macOS) || os(iOS) || os(visionOS)) && !SWIFT_PACKAGE + _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger + #endif + } +} +#endif + +func isXCTestAvailable() -> Bool { +#if canImport(Darwin) + // XCTest is weakly linked and so may not be present + return NSClassFromString("XCTestCase") != nil +#else + return true +#endif +} + +public func recordFailure(_ message: String, location: SourceLocation) { +#if !canImport(Darwin) + XCTFail("\(message)", file: location.file, line: location.line) +#else + if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { + let line = Int(location.line) + let location = XCTSourceCodeLocation(filePath: location.file, lineNumber: line) + let sourceCodeContext = XCTSourceCodeContext(location: location) + let issue = XCTIssue(type: .assertionFailure, compactDescription: message, sourceCodeContext: sourceCodeContext) + testCase.record(issue) + } else { + let msg = """ + Attempted to report a test failure to XCTest while no test case was running. The failure was: + \"\(message)\" + It occurred at: \(location.file):\(location.line) + """ + NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() + } +#endif +} diff --git a/Pods/Nimble/Sources/Nimble/AsyncExpression.swift b/Pods/Nimble/Sources/Nimble/AsyncExpression.swift new file mode 100644 index 0000000..b669d5a --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/AsyncExpression.swift @@ -0,0 +1,130 @@ +// Memoizes the given closure, only calling the passed +// closure once; even if repeat calls to the returned closure +private func memoizedClosure(_ closure: @escaping () async throws -> T) -> (Bool) async throws -> T { + var cache: T? + return { withoutCaching in + if withoutCaching || cache == nil { + cache = try await closure() + } + return cache! + } +} + +/// Expression represents the closure of the value inside expect(...). +/// Expressions are memoized by default. This makes them safe to call +/// evaluate() multiple times without causing a re-evaluation of the underlying +/// closure. +/// +/// - Warning: Since the closure can be any code, Objective-C code may choose +/// to raise an exception. Currently, SyncExpression does not memoize +/// exception raising. +/// +/// This provides a common consumable API for matchers to utilize to allow +/// Nimble to change internals to how the captured closure is managed. +public struct AsyncExpression { + internal let _expression: (Bool) async throws -> Value? + internal let _withoutCaching: Bool + public let location: SourceLocation + public let isClosure: Bool + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. The expression is memoized. + /// + /// - Parameter expression: The closure that produces a given value. + /// - Parameter location: The source location that this closure originates from. + /// - Parameter isClosure: A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(expression: @escaping () async throws -> Value?, location: SourceLocation, isClosure: Bool = true) { + self._expression = memoizedClosure(expression) + self.location = location + self._withoutCaching = false + self.isClosure = isClosure + } + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. + /// + /// - Parameter expression: The closure that produces a given value. + /// - Parameter location: The source location that this closure originates from. + /// - Parameter withoutCaching: Indicates if the struct should memoize the given + /// closure's result. Subsequent evaluate() calls will + /// not call the given closure if this is true. + /// - Parameter isClosure: A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(memoizedExpression: @escaping (Bool) async throws -> Value?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) { + self._expression = memoizedExpression + self.location = location + self._withoutCaching = withoutCaching + self.isClosure = isClosure + } + + /// Creates a new synchronous expression, for use in Matchers. + public func toSynchronousExpression() async -> Expression { + let value: Result + do { + value = .success(try await _expression(self._withoutCaching)) + } catch { + value = .failure(error) + } + return Expression( + memoizedExpression: { _ in try value.get() }, + location: location, + withoutCaching: false, + isClosure: isClosure + ) + } + + /// Returns a new Expression from the given expression. Identical to a map() + /// on this type. This should be used only to typecast the Expression's + /// closure value. + /// + /// The returned expression will preserve location and isClosure. + /// + /// - Parameter block: The block that can cast the current Expression value to a + /// new type. + public func cast(_ block: @escaping (Value?) throws -> U?) -> AsyncExpression { + AsyncExpression( + expression: ({ try await block(self.evaluate()) }), + location: self.location, + isClosure: self.isClosure + ) + } + + public func cast(_ block: @escaping (Value?) async throws -> U?) -> AsyncExpression { + AsyncExpression( + expression: ({ try await block(self.evaluate()) }), + location: self.location, + isClosure: self.isClosure + ) + } + + public func evaluate() async throws -> Value? { + try await self._expression(_withoutCaching) + } + + public func withoutCaching() -> AsyncExpression { + AsyncExpression( + memoizedExpression: self._expression, + location: location, + withoutCaching: true, + isClosure: isClosure + ) + } + + public func withCaching() -> AsyncExpression { + AsyncExpression( + memoizedExpression: memoizedClosure { try await self.evaluate() }, + location: self.location, + withoutCaching: false, + isClosure: isClosure + ) + } +} diff --git a/Pods/Nimble/Sources/Nimble/DSL+AsyncAwait.swift b/Pods/Nimble/Sources/Nimble/DSL+AsyncAwait.swift new file mode 100644 index 0000000..3c4c1de --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL+AsyncAwait.swift @@ -0,0 +1,149 @@ +#if !os(WASI) +import Dispatch +#endif + +/// Make an ``AsyncExpectation`` on a given actual value. The value given is lazily evaluated. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @escaping () async throws -> T?) -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: () -> (() async throws -> T)) -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: () -> (() async throws -> T?)) -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: () -> (() async throws -> Void)) -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The value given is lazily evaluated. +/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation`. +public func expecta(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () async throws -> T?) async -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation` +public func expecta(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() async throws -> T)) async -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation` +public func expecta(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() async throws -> T?)) async -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation` +public func expecta(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() async throws -> Void)) async -> AsyncExpectation { + return AsyncExpectation( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +#if !os(WASI) + +/// Wait asynchronously until the done closure is called or the timeout has been reached. +/// +/// @discussion +/// Call the done() closure to indicate the waiting has completed. +/// +/// @warning +/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions. +public func waitUntil(timeout: NimbleTimeInterval = PollingDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) async -> Void) async { + await throwableUntil(timeout: timeout) { done in + await action(done) + } +} + +/// Wait asynchronously until the done closure is called or the timeout has been reached. +/// +/// @discussion +/// Call the done() closure to indicate the waiting has completed. +/// +/// @warning +/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions. +public func waitUntil(timeout: NimbleTimeInterval = PollingDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) async { + await throwableUntil(timeout: timeout, file: file, line: line) { done in + action(done) + } +} + +private enum ErrorResult { + case error(Error) + case none +} + +private func throwableUntil( + timeout: NimbleTimeInterval, + file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) async throws -> Void) async { + let leeway = timeout.divided + let result = await performBlock( + timeoutInterval: timeout, + leeway: leeway, + file: file, line: line) { @MainActor (done: @escaping (ErrorResult) -> Void) async throws -> Void in + do { + try await action { + done(.none) + } + } catch let e { + done(.error(e)) + } + } + + switch result { + case .incomplete: internalError("Reached .incomplete state for waitUntil(...).") + case .blockedRunLoop: + fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), + file: file, line: line) + case .timedOut: + fail("Waited more than \(timeout.description)", file: file, line: line) + case let .errorThrown(error): + fail("Unexpected error thrown: \(error)") + case .completed(.error(let error)): + fail("Unexpected error thrown: \(error)") + case .completed(.none): // success + break + } +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/DSL+Require.swift b/Pods/Nimble/Sources/Nimble/DSL+Require.swift new file mode 100644 index 0000000..d21c39f --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL+Require.swift @@ -0,0 +1,291 @@ +/// Make a ``SyncRequirement`` on a given actual value. The value given is lazily evaluated. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () throws -> T?) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T?)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> Void)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The value given is lazily evaluated. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided as an alternative to ``require``, for when you want to be specific about whether you're using ``SyncRequirement`` or ``AsyncRequirement``. +@discardableResult +public func requires(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () throws -> T?) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided as an alternative to ``require``, for when you want to be specific about whether you're using ``SyncRequirement`` or ``AsyncRequirement``. +@discardableResult +public func requires(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided as an alternative to ``require``, for when you want to be specific about whether you're using ``SyncRequirement`` or ``AsyncRequirement``. +@discardableResult +public func requires(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T?)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make a ``SyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided as an alternative to ``require``, for when you want to be specific about whether you're using ``SyncRequirement`` or ``AsyncRequirement``. +@discardableResult +public func requires(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> Void)) -> SyncRequirement { + return SyncRequirement( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The value given is lazily evaluated. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @escaping () async throws -> T?) -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: () -> (() async throws -> T)) -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func require(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: () -> (() async throws -> T?)) -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The value given is lazily evaluated. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided to avoid confusion between `require -> SyncRequirement` and `require -> AsyncRequirement`. +@discardableResult +public func requirea(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () async throws -> T?) async -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided to avoid confusion between `require -> SyncRequirement` and `require -> AsyncRequirement` +@discardableResult +public func requirea(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() async throws -> T)) async -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +/// Make an ``AsyncRequirement`` on a given actual value. The closure is lazily invoked. +/// +/// `require` will return the result of the expression if the matcher passes, and throw an error if not. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +/// +/// This is provided to avoid confusion between `require -> SyncRequirement` and `require -> AsyncRequirement` +@discardableResult +public func requirea(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() async throws -> T?)) async -> AsyncRequirement { + return AsyncRequirement( + expression: AsyncExpression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true), + customError: customError) +} + +// MARK: - Unwrap + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toNot(beNil())`. +/// +/// `unwrap` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrap(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () throws -> T?) throws -> T { + try requires(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toNot(beNil())`. +/// +/// `unwrap` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrap(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T?)) throws -> T { + try requires(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toNot(beNil())`. +/// +/// `unwraps` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwraps(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () throws -> T?) throws -> T { + try requires(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toNot(beNil())`. +/// +/// `unwraps` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwraps(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() throws -> T?)) throws -> T { + try requires(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toNot(beNil())`. +/// +/// `unwrap` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrap(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @escaping () async throws -> T?) async throws -> T { + try await requirea(file: file, line: line, customError: customError, try await expression()).toNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toNot(beNil())`. +/// +/// `unwrap` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrap(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: () -> (() async throws -> T?)) async throws -> T { + try await requirea(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toNot(beNil())`. +/// +/// `unwrapa` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrapa(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure @escaping () async throws -> T?) async throws -> T { + try await requirea(file: file, line: line, customError: customError, try await expression()).toNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toNot(beNil())`. +/// +/// `unwrapa` will return the result of the expression if it is non-nil, and throw an error if the value is nil. +/// if a `customError` is given, then that will be thrown. Otherwise, a ``RequireError`` will be thrown. +@discardableResult +public func unwrapa(file: FileString = #file, line: UInt = #line, customError: Error? = nil, _ expression: @autoclosure () -> (() async throws -> T?)) async throws -> T { + try await requirea(file: file, line: line, customError: customError, expression()).toNot(beNil()) +} diff --git a/Pods/Nimble/Sources/Nimble/DSL+Wait.swift b/Pods/Nimble/Sources/Nimble/DSL+Wait.swift new file mode 100644 index 0000000..7fc5089 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL+Wait.swift @@ -0,0 +1,123 @@ +#if !os(WASI) + +import Dispatch +import Foundation + +private enum ErrorResult { + case exception(NSException) + case error(Error) + case none +} + +/// Only classes, protocols, methods, properties, and subscript declarations can be +/// bridges to Objective-C via the @objc keyword. This class encapsulates callback-style +/// asynchronous waiting logic so that it may be called from Objective-C and Swift. +public class NMBWait: NSObject { +// About these kind of lines, `@objc` attributes are only required for Objective-C +// support, so that should be conditional on Darwin platforms. +#if canImport(Darwin) + @objc + public class func until( + timeout: TimeInterval, + file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { + // Convert TimeInterval to NimbleTimeInterval + until(timeout: timeout.nimbleInterval, file: file, line: line, action: action) + } +#endif + + public class func until( + timeout: NimbleTimeInterval, + file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { + return throwableUntil(timeout: timeout, file: file, line: line) { done in + action(done) + } + } + + // Using a throwable closure makes this method not objc compatible. + public class func throwableUntil( + timeout: NimbleTimeInterval, + file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) throws -> Void) { + let awaiter = NimbleEnvironment.activeInstance.awaiter + let leeway = timeout.divided + let result = awaiter.performBlock(file: file, line: line) { (done: @escaping (ErrorResult) -> Void) throws -> Void in + DispatchQueue.main.async { + let capture = NMBExceptionCapture( + handler: ({ exception in + done(.exception(exception)) + }), + finally: ({ }) + ) + capture.tryBlock { + do { + try action { + done(.none) + } + } catch let e { + done(.error(e)) + } + } + } + }.timeout(timeout, forcefullyAbortTimeout: leeway).wait("waitUntil(...)", file: file, line: line) + + switch result { + case .incomplete: internalError("Reached .incomplete state for waitUntil(...).") + case .blockedRunLoop: + fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), + file: file, line: line) + case .timedOut: + fail("Waited more than \(timeout.description)", file: file, line: line) + case let .raisedException(exception): + fail("Unexpected exception raised: \(exception)") + case let .errorThrown(error): + fail("Unexpected error thrown: \(error)") + case .completed(.exception(let exception)): + fail("Unexpected exception raised: \(exception)") + case .completed(.error(let error)): + fail("Unexpected error thrown: \(error)") + case .completed(.none): // success + break + } + } + +#if canImport(Darwin) + @objc(untilFile:line:action:) + public class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { + until(timeout: .seconds(1), file: file, line: line, action: action) + } +#else + public class func until( + _ file: FileString = #file, + line: UInt = #line, + action: @escaping (@escaping () -> Void) -> Void) { + until(timeout: .seconds(1), file: file, line: line, action: action) + } +#endif +} + +internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: NimbleTimeInterval) -> String { + // swiftlint:disable:next line_length + return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway.description) is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." +} + +/// Wait asynchronously until the done closure is called or the timeout has been reached. +/// +/// @discussion +/// Call the done() closure to indicate the waiting has completed. +/// +/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function +/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. +@available(*, noasync, message: "the sync variant of `waitUntil` does not work in async contexts. Use the async variant as a drop-in replacement") +public func waitUntil(timeout: NimbleTimeInterval = PollingDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) { + NMBWait.until(timeout: timeout, file: file, line: line, action: action) +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/DSL.swift b/Pods/Nimble/Sources/Nimble/DSL.swift new file mode 100644 index 0000000..d61ac60 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL.swift @@ -0,0 +1,142 @@ +/// Make a ``SyncExpectation`` on a given actual value. The value given is lazily evaluated. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +public func expect(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> Void)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The value given is lazily evaluated. +/// This is provided as an alternative to `expect` which avoids overloading with `expect -> AsyncExpectation`. +public func expects(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided as an alternative to `expect` which avoids overloading with `expect -> AsyncExpectation`. +public func expects(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided as an alternative to `expect` which avoids overloading with `expect -> AsyncExpectation`. +public func expects(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make a ``SyncExpectation`` on a given actual value. The closure is lazily invoked. +/// This is provided as an alternative to `expect` which avoids overloading with `expect -> AsyncExpectation`. +public func expects(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> Void)) -> SyncExpectation { + return SyncExpectation( + expression: Expression( + expression: expression(), + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Always fails the test with a message and a specified location. +public func fail(_ message: String, location: SourceLocation) { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(false, message: FailureMessage(stringValue: message), location: location) +} + +/// Always fails the test with a message. +public func fail(_ message: String, file: FileString = #file, line: UInt = #line) { + fail(message, location: SourceLocation(file: file, line: line)) +} + +/// Always fails the test. +public func fail(_ file: FileString = #file, line: UInt = #line) { + fail("fail() always fails", file: file, line: line) +} + +/// Like Swift's precondition(), but raises NSExceptions instead of sigaborts +internal func nimblePrecondition( + _ expr: @autoclosure () -> Bool, + _ name: @autoclosure () -> String, + _ message: @autoclosure () -> String, + file: StaticString = #file, + line: UInt = #line +) { + let result = expr() + if !result { + _nimblePrecondition(name(), message(), file, line) + } +} + +internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { + fatalError( + """ + Nimble Bug Found: \(msg) at \(file):\(line). + Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the code snippet that caused this error. + """ + ) +} + +#if canImport(Darwin) +import class Foundation.NSException +import struct Foundation.NSExceptionName + +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + let exception = NSException( + name: NSExceptionName(name), + reason: message, + userInfo: nil + ) + exception.raise() +} +#else +private func _nimblePrecondition( + _ name: String, + _ message: String, + _ file: StaticString, + _ line: UInt +) { + preconditionFailure("\(name) - \(message)", file: file, line: line) +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Expectation.swift b/Pods/Nimble/Sources/Nimble/Expectation.swift new file mode 100644 index 0000000..732e0c5 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Expectation.swift @@ -0,0 +1,332 @@ +internal func execute(_ expression: Expression, _ style: ExpectationStyle, _ matcher: Matcher, to: String, description: String?, captureExceptions: Bool = true) -> (Bool, FailureMessage) { + func run() -> (Bool, FailureMessage) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let result = try matcher.satisfies(expression) + result.message.update(failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(try expression.evaluate()))>" + } + return (result.toBoolean(expectation: style), msg) + } catch let error { + msg.stringValue = "unexpected error thrown: <\(error)>" + return (false, msg) + } + } + + var result: (Bool, FailureMessage) = (false, FailureMessage()) + if captureExceptions { + let capture = NMBExceptionCapture(handler: ({ exception -> Void in + let msg = FailureMessage() + msg.stringValue = "unexpected exception raised: \(exception)" + result = (false, msg) + }), finally: nil) + capture.tryBlock { + result = run() + } + } else { + result = run() + } + + return result +} + +internal func execute(_ expression: AsyncExpression, _ style: ExpectationStyle, _ matcher: AsyncMatcher, to: String, description: String?) async -> (Bool, FailureMessage) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let result = try await matcher.satisfies(expression) + result.message.update(failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(try await expression.evaluate()))>" + } + return (result.toBoolean(expectation: style), msg) + } catch let error { + msg.stringValue = "unexpected error thrown: <\(error)>" + return (false, msg) + } +} + +public enum ExpectationStatus: Equatable { + + /// No matchers have been performed. + case pending + + /// All matchers have passed. + case passed + + /// All matchers have failed. + case failed + + /// Multiple matchers have been peformed, with at least one passing and one failing. + case mixed +} + +extension ExpectationStatus { + /// Applies a new status to the current one to produce a combined status. + /// + /// This method is meant to advance the state from `.pending` to either `.passed` or`.failed`. + /// When called multiple times with different values, the result will be `.mixed`. + /// E.g., `status.applying(.passed).applying(.failed) == .mixed`. + func applying(_ newerStatus: ExpectationStatus) -> ExpectationStatus { + if newerStatus == .pending { return self } + if self == .pending || self == newerStatus { return newerStatus } + return .mixed + } +} + +public protocol Expectation { + var location: SourceLocation { get } + + /// The status of the test after matchers have been evaluated. + /// + /// This property can be used for changing test behavior based whether an expectation has + /// passed. + /// + /// In the below example, we perform additional tests on an array only if it has enough + /// elements. + /// + /// ``` + /// if expect(array).to(haveCount(10)).status == .passed { + /// expect(array[9]).to(...) + /// } + /// ``` + /// + /// - Remark: Similar functionality can be achieved using the `onFailure(throw:)` method. + var status: ExpectationStatus { get } + + /// Takes the result of a test and passes it to the assertion handler. + /// + /// - Returns: An updated `Expression` with the result of the test applied to the `status` + /// property. + @discardableResult + func verify(_ pass: Bool, _ message: FailureMessage) -> Self +} + +extension Expectation { + /// Throws the supplied error if the expectation has previously failed. + /// + /// This provides a mechanism for halting tests when a failure occurs. This can be used in + /// conjunction with `Quick.StopTest` to halt a test when a failure would cause subsequent test + /// code to fail. + /// + /// In the below example, the test will stop in the first line if `array.count == 5` rather + /// than crash on the second line. + /// + /// ``` + /// try expect(array).to(haveCount(10)).onFailure(throw: StopTest.silently) + /// expect(array[9]).to(...) + /// ``` + /// + /// - Warning: This method **MUST** be called after a matcher method like `to` or `not`. + /// Otherwise, this expectation will be in an indeterminate state and will + /// unconditionally log an error. + /// + /// - Remark: Similar functionality can be achieved using the `status` property. + /// - Attention: This is deprecated in favor of the `require` dsl (``require``, ``unwrap``, + /// ``pollUnwrap``), which integrates the matcher seemlessly, or, in the case of + /// `unwrap` and `pollUnwrap`, acts as a shorthand when you require that an + /// expression evaluate to some non-nil value. `onFailure` will be removed in + /// Nimble 15. + @available(*, deprecated, message: "Use the require dsl") + public func onFailure(`throw` error: Error) throws { + switch status { + case .pending: + let msg = """ + Attempted to call `Expectation.onFailure(throw:) before a matcher has been applied. + Try using `expect(...).to(...).onFailure(throw: ...`) instead. + """ + + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(false, message: .init(stringValue: msg), location: location) + case .passed: + break + case .failed, .mixed: + throw error + } + } +} + +public struct SyncExpectation: Expectation { + public let expression: Expression + + /// The status of the test after matchers have been evaluated. + /// + /// This property can be used for changing test behavior based whether an expectation has + /// passed. + /// + /// In the below example, we perform additional tests on an array only if it has enough + /// elements. + /// + /// ``` + /// if expect(array).to(haveCount(10)).status == .passed { + /// expect(array[9]).to(...) + /// } + /// ``` + /// + /// - Remark: Similar functionality can be achieved using the `onFailure(throw:)` method. + public let status: ExpectationStatus + + private init(expression: Expression, status: ExpectationStatus) { + self.expression = expression + self.status = status + } + + public init(expression: Expression) { + self.init(expression: expression, status: .pending) + } + + /// Takes the result of a test and passes it to the assertion handler. + /// + /// - Returns: An updated `Expression` with the result of the test applied to the `status` + /// property. + @discardableResult + public func verify(_ pass: Bool, _ message: FailureMessage) -> Self { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(pass, message: message, location: expression.location) + + return .init(expression: expression, status: status.applying(pass ? .passed : .failed)) + } + + public var location: SourceLocation { expression.location } + + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: Matcher, description: String? = nil) -> Self { + let (pass, msg) = execute(expression, .toMatch, matcher, to: "to", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: Matcher, description: String? = nil) -> Self { + let (pass, msg) = execute(expression, .toNotMatch, matcher, to: "to not", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: Matcher, description: String? = nil) -> Self { + toNot(matcher, description: description) + } + + // MARK: - AsyncMatchers + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + let (pass, msg) = await execute(expression.toAsyncExpression(), .toMatch, matcher, to: "to", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + let (pass, msg) = await execute(expression.toAsyncExpression(), .toNotMatch, matcher, to: "to not", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + await toNot(matcher, description: description) + } + + // see: + // - `Polling.swift` for toEventually and older-style polling-based approach to "async" + // - NMBExpectation for Objective-C interface +} + +public struct AsyncExpectation: Expectation { + public let expression: AsyncExpression + + /// The status of the test after matchers have been evaluated. + /// + /// This property can be used for changing test behavior based whether an expectation has + /// passed. + /// + /// In the below example, we perform additional tests on an array only if it has enough + /// elements. + /// + /// ``` + /// if expect(array).to(haveCount(10)).status == .passed { + /// expect(array[9]).to(...) + /// } + /// ``` + /// + /// - Remark: Similar functionality can be achieved using the `onFailure(throw:)` method. + public let status: ExpectationStatus + + private init(expression: AsyncExpression, status: ExpectationStatus) { + self.expression = expression + self.status = status + } + + public init(expression: AsyncExpression) { + self.init(expression: expression, status: .pending) + } + + public var location: SourceLocation { expression.location } + + /// Takes the result of a test and passes it to the assertion handler. + /// + /// - Returns: An updated `Expression` with the result of the test applied to the `status` + /// property. + @discardableResult + public func verify(_ pass: Bool, _ message: FailureMessage) -> Self { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(pass, message: message, location: expression.location) + + return .init(expression: expression, status: status.applying(pass ? .passed : .failed)) + } + + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: Matcher, description: String? = nil) async -> Self { + let (pass, msg) = execute(await expression.toSynchronousExpression(), .toMatch, matcher, to: "to", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: Matcher, description: String? = nil) async -> Self { + let (pass, msg) = execute(await expression.toSynchronousExpression(), .toNotMatch, matcher, to: "to not", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: Matcher, description: String? = nil) async -> Self { + await toNot(matcher, description: description) + } + + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + let (pass, msg) = await execute(expression, .toMatch, matcher, to: "to", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + let (pass, msg) = await execute(expression, .toNotMatch, matcher, to: "to not", description: description) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: AsyncMatcher, description: String? = nil) async -> Self { + await toNot(matcher, description: description) + } +} diff --git a/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift b/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift new file mode 100644 index 0000000..4efda7c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/ExpectationMessage.swift @@ -0,0 +1,258 @@ +public indirect enum ExpectationMessage { + // --- Primary Expectations --- + /// includes actual value in output ("expected to , got ") + case expectedActualValueTo(/* message: */ String) + /// uses a custom actual value string in output ("expected to , got ") + case expectedCustomValueTo(/* message: */ String, actual: String) + /// excludes actual value in output ("expected to ") + case expectedTo(/* message: */ String) + /// allows any free-form message ("") + case fail(/* message: */ String) + + // --- Composite Expectations --- + // Generally, you'll want the methods, appended(message:) and appended(details:) instead. + + /// Not Fully Implemented Yet. + case prepends(/* Prepended Message */ String, ExpectationMessage) + + /// appends after an existing message (" (use beNil() to match nils)") + case appends(ExpectationMessage, /* Appended Message */ String) + + /// provides long-form multi-line explainations ("\n\n") + case details(ExpectationMessage, String) + + /// Returns the smallest message after the "expected to" string that summarizes the error. + /// + /// Returns the message part from ExpectationMessage, ignoring all .appends and .details. + public var expectedMessage: String { + switch self { + case let .fail(msg): + return msg + case let .expectedTo(msg): + return msg + case let .expectedActualValueTo(msg): + return msg + case let .expectedCustomValueTo(msg, _): + return msg + case let .prepends(_, expectation): + return expectation.expectedMessage + case let .appends(expectation, msg): + return "\(expectation.expectedMessage)\(msg)" + case let .details(expectation, _): + return expectation.expectedMessage + } + } + + /// Appends a message after the primary expectation message + public func appended(message: String) -> ExpectationMessage { + switch self { + case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo, .appends, .prepends: + return .appends(self, message) + case let .details(expectation, msg): + return .details(expectation.appended(message: message), msg) + } + } + + /// Appends a message hinting to use beNil() for when the actual value given was nil. + public func appendedBeNilHint() -> ExpectationMessage { + return appended(message: " (use beNil() to match nils)") + } + + /// Appends a detailed (aka - multiline) message after the primary expectation message + /// Detailed messages will be placed after .appended(message:) calls. + public func appended(details: String) -> ExpectationMessage { + return .details(self, details) + } + + internal func visitLeafs(_ f: (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name + switch self { + case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: + return f(self) + case let .prepends(msg, expectation): + return .prepends(msg, expectation.visitLeafs(f)) + case let .appends(expectation, msg): + return .appends(expectation.visitLeafs(f), msg) + case let .details(expectation, msg): + return .details(expectation.visitLeafs(f), msg) + } + } + + /// Replaces a primary expectation with one returned by f. Preserves all composite expectations + /// that were built upon it (aka - all appended(message:) and appended(details:). + public func replacedExpectation(_ f: @escaping (ExpectationMessage) -> ExpectationMessage) -> ExpectationMessage { + // swiftlint:disable:previous identifier_name + func walk(_ msg: ExpectationMessage) -> ExpectationMessage { + switch msg { + case .fail, .expectedTo, .expectedActualValueTo, .expectedCustomValueTo: + return f(msg) + default: + return msg + } + } + return visitLeafs(walk) + } + + /// Wraps a primary expectation with text before and after it. + /// Alias to prepended(message: before).appended(message: after) + public func wrappedExpectation(before: String, after: String) -> ExpectationMessage { + return prepended(expectation: before).appended(message: after) + } + + /// Prepends a message by modifying the primary expectation + public func prepended(expectation message: String) -> ExpectationMessage { + func walk(_ msg: ExpectationMessage) -> ExpectationMessage { + switch msg { + case let .expectedTo(msg): + return .expectedTo(message + msg) + case let .expectedActualValueTo(msg): + return .expectedActualValueTo(message + msg) + case let .expectedCustomValueTo(msg, actual): + return .expectedCustomValueTo(message + msg, actual: actual) + default: + return msg.visitLeafs(walk) + } + } + return visitLeafs(walk) + } + + // swiftlint:disable:next todo + // TODO: test & verify correct behavior + internal func prepended(message: String) -> ExpectationMessage { + return .prepends(message, self) + } + + /// Converts the tree of ExpectationMessages into a final built string. + public func toString(actual: String, expected: String = "expected", to: String = "to") -> String { + switch self { + case let .fail(msg): + return msg + case let .expectedTo(msg): + return "\(expected) \(to) \(msg)" + case let .expectedActualValueTo(msg): + return "\(expected) \(to) \(msg), got \(actual)" + case let .expectedCustomValueTo(msg, actual): + return "\(expected) \(to) \(msg), got \(actual)" + case let .prepends(msg, expectation): + return "\(msg)\(expectation.toString(actual: actual, expected: expected, to: to))" + case let .appends(expectation, msg): + return "\(expectation.toString(actual: actual, expected: expected, to: to))\(msg)" + case let .details(expectation, msg): + return "\(expectation.toString(actual: actual, expected: expected, to: to))\n\n\(msg)" + } + } + + // Backwards compatibility: converts ExpectationMessage tree to FailureMessage + internal func update(failureMessage: FailureMessage) { + switch self { + case let .fail(msg) where !msg.isEmpty: + failureMessage.stringValue = msg + case .fail: + break + case let .expectedTo(msg): + failureMessage.actualValue = nil + failureMessage.postfixMessage = msg + case let .expectedActualValueTo(msg): + failureMessage.postfixMessage = msg + case let .expectedCustomValueTo(msg, actual): + failureMessage.postfixMessage = msg + failureMessage.actualValue = actual + case let .prepends(msg, expectation): + expectation.update(failureMessage: failureMessage) + if let desc = failureMessage.userDescription { + failureMessage.userDescription = "\(msg)\(desc)" + } else { + failureMessage.userDescription = msg + } + case let .appends(expectation, msg): + expectation.update(failureMessage: failureMessage) + failureMessage.appendMessage(msg) + case let .details(expectation, msg): + expectation.update(failureMessage: failureMessage) + failureMessage.appendDetails(msg) + } + } +} + +extension FailureMessage { + internal func toExpectationMessage() -> ExpectationMessage { + let defaultMessage = FailureMessage() + if expected != defaultMessage.expected || _stringValueOverride != nil { + return .fail(stringValue) + } + + var message: ExpectationMessage = .fail(userDescription ?? "") + if actualValue != "" && actualValue != nil { + message = .expectedCustomValueTo(postfixMessage, actual: actualValue ?? "") + } else if postfixMessage != defaultMessage.postfixMessage { + if actualValue == nil { + message = .expectedTo(postfixMessage) + } else { + message = .expectedActualValueTo(postfixMessage) + } + } + if postfixActual != defaultMessage.postfixActual { + message = .appends(message, postfixActual) + } + if let extended = extendedMessage { + message = .details(message, extended) + } + return message + } +} + +#if canImport(Darwin) +import class Foundation.NSObject + +public class NMBExpectationMessage: NSObject { + private let msg: ExpectationMessage + + internal init(swift msg: ExpectationMessage) { + self.msg = msg + } + + public init(expectedTo message: String) { + self.msg = .expectedTo(message) + } + public init(expectedActualValueTo message: String) { + self.msg = .expectedActualValueTo(message) + } + + public init(expectedActualValueTo message: String, customActualValue actual: String) { + self.msg = .expectedCustomValueTo(message, actual: actual) + } + + public init(fail message: String) { + self.msg = .fail(message) + } + + public init(prepend message: String, child: NMBExpectationMessage) { + self.msg = .prepends(message, child.msg) + } + + public init(appendedMessage message: String, child: NMBExpectationMessage) { + self.msg = .appends(child.msg, message) + } + + public init(prependedMessage message: String, child: NMBExpectationMessage) { + self.msg = .prepends(message, child.msg) + } + + public init(details message: String, child: NMBExpectationMessage) { + self.msg = .details(child.msg, message) + } + + public func appendedBeNilHint() -> NMBExpectationMessage { + return NMBExpectationMessage(swift: msg.appendedBeNilHint()) + } + + public func toSwift() -> ExpectationMessage { return self.msg } +} + +extension ExpectationMessage { + func toObjectiveC() -> NMBExpectationMessage { + return NMBExpectationMessage(swift: self) + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Expression.swift b/Pods/Nimble/Sources/Nimble/Expression.swift new file mode 100644 index 0000000..1bab44f --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Expression.swift @@ -0,0 +1,115 @@ +// Memoizes the given closure, only calling the passed +// closure once; even if repeat calls to the returned closure +private func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { + var cache: T? + return { withoutCaching in + if withoutCaching || cache == nil { + cache = try closure() + } + return cache! + } +} + +/// Expression represents the closure of the value inside expect(...). +/// Expressions are memoized by default. This makes them safe to call +/// evaluate() multiple times without causing a re-evaluation of the underlying +/// closure. +/// +/// - Warning: Since the closure can be any code, Objective-C code may choose +/// to raise an exception. Currently, SyncExpression does not memoize +/// exception raising. +/// +/// This provides a common consumable API for matchers to utilize to allow +/// Nimble to change internals to how the captured closure is managed. +public struct Expression { + internal let _expression: (Bool) throws -> Value? + internal let _withoutCaching: Bool + public let location: SourceLocation + public let isClosure: Bool + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. The expression is memoized. + /// + /// - Parameter expression: The closure that produces a given value. + /// - Parameter location: The source location that this closure originates from. + /// - Parameter isClosure: A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(expression: @escaping () throws -> Value?, location: SourceLocation, isClosure: Bool = true) { + self._expression = memoizedClosure(expression) + self.location = location + self._withoutCaching = false + self.isClosure = isClosure + } + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. + /// + /// - Parameter expression: The closure that produces a given value. + /// - Parameter location: The source location that this closure originates from. + /// - Parameter withoutCaching: Indicates if the struct should memoize the given + /// closure's result. Subsequent evaluate() calls will + /// not call the given closure if this is true. + /// - Parameter isClosure: A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(memoizedExpression: @escaping (Bool) throws -> Value?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) { + self._expression = memoizedExpression + self.location = location + self._withoutCaching = withoutCaching + self.isClosure = isClosure + } + + /// Returns a new Expression from the given expression. Identical to a map() + /// on this type. This should be used only to typecast the Expression's + /// closure value. + /// + /// The returned expression will preserve location and isClosure. + /// + /// - Parameter block: The block that can cast the current Expression value to a + /// new type. + public func cast(_ block: @escaping (Value?) throws -> U?) -> Expression { + Expression( + expression: ({ try block(self.evaluate()) }), + location: self.location, + isClosure: self.isClosure + ) + } + + public func evaluate() throws -> Value? { + try self._expression(_withoutCaching) + } + + public func withoutCaching() -> Expression { + Expression( + memoizedExpression: self._expression, + location: location, + withoutCaching: true, + isClosure: isClosure + ) + } + + public func withCaching() -> Expression { + Expression( + memoizedExpression: memoizedClosure { try self.evaluate() }, + location: self.location, + withoutCaching: false, + isClosure: isClosure + ) + } + + public func toAsyncExpression() -> AsyncExpression { + AsyncExpression( + memoizedExpression: { @MainActor memoize in try _expression(memoize) }, + location: location, + withoutCaching: _withoutCaching, + isClosure: isClosure + ) + } +} diff --git a/Pods/Nimble/Sources/Nimble/FailureMessage.swift b/Pods/Nimble/Sources/Nimble/FailureMessage.swift new file mode 100644 index 0000000..8b60b9c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/FailureMessage.swift @@ -0,0 +1,92 @@ +import Foundation + +/// Encapsulates the failure message that matchers can report to the end user. +/// +/// This is shared state between Nimble and matchers that mutate this value. +public class FailureMessage: NSObject { + public var expected: String = "expected" + public var actualValue: String? = "" // empty string -> use default; nil -> exclude + public var to: String = "to" + public var postfixMessage: String = "match" + public var postfixActual: String = "" + /// An optional message that will be appended as a new line and provides additional details + /// about the failure. This message will only be visible in the issue navigator / in logs but + /// not directly in the source editor since only a single line is presented there. + public var extendedMessage: String? + public var userDescription: String? + + public var stringValue: String { + get { + if let value = _stringValueOverride { + return value + } else { + return computeStringValue() + } + } + set { + _stringValueOverride = newValue + } + } + + internal var _stringValueOverride: String? + internal var hasOverriddenStringValue: Bool { + return _stringValueOverride != nil + } + + public override init() { + } + + public init(stringValue: String) { + _stringValueOverride = stringValue + } + + internal func stripNewlines(_ str: String) -> String { + let whitespaces = CharacterSet.whitespacesAndNewlines + return str + .components(separatedBy: "\n") + .map { line in line.trimmingCharacters(in: whitespaces) } + .joined(separator: "") + } + + internal func computeStringValue() -> String { + var value = "\(expected) \(to) \(postfixMessage)" + if let actualValue = actualValue { + value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" + } + value = stripNewlines(value) + + if let extendedMessage = extendedMessage { + value += "\n\(extendedMessage)" + } + + if let userDescription = userDescription { + return "\(userDescription)\n\(value)" + } + + return value + } + + internal func appendMessage(_ msg: String) { + if hasOverriddenStringValue { + stringValue += "\(msg)" + } else if actualValue != nil { + postfixActual += msg + } else { + postfixMessage += msg + } + } + + internal func appendDetails(_ msg: String) { + if hasOverriddenStringValue { + if let desc = userDescription { + stringValue = "\(desc)\n\(stringValue)" + } + stringValue += "\n\(msg)" + } else { + if let desc = userDescription { + userDescription = desc + } + extendedMessage = msg + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift new file mode 100644 index 0000000..133c21e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -0,0 +1,111 @@ +public func allPass( + _ passFunc: @escaping (S.Element) throws -> Bool +) -> Matcher { + let matcher = Matcher.define("pass a condition") { actualExpression, message in + guard let actual = try actualExpression.evaluate() else { + return MatcherResult(status: .fail, message: message) + } + return MatcherResult(bool: try passFunc(actual), message: message) + } + return createMatcher(matcher) +} + +public func allPass( + _ passName: String, + _ passFunc: @escaping (S.Element) throws -> Bool +) -> Matcher { + let matcher = Matcher.define(passName) { actualExpression, message in + guard let actual = try actualExpression.evaluate() else { + return MatcherResult(status: .fail, message: message) + } + return MatcherResult(bool: try passFunc(actual), message: message) + } + return createMatcher(matcher) +} + +public func allPass(_ elementMatcher: Matcher) -> Matcher { + return createMatcher(elementMatcher) +} + +private func createMatcher(_ elementMatcher: Matcher) -> Matcher { + return Matcher { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { + return MatcherResult( + status: .fail, + message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + ) + } + + var failure: ExpectationMessage = .expectedTo("all pass") + for currentElement in actualValue { + let exp = Expression( + expression: { currentElement }, + location: actualExpression.location + ) + let matcherResult = try elementMatcher.satisfies(exp) + if matcherResult.status == .matches { + failure = matcherResult.message.prepended(expectation: "all ") + } else { + failure = matcherResult.message + .replacedExpectation({ .expectedTo($0.expectedMessage) }) + .wrappedExpectation( + before: "all ", + after: ", but failed first at element <\(stringify(currentElement))>" + + " in <\(stringify(actualValue))>" + ) + return MatcherResult(status: .doesNotMatch, message: failure) + } + } + failure = failure.replacedExpectation({ expectation in + return .expectedTo(expectation.expectedMessage) + }) + return MatcherResult(status: .matches, message: failure) + } +} + +#if canImport(Darwin) +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration + +extension NMBMatcher { + @objc public class func allPassMatcher(_ matcher: NMBMatcher) -> NMBMatcher { + return NMBMatcher { actualExpression in + let location = actualExpression.location + let actualValue = try actualExpression.evaluate() + var nsObjects = [NSObject]() + + var collectionIsUsable = true + if let value = actualValue as? NSFastEnumeration { + var generator = NSFastEnumerationIterator(value) + while let obj = generator.next() { + if let nsObject = obj as? NSObject { + nsObjects.append(nsObject) + } else { + collectionIsUsable = false + break + } + } + } else { + collectionIsUsable = false + } + + if !collectionIsUsable { + return NMBMatcherResult( + status: NMBMatcherStatus.fail, + message: NMBExpectationMessage( + // swiftlint:disable:next line_length + fail: "allPass can only be used with types which implement NSFastEnumeration (NSArray, NSSet, ...), and whose elements subclass NSObject, got <\(actualValue?.description ?? "nil")>" + ) + ) + } + + let expr = Expression(expression: ({ nsObjects }), location: location) + let pred: Matcher<[NSObject]> = createMatcher(Matcher { expr in + return matcher.satisfies(({ try expr.evaluate() }), location: expr.location).toSwift() + }) + return try pred.satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AsyncAllPass.swift b/Pods/Nimble/Sources/Nimble/Matchers/AsyncAllPass.swift new file mode 100644 index 0000000..ec04f9e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/AsyncAllPass.swift @@ -0,0 +1,64 @@ +public func allPass( + _ passFunc: @escaping (S.Element) async throws -> Bool +) -> AsyncMatcher { + let matcher = AsyncMatcher.define("pass a condition") { actualExpression, message in + guard let actual = try await actualExpression.evaluate() else { + return MatcherResult(status: .fail, message: message) + } + return MatcherResult(bool: try await passFunc(actual), message: message) + } + return createMatcher(matcher) +} + +public func allPass( + _ passName: String, + _ passFunc: @escaping (S.Element) async throws -> Bool +) -> AsyncMatcher { + let matcher = AsyncMatcher.define(passName) { actualExpression, message in + guard let actual = try await actualExpression.evaluate() else { + return MatcherResult(status: .fail, message: message) + } + return MatcherResult(bool: try await passFunc(actual), message: message) + } + return createMatcher(matcher) +} + +public func allPass(_ elementMatcher: AsyncMatcher) -> AsyncMatcher { + return createMatcher(elementMatcher) +} + +private func createMatcher(_ elementMatcher: AsyncMatcher) -> AsyncMatcher { + return AsyncMatcher { actualExpression in + guard let actualValue = try await actualExpression.evaluate() else { + return MatcherResult( + status: .fail, + message: .appends(.expectedTo("all pass"), " (use beNil() to match nils)") + ) + } + + var failure: ExpectationMessage = .expectedTo("all pass") + for currentElement in actualValue { + let exp = AsyncExpression( + expression: { currentElement }, + location: actualExpression.location + ) + let matcherResult = try await elementMatcher.satisfies(exp) + if matcherResult.status == .matches { + failure = matcherResult.message.prepended(expectation: "all ") + } else { + failure = matcherResult.message + .replacedExpectation({ .expectedTo($0.expectedMessage) }) + .wrappedExpectation( + before: "all ", + after: ", but failed first at element <\(stringify(currentElement))>" + + " in <\(stringify(actualValue))>" + ) + return MatcherResult(status: .doesNotMatch, message: failure) + } + } + failure = failure.replacedExpectation({ expectation in + return .expectedTo(expectation.expectedMessage) + }) + return MatcherResult(status: .matches, message: failure) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcher.swift b/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcher.swift new file mode 100644 index 0000000..96b118a --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcher.swift @@ -0,0 +1,118 @@ +public protocol AsyncableMatcher { + associatedtype Value + func satisfies(_ expression: AsyncExpression) async throws -> MatcherResult +} + +extension Matcher: AsyncableMatcher { + public func satisfies(_ expression: AsyncExpression) async throws -> MatcherResult { + try satisfies(await expression.toSynchronousExpression()) + } +} + +/// An AsyncMatcher is part of the new matcher API that provides assertions to expectations. +/// +/// Given a code snippet: +/// +/// expect(1).to(equal(2)) +/// ^^^^^^^^ +/// Called a "matcher" +/// +/// A matcher consists of two parts a constructor function and the Matcher. +/// +/// The Matcher provide the heavy lifting on how to assert against a given value. Internally, +/// matchers are simple wrappers around closures to provide static type information and +/// allow composition and wrapping of existing behaviors. +/// +/// `AsyncMatcher`s serve to allow writing matchers that must be run in async contexts. +/// These can also be used with either `Expectation`s or `AsyncExpectation`s. +/// But these can only be used from async contexts, and are unavailable in Objective-C. +/// You can, however, call regular Matchers from an AsyncMatcher, if you wish to compose one like that. +public struct AsyncMatcher: AsyncableMatcher { + fileprivate var matcher: (AsyncExpression) async throws -> MatcherResult + + public init(_ matcher: @escaping (AsyncExpression) async throws -> MatcherResult) { + self.matcher = matcher + } + + /// Uses a matcher on a given value to see if it passes the matcher. + /// + /// @param expression The value to run the matcher's logic against + /// @returns A matcher result indicate passing or failing and an associated error message. + public func satisfies(_ expression: AsyncExpression) async throws -> MatcherResult { + return try await matcher(expression) + } +} + +@available(*, deprecated, renamed: "AsyncMatcher") +public typealias AsyncPredicate = AsyncMatcher + +/// Provides convenience helpers to defining matchers +extension AsyncMatcher { + /// Like Matcher() constructor, but automatically guard against nil (actual) values + public static func define(matcher: @escaping (AsyncExpression) async throws -> MatcherResult) -> AsyncMatcher { + return AsyncMatcher { actual in + return try await matcher(actual) + }.requireNonNil + } + + /// Defines a matcher with a default message that can be returned in the closure + /// Also ensures the matcher's actual value cannot pass with `nil` given. + public static func define(_ message: String = "match", matcher: @escaping (AsyncExpression, ExpectationMessage) async throws -> MatcherResult) -> AsyncMatcher { + return AsyncMatcher { actual in + return try await matcher(actual, .expectedActualValueTo(message)) + }.requireNonNil + } + + /// Defines a matcher with a default message that can be returned in the closure + /// Unlike `define`, this allows nil values to succeed if the given closure chooses to. + public static func defineNilable(_ message: String = "match", matcher: @escaping (AsyncExpression, ExpectationMessage) async throws -> MatcherResult) -> AsyncMatcher { + return AsyncMatcher { actual in + return try await matcher(actual, .expectedActualValueTo(message)) + } + } + + /// Provides a simple matcher definition that provides no control over the predefined + /// error message. + /// + /// Also ensures the matcher's actual value cannot pass with `nil` given. + public static func simple(_ message: String = "match", matcher: @escaping (AsyncExpression) async throws -> MatcherStatus) -> AsyncMatcher { + return AsyncMatcher { actual in + return MatcherResult(status: try await matcher(actual), message: .expectedActualValueTo(message)) + }.requireNonNil + } + + /// Provides a simple matcher definition that provides no control over the predefined + /// error message. + /// + /// Unlike `simple`, this allows nil values to succeed if the given closure chooses to. + public static func simpleNilable(_ message: String = "match", matcher: @escaping (AsyncExpression) async throws -> MatcherStatus) -> AsyncMatcher { + return AsyncMatcher { actual in + return MatcherResult(status: try await matcher(actual), message: .expectedActualValueTo(message)) + } + } +} + +extension AsyncMatcher { + // Someday, make this public? Needs documentation + internal func after(f: @escaping (AsyncExpression, MatcherResult) async throws -> MatcherResult) -> AsyncMatcher { + // swiftlint:disable:previous identifier_name + return AsyncMatcher { actual -> MatcherResult in + let result = try await self.satisfies(actual) + return try await f(actual, result) + } + } + + /// Returns a new Matcher based on the current one that always fails if nil is given as + /// the actual value. + public var requireNonNil: AsyncMatcher { + return after { actual, result in + if try await actual.evaluate() == nil { + return MatcherResult( + status: .fail, + message: result.message.appendedBeNilHint() + ) + } + return result + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift new file mode 100644 index 0000000..6b010ec --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -0,0 +1,67 @@ +private func matcherMessage(forType expectedType: T.Type) -> String { + return "be a kind of \(String(describing: expectedType))" +} +private func matcherMessage(forClass expectedClass: AnyClass) -> String { + return "be a kind of \(String(describing: expectedClass))" +} + +/// A Nimble matcher that succeeds when the actual value is an instance of the given class. +public func beAKindOf(_ expectedType: T.Type) -> Matcher { + return Matcher.define { actualExpression in + let message: ExpectationMessage + + let instance = try actualExpression.evaluate() + guard let validInstance = instance else { + message = .expectedCustomValueTo(matcherMessage(forType: expectedType), actual: "") + return MatcherResult(status: .fail, message: message) + } + message = .expectedCustomValueTo( + "be a kind of \(String(describing: expectedType))", + actual: "<\(String(describing: type(of: validInstance))) instance>" + ) + + return MatcherResult( + bool: validInstance is T, + message: message + ) + } +} + +#if canImport(Darwin) +import class Foundation.NSObject + +/// A Nimble matcher that succeeds when the actual value is an instance of the given class. +/// @see beAnInstanceOf if you want to match against the exact class +public func beAKindOf(_ expectedClass: AnyClass) -> Matcher { + return Matcher.define { actualExpression in + let message: ExpectationMessage + let status: MatcherStatus + + let instance = try actualExpression.evaluate() + if let validInstance = instance { + status = MatcherStatus(bool: instance != nil && instance!.isKind(of: expectedClass)) + message = .expectedCustomValueTo( + matcherMessage(forClass: expectedClass), + actual: "<\(String(describing: type(of: validInstance))) instance>" + ) + } else { + status = .fail + message = .expectedCustomValueTo( + matcherMessage(forClass: expectedClass), + actual: "" + ) + } + + return MatcherResult(status: status, message: message) + } +} + +extension NMBMatcher { + @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { + return NMBMatcher { actualExpression in + return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC() + } + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift new file mode 100644 index 0000000..d8a1311 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -0,0 +1,56 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is an _exact_ instance of the given class. +public func beAnInstanceOf(_ expectedType: T.Type) -> Matcher { + let errorMessage = "be an instance of \(String(describing: expectedType))" + return Matcher.define { actualExpression in + let instance = try actualExpression.evaluate() + guard let validInstance = instance else { + return MatcherResult( + status: .doesNotMatch, + message: .expectedActualValueTo(errorMessage) + ) + } + + let actualString = "<\(String(describing: type(of: validInstance))) instance>" + + return MatcherResult( + status: MatcherStatus(bool: type(of: validInstance) == expectedType), + message: .expectedCustomValueTo(errorMessage, actual: actualString) + ) + } +} + +/// A Nimble matcher that succeeds when the actual value is an instance of the given class. +/// @see beAKindOf if you want to match against subclasses +public func beAnInstanceOf(_ expectedClass: AnyClass) -> Matcher { + let errorMessage = "be an instance of \(String(describing: expectedClass))" + return Matcher.define { actualExpression in + let instance = try actualExpression.evaluate() + let actualString: String + if let validInstance = instance { + actualString = "<\(String(describing: type(of: validInstance))) instance>" + } else { + actualString = "" + } + #if canImport(Darwin) + let matches = instance != nil && instance!.isMember(of: expectedClass) + #else + let matches = instance != nil && type(of: instance!) == expectedClass + #endif + return MatcherResult( + status: MatcherStatus(bool: matches), + message: .expectedCustomValueTo(errorMessage, actual: actualString) + ) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { + return NMBMatcher { actualExpression in + return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift new file mode 100644 index 0000000..36dc0e0 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -0,0 +1,195 @@ +import Foundation + +// swiftlint:disable:next identifier_name +public let DefaultDelta: Double = 0.0001 + +public func defaultDelta() -> F { 1/10000 /* 0.0001 */ } + +internal func isCloseTo( + _ actualValue: Value?, + expectedValue: Value, + delta: Value +) -> MatcherResult { + let errorMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))" + return MatcherResult( + bool: actualValue != nil && + abs(actualValue! - expectedValue) < delta, + message: .expectedCustomValueTo(errorMessage, actual: "<\(stringify(actualValue))>") + ) +} + +internal func isCloseTo( + _ actualValue: NMBDoubleConvertible?, + expectedValue: NMBDoubleConvertible, + delta: Double +) -> MatcherResult { + let errorMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))" + return MatcherResult( + bool: actualValue != nil && + abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta, + message: .expectedCustomValueTo(errorMessage, actual: "<\(stringify(actualValue))>") + ) +} + +/// A Nimble matcher that succeeds when a value is close to another. This is used for floating +/// point values which can have imprecise results when doing arithmetic on them. +/// +/// @see equal +public func beCloseTo( + _ expectedValue: Value, + within delta: Value = defaultDelta() +) -> Matcher { + return Matcher.define { actualExpression in + return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) + } +} + +/// A Nimble matcher that succeeds when a value is close to another. This is used for floating +/// point values which can have imprecise results when doing arithmetic on them. +/// +/// @see equal +public func beCloseTo( + _ expectedValue: Value, + within delta: Double = DefaultDelta +) -> Matcher { + return Matcher.define { actualExpression in + return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) + } +} + +private func beCloseTo( + _ expectedValue: NMBDoubleConvertible, + within delta: Double = DefaultDelta +) -> Matcher { + return Matcher.define { actualExpression in + return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta) + } +} + +#if canImport(Darwin) +public class NMBObjCBeCloseToMatcher: NMBMatcher { + private let _expected: NSNumber + + fileprivate init(expected: NSNumber, within: CDouble) { + _expected = expected + + let matcher = beCloseTo(expected, within: within) + let matcherBlock: MatcherBlock = { actualExpression in + let expr = actualExpression.cast { $0 as? NMBDoubleConvertible } + return try matcher.satisfies(expr).toObjectiveC() + } + super.init(matcher: matcherBlock) + } + + @objc public var within: (CDouble) -> NMBObjCBeCloseToMatcher { + let expected = _expected + return { delta in + return NMBObjCBeCloseToMatcher(expected: expected, within: delta) + } + } +} + +extension NMBMatcher { + @objc public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { + return NMBObjCBeCloseToMatcher(expected: expected, within: within) + } +} +#endif + +public func beCloseTo( + _ expectedValues: Values, + within delta: Value = defaultDelta() +) -> Matcher where Values.Element == Value { + let errorMessage = "be close to <\(stringify(expectedValues))> (each within \(stringify(delta)))" + return Matcher.simple(errorMessage) { actualExpression in + guard let actualValues = try actualExpression.evaluate() else { + return .doesNotMatch + } + + if actualValues.count != expectedValues.count { + return .doesNotMatch + } + + for index in actualValues.indices where abs(actualValues[index] - expectedValues[index]) > delta { + return .doesNotMatch + } + return .matches + } +} + +// MARK: - Operators + +infix operator ≈ : ComparisonPrecedence + +// swiftlint:disable identifier_name +public func ≈ (lhs: SyncExpectation, rhs: Value) where Value: Collection, Value.Element: FloatingPoint { + lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: AsyncExpectation, rhs: Value) async where Value: Collection, Value.Element: FloatingPoint { + await lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: SyncExpectation, rhs: Value) { + lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: AsyncExpectation, rhs: Value) async { + await lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: SyncExpectation, rhs: (expected: Value, delta: Value)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func ≈ (lhs: AsyncExpectation, rhs: (expected: Value, delta: Value)) async { + await lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func == (lhs: SyncExpectation, rhs: (expected: Value, delta: Value)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func == (lhs: AsyncExpectation, rhs: (expected: Value, delta: Value)) async { + await lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func ≈ (lhs: SyncExpectation, rhs: Value) { + lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: AsyncExpectation, rhs: Value) async { + await lhs.to(beCloseTo(rhs)) +} + +public func ≈ (lhs: SyncExpectation, rhs: (expected: Value, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func ≈ (lhs: AsyncExpectation, rhs: (expected: Value, delta: Double)) async { + await lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func == (lhs: SyncExpectation, rhs: (expected: Value, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func == (lhs: AsyncExpectation, rhs: (expected: Value, delta: Double)) async { + await lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +// make this higher precedence than exponents so the Doubles either end aren't pulled in +// unexpectantly +precedencegroup PlusMinusOperatorPrecedence { + higherThan: BitwiseShiftPrecedence +} + +infix operator ± : PlusMinusOperatorPrecedence +public func ± (lhs: Value, rhs: Value) -> (expected: Value, delta: Value) { + return (expected: lhs, delta: rhs) +} +public func ± (lhs: Value, rhs: Double) -> (expected: Value, delta: Double) { + return (expected: lhs, delta: rhs) +} + +// swiftlint:enable identifier_name diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift new file mode 100644 index 0000000..571797c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -0,0 +1,110 @@ +import Foundation + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + var generator = actual.makeIterator() + return MatcherStatus(bool: generator.next() == nil) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.isEmpty) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For NSString instances, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.length == 0) + } +} + +// Without specific overrides, beEmpty() is ambiguous for NSDictionary, NSArray, +// etc, since they conform to Sequence as well as NMBCollection. + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.count == 0) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.count == 0) + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> Matcher { + return Matcher.simple("be empty") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + return MatcherStatus(bool: actual.count == 0) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func beEmptyMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + let location = actualExpression.location + let actualValue = try actualExpression.evaluate() + + if let value = actualValue as? NMBCollection { + let expr = Expression(expression: ({ value }), location: location) + return try beEmpty().satisfies(expr).toObjectiveC() + } else if let value = actualValue as? NSString { + let expr = Expression(expression: ({ value }), location: location) + return try beEmpty().satisfies(expr).toObjectiveC() + } else if let actualValue = actualValue { + let badTypeErrorMsg = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" + return NMBMatcherResult( + status: NMBMatcherStatus.fail, + message: NMBExpectationMessage( + expectedActualValueTo: badTypeErrorMsg, + customActualValue: "\(String(describing: type(of: actualValue))) type" + ) + ) + } + return NMBMatcherResult( + status: NMBMatcherStatus.fail, + message: NMBExpectationMessage(expectedActualValueTo: "be empty").appendedBeNilHint() + ) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift new file mode 100644 index 0000000..dc96d58 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -0,0 +1,49 @@ +/// A Nimble matcher that succeeds when the actual value is greater than the expected value. +public func beGreaterThan(_ expectedValue: T?) -> Matcher { + let errorMessage = "be greater than <\(stringify(expectedValue))>" + return Matcher.simple(errorMessage) { actualExpression in + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return MatcherStatus(bool: actual > expected) + } +} + +public func > (lhs: SyncExpectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +public func > (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(beGreaterThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + +/// A Nimble matcher that succeeds when the actual value is greater than the expected value. +public func beGreaterThan(_ expectedValue: T?) -> Matcher { + let errorMessage = "be greater than <\(stringify(expectedValue))>" + return Matcher.simple(errorMessage) { actualExpression in + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil + && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending + return MatcherStatus(bool: matches) + } +} + +public func > (lhs: SyncExpectation, rhs: T?) { + lhs.to(beGreaterThan(rhs)) +} + +public func > (lhs: AsyncExpectation, rhs: T?) async { + await lhs.to(beGreaterThan(rhs)) +} + +extension NMBMatcher { + @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try beGreaterThan(expected).satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift new file mode 100644 index 0000000..14821de --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -0,0 +1,50 @@ +/// A Nimble matcher that succeeds when the actual value is greater than +/// or equal to the expected value. +public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Matcher { + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Matcher.simple(message) { actualExpression in + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return MatcherStatus(bool: actual >= expected) + } +} + +public func >= (lhs: SyncExpectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +public func >= (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + +/// A Nimble matcher that succeeds when the actual value is greater than +/// or equal to the expected value. +public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Matcher { + let message = "be greater than or equal to <\(stringify(expectedValue))>" + return Matcher.simple(message) { actualExpression in + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending + return MatcherStatus(bool: matches) + } +} + +public func >= (lhs: SyncExpectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +public func >= (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +extension NMBMatcher { + @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try beGreaterThanOrEqualTo(expected).satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift new file mode 100644 index 0000000..3f00b18 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -0,0 +1,53 @@ +/// A Nimble matcher that succeeds when the actual value is the same instance +/// as the expected instance. +public func beIdenticalTo(_ expected: AnyObject?) -> Matcher { + return Matcher.define { actualExpression in + let actual = try actualExpression.evaluate() + + let bool = actual === expected && actual !== nil + return MatcherResult( + bool: bool, + message: .expectedCustomValueTo( + "be identical to \(identityAsString(expected))", + actual: "\(identityAsString(actual))" + ) + ) + } +} + +public func === (lhs: SyncExpectation, rhs: AnyObject?) { + lhs.to(beIdenticalTo(rhs)) +} + +public func === (lhs: AsyncExpectation, rhs: AnyObject?) async { + await lhs.to(beIdenticalTo(rhs)) +} + +public func !== (lhs: SyncExpectation, rhs: AnyObject?) { + lhs.toNot(beIdenticalTo(rhs)) +} + +public func !== (lhs: AsyncExpectation, rhs: AnyObject?) async { + await lhs.toNot(beIdenticalTo(rhs)) +} + +/// A Nimble matcher that succeeds when the actual value is the same instance +/// as the expected instance. +/// +/// Alias for "beIdenticalTo". +public func be(_ expected: AnyObject?) -> Matcher { + return beIdenticalTo(expected) +} + +#if canImport(Darwin) +import class Foundation.NSObject + +extension NMBMatcher { + @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBMatcher { + return NMBMatcher { actualExpression in + let aExpr = actualExpression.cast { $0 as AnyObject? } + return try beIdenticalTo(expected).satisfies(aExpr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift new file mode 100644 index 0000000..4be83c9 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -0,0 +1,48 @@ +/// A Nimble matcher that succeeds when the actual value is less than the expected value. +public func beLessThan(_ expectedValue: T?) -> Matcher { + let message = "be less than <\(stringify(expectedValue))>" + return Matcher.simple(message) { actualExpression in + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return MatcherStatus(bool: actual < expected) + } +} + +public func < (lhs: SyncExpectation, rhs: V) { + lhs.to(beLessThan(rhs)) +} + +public func < (lhs: AsyncExpectation, rhs: V) async { + await lhs.to(beLessThan(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + +/// A Nimble matcher that succeeds when the actual value is less than the expected value. +public func beLessThan(_ expectedValue: T?) -> Matcher { + let message = "be less than <\(stringify(expectedValue))>" + return Matcher.simple(message) { actualExpression in + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending + return MatcherStatus(bool: matches) + } +} + +public func < (lhs: SyncExpectation, rhs: V?) { + lhs.to(beLessThan(rhs)) +} + +public func < (lhs: AsyncExpectation, rhs: V?) async { + await lhs.to(beLessThan(rhs)) +} + +extension NMBMatcher { + @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try beLessThan(expected).satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift new file mode 100644 index 0000000..830e9e6 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -0,0 +1,48 @@ +/// A Nimble matcher that succeeds when the actual value is less than +/// or equal to the expected value. +public func beLessThanOrEqualTo(_ expectedValue: T?) -> Matcher { + return Matcher.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in + guard let actual = try actualExpression.evaluate(), let expected = expectedValue else { return .fail } + + return MatcherStatus(bool: actual <= expected) + } +} + +public func <= (lhs: SyncExpectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +public func <= (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if canImport(Darwin) +import enum Foundation.ComparisonResult + +/// A Nimble matcher that succeeds when the actual value is less than +/// or equal to the expected value. +public func beLessThanOrEqualTo(_ expectedValue: T?) -> Matcher { + return Matcher.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in + let actualValue = try actualExpression.evaluate() + let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false + return MatcherStatus(bool: matches) + } +} + +public func <= (lhs: SyncExpectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +public func <= (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(beLessThanOrEqualTo(rhs)) +} + +extension NMBMatcher { + @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try beLessThanOrEqualTo(expected).satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift new file mode 100644 index 0000000..5170299 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -0,0 +1,148 @@ +import Foundation + +extension Int8: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).int8Value + } +} + +extension UInt8: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).uint8Value + } +} + +extension Int16: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).int16Value + } +} + +extension UInt16: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).uint16Value + } +} + +extension Int32: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).int32Value + } +} + +extension UInt32: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).uint32Value + } +} + +extension Int64: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).int64Value + } +} + +extension UInt64: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).uint64Value + } +} + +extension Float: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).floatValue + } +} + +extension Double: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).doubleValue + } +} + +extension Int: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).intValue + } +} + +extension UInt: ExpressibleByBooleanLiteral { + public init(booleanLiteral value: Bool) { + self = NSNumber(value: value).uintValue + } +} + +internal func rename(_ matcher: Matcher, failureMessage message: ExpectationMessage) -> Matcher { + return Matcher { actualExpression in + let result = try matcher.satisfies(actualExpression) + return MatcherResult(status: result.status, message: message) + }.requireNonNil +} + +// MARK: beTrue() / beFalse() + +/// A Nimble matcher that succeeds when the actual value is exactly true. +/// This matcher will not match against nils. +public func beTrue() -> Matcher { + return rename(equal(true), failureMessage: .expectedActualValueTo("be true")) +} + +/// A Nimble matcher that succeeds when the actual value is exactly false. +/// This matcher will not match against nils. +public func beFalse() -> Matcher { + return rename(equal(false), failureMessage: .expectedActualValueTo("be false")) +} + +// MARK: beTruthy() / beFalsy() + +/// A Nimble matcher that succeeds when the actual value is not logically false. +public func beTruthy() -> Matcher { + return Matcher.simpleNilable("be truthy") { actualExpression in + let actualValue = try actualExpression.evaluate() + return MatcherStatus(bool: actualValue == (true as T)) + } +} + +/// A Nimble matcher that succeeds when the actual value is logically false. +/// This matcher will match against nils. +public func beFalsy() -> Matcher { + return Matcher.simpleNilable("be falsy") { actualExpression in + let actualValue = try actualExpression.evaluate() + return MatcherStatus(bool: actualValue != (true as T)) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func beTruthyMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } + return try beTruthy().satisfies(expr).toObjectiveC() + } + } + + @objc public class func beFalsyMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } + return try beFalsy().satisfies(expr).toObjectiveC() + } + } + + @objc public class func beTrueMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } + return try beTrue().satisfies(expr).toObjectiveC() + } + } + + @objc public class func beFalseMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + let expr = actualExpression.cast { value -> Bool? in + guard let value = value else { return nil } + return (value as? NSNumber)?.boolValue ?? false + } + return try beFalse().satisfies(expr).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift new file mode 100644 index 0000000..eea1440 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -0,0 +1,56 @@ +/// A protocol which represents whether the value is nil or not. +private protocol _OptionalProtocol { + var isNil: Bool { get } +} + +extension Optional: _OptionalProtocol { + var isNil: Bool { self == nil } +} + +/// A Nimble matcher that succeeds when the actual value is nil. +public func beNil() -> Matcher { + return Matcher.simpleNilable("be nil") { actualExpression in + let actualValue = try actualExpression.evaluate() + if let actual = actualValue, let nestedOptionl = actual as? _OptionalProtocol { + return MatcherStatus(bool: nestedOptionl.isNil) + } + return MatcherStatus(bool: actualValue == nil) + } +} + +/// Represents `nil` value to be used with the operator overloads for `beNil`. +public struct ExpectationNil: ExpressibleByNilLiteral { + public init(nilLiteral: ()) {} +} + +extension SyncExpectation { + public static func == (lhs: SyncExpectation, rhs: ExpectationNil) { + lhs.to(beNil()) + } + + public static func != (lhs: SyncExpectation, rhs: ExpectationNil) { + lhs.toNot(beNil()) + } +} + +extension AsyncExpectation { + public static func == (lhs: AsyncExpectation, rhs: ExpectationNil) async { + await lhs.to(beNil()) + } + + public static func != (lhs: AsyncExpectation, rhs: ExpectationNil) async { + await lhs.toNot(beNil()) + } +} + +#if canImport(Darwin) +import Foundation + +extension NMBMatcher { + @objc public class func beNilMatcher() -> NMBMatcher { + return NMBMatcher { actualExpression in + return try beNil().satisfies(actualExpression).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeResult.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeResult.swift new file mode 100644 index 0000000..7f90dfc --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeResult.swift @@ -0,0 +1,67 @@ +import Foundation + +/// A Nimble matcher for Result that succeeds when the actual value is success. +/// +/// You can pass a closure to do any arbitrary custom matching to the value inside result. +/// The closure only gets called when the result is success. +public func beSuccess( + test: ((Success) -> Void)? = nil +) -> Matcher> { + return Matcher.define { expression in + var rawMessage = "be " + if test != nil { + rawMessage += " that satisfies block" + } + let message = ExpectationMessage.expectedActualValueTo(rawMessage) + + guard case let .success(value)? = try expression.evaluate() else { + return MatcherResult(status: .doesNotMatch, message: message) + } + + var matches = true + if let test = test { + let assertions = gatherFailingExpectations { + test(value) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher for Result that succeeds when the actual value is failure. +/// +/// You can pass a closure to do any arbitrary custom matching to the error inside result. +/// The closure only gets called when the result is failure. +public func beFailure( + test: ((Failure) -> Void)? = nil +) -> Matcher> { + return Matcher.define { expression in + var rawMessage = "be " + if test != nil { + rawMessage += " that satisfies block" + } + let message = ExpectationMessage.expectedActualValueTo(rawMessage) + + guard case let .failure(error)? = try expression.evaluate() else { + return MatcherResult(status: .doesNotMatch, message: message) + } + + var matches = true + if let test = test { + let assertions = gatherFailingExpectations { + test(error) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + + return MatcherResult(bool: matches, message: message) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift new file mode 100644 index 0000000..19bf4e9 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -0,0 +1,23 @@ +/// A Nimble matcher that succeeds when the actual value is Void. +public func beVoid() -> Matcher<()> { + return Matcher.simpleNilable("be void") { actualExpression in + let actualValue: ()? = try actualExpression.evaluate() + return MatcherStatus(bool: actualValue != nil) + } +} + +public func == (lhs: SyncExpectation<()>, rhs: ()) { + lhs.to(beVoid()) +} + +public func == (lhs: AsyncExpectation<()>, rhs: ()) async { + await lhs.to(beVoid()) +} + +public func != (lhs: SyncExpectation<()>, rhs: ()) { + lhs.toNot(beVoid()) +} + +public func != (lhs: AsyncExpectation<()>, rhs: ()) async { + await lhs.toNot(beVoid()) +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeWithin.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeWithin.swift new file mode 100644 index 0000000..a4e2d7c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeWithin.swift @@ -0,0 +1,21 @@ +/// A Nimble matcher that succeeds when the actual value is within given range. +public func beWithin(_ range: Range) -> Matcher { + let errorMessage = "be within range <(\(range.lowerBound)..<\(range.upperBound))>" + return Matcher.simple(errorMessage) { actualExpression in + if let actual = try actualExpression.evaluate() { + return MatcherStatus(bool: range.contains(actual)) + } + return .fail + } +} + +/// A Nimble matcher that succeeds when the actual value is within given range. +public func beWithin(_ range: ClosedRange) -> Matcher { + let errorMessage = "be within range <(\(range.lowerBound)...\(range.upperBound))>" + return Matcher.simple(errorMessage) { actualExpression in + if let actual = try actualExpression.evaluate() { + return MatcherStatus(bool: range.contains(actual)) + } + return .fail + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift new file mode 100644 index 0000000..05e1b82 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -0,0 +1,57 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual sequence's first element +/// is equal to the expected value. +public func beginWith(_ startingElement: S.Element) -> Matcher where S.Element: Equatable { + return Matcher.simple("begin with <\(startingElement)>") { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { return .fail } + + var actualGenerator = actualValue.makeIterator() + return MatcherStatus(bool: actualGenerator.next() == startingElement) + } +} + +/// A Nimble matcher that succeeds when the actual collection's first element +/// is equal to the expected object. +public func beginWith(_ startingElement: Any) -> Matcher { + return Matcher.simple("begin with <\(startingElement)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + guard collection.count > 0 else { return .doesNotMatch } + #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) + let collectionValue = collection.object(at: 0) as AnyObject + #else + guard let collectionValue = collection.object(at: 0) as? NSObject else { + return .fail + } + #endif + return MatcherStatus(bool: collectionValue.isEqual(startingElement)) + } +} + +/// A Nimble matcher that succeeds when the actual string contains expected substring +/// where the expected substring's location is zero. +public func beginWith(_ startingSubstring: String) -> Matcher { + return Matcher.simple("begin with <\(startingSubstring)>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + return MatcherStatus(bool: actual.hasPrefix(startingSubstring)) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func beginWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBMatcher { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { + let expr = actualExpression.cast { $0 as? String } + // swiftlint:disable:next force_cast + return try beginWith(expected as! String).satisfies(expr).toObjectiveC() + } else { + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return try beginWith(expected).satisfies(expr).toObjectiveC() + } + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift new file mode 100644 index 0000000..8ff068d --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeginWithPrefix.swift @@ -0,0 +1,39 @@ +/// A Nimble matcher that succeeds when the exepected sequence is a prefix of the actual sequence. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854218-starts +public func beginWith(prefix expectedPrefix: Seq2?) + -> Matcher where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { + return Matcher.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + case (nil, _?): + return MatcherResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return MatcherResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = actual.starts(with: expected) + return MatcherResult(bool: matches, message: msg) + } + } +} + +/// A Nimble matcher that succeeds when the expected sequence is the prefix of the actual sequence, using the given matcher as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2996828-starts +public func beginWith( + prefix expectedPrefix: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Matcher { + return Matcher.define("begin with <\(stringify(expectedPrefix))>") { (actualExpression, msg) in + let actualPrefix = try actualExpression.evaluate() + switch (expectedPrefix, actualPrefix) { + case (nil, _?): + return MatcherResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return MatcherResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = actual.starts(with: expected, by: areEquivalent) + return MatcherResult(bool: matches, message: msg) + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift b/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift new file mode 100644 index 0000000..555d4d1 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -0,0 +1,137 @@ +#if canImport(Foundation) +import Foundation +#endif + +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. +public func contain(_ items: S.Element...) -> Matcher where S.Element: Equatable { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual sequence contains the expected values. +public func contain(_ items: [S.Element]) -> Matcher where S.Element: Equatable { + return Matcher.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) + } + return MatcherStatus(bool: matches) + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: S.Element...) -> Matcher where S.Element: Equatable { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [S.Element]) -> Matcher where S.Element: Equatable { + return Matcher.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) + } + return MatcherStatus(bool: matches) + } +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: S.Element...) -> Matcher where S.Element: Equatable { + return contain(items) +} + +/// A Nimble matcher that succeeds when the actual set contains the expected values. +public func contain(_ items: [S.Element]) -> Matcher where S.Element: Equatable { + return Matcher.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { + return actual.contains($0) + } + return MatcherStatus(bool: matches) + } +} + +/// A Nimble matcher that succeeds when the actual string contains the expected substring. +public func contain(_ substrings: String...) -> Matcher { + return contain(substrings) +} + +public func contain(_ substrings: [String]) -> Matcher { + return Matcher.simple("contain <\(arrayAsString(substrings))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { + let range = actual.range(of: $0) + return range != nil && !range!.isEmpty + } + return MatcherStatus(bool: matches) + } +} + +#if canImport(Foundation) +/// A Nimble matcher that succeeds when the actual string contains the expected substring. +public func contain(_ substrings: NSString...) -> Matcher { + return contain(substrings) +} + +public func contain(_ substrings: [NSString]) -> Matcher { + return Matcher.simple("contain <\(arrayAsString(substrings))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = substrings.allSatisfy { actual.range(of: $0.description).length != 0 } + return MatcherStatus(bool: matches) + } +} +#endif + +/// A Nimble matcher that succeeds when the actual collection contains the expected object. +public func contain(_ items: Any?...) -> Matcher { + return contain(items) +} + +public func contain(_ items: [Any?]) -> Matcher { + return Matcher.simple("contain <\(arrayAsString(items))>") { actualExpression in + guard let actual = try actualExpression.evaluate() else { return .fail } + + let matches = items.allSatisfy { item in + return item.map { actual.contains($0) } ?? false + } + return MatcherStatus(bool: matches) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func containMatcher(_ expected: [NSObject]) -> NMBMatcher { + return NMBMatcher { actualExpression in + let location = actualExpression.location + let actualValue = try actualExpression.evaluate() + if let value = actualValue as? NMBContainer { + let expr = Expression(expression: ({ value as NMBContainer }), location: location) + + // A straightforward cast on the array causes this to crash, so we have to cast the individual items + let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) + return try contain(expectedOptionals).satisfies(expr).toObjectiveC() + } else if let value = actualValue as? NSString { + let expr = Expression(expression: ({ value as String }), location: location) + // swiftlint:disable:next force_cast + return try contain(expected as! [String]).satisfies(expr).toObjectiveC() + } + + let message: ExpectationMessage + if actualValue != nil { + message = ExpectationMessage.expectedActualValueTo( + "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("contain <\(arrayAsString(expected))>") + .appendedBeNilHint() + } + return NMBMatcherResult(status: .fail, message: message.toObjectiveC()) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift new file mode 100644 index 0000000..68cc753 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift @@ -0,0 +1,82 @@ +public func containElementSatisfying( + _ matcher: @escaping ((S.Element) -> Bool), _ matcherDescription: String = "" +) -> Matcher { + return Matcher.define { actualExpression in + let message: ExpectationMessage + if matcherDescription == "" { + message = .expectedTo("find object in collection that satisfies matcher") + } else { + message = .expectedTo("find object in collection \(matcherDescription)") + } + + if let sequence = try actualExpression.evaluate() { + for object in sequence where matcher(object) { + return MatcherResult(bool: true, message: message) + } + + return MatcherResult(bool: false, message: message) + } + + return MatcherResult(status: .fail, message: message) + } +} + +public func containElementSatisfying( + _ matcher: @escaping ((S.Element) async -> Bool), _ matcherDescription: String = "" +) -> AsyncMatcher { + return AsyncMatcher.define { actualExpression in + let message: ExpectationMessage + if matcherDescription == "" { + message = .expectedTo("find object in collection that satisfies matcher") + } else { + message = .expectedTo("find object in collection \(matcherDescription)") + } + + if let sequence = try await actualExpression.evaluate() { + for object in sequence where await matcher(object) { + return MatcherResult(bool: true, message: message) + } + + return MatcherResult(bool: false, message: message) + } + + return MatcherResult(status: .fail, message: message) + } +} + +#if canImport(Darwin) +import class Foundation.NSObject +import struct Foundation.NSFastEnumerationIterator +import protocol Foundation.NSFastEnumeration + +extension NMBMatcher { + @objc public class func containElementSatisfyingMatcher(_ matcher: @escaping ((NSObject) -> Bool)) -> NMBMatcher { + return NMBMatcher { actualExpression in + let value = try actualExpression.evaluate() + guard let enumeration = value as? NSFastEnumeration else { + let message = ExpectationMessage.fail( + "containElementSatisfying must be provided an NSFastEnumeration object" + ) + return NMBMatcherResult(status: .fail, message: message.toObjectiveC()) + } + + let message = ExpectationMessage + .expectedTo("find object in collection that satisfies matcher") + .toObjectiveC() + + var iterator = NSFastEnumerationIterator(enumeration) + while let item = iterator.next() { + guard let object = item as? NSObject else { + continue + } + + if matcher(object) { + return NMBMatcherResult(status: .matches, message: message) + } + } + + return NMBMatcherResult(status: .doesNotMatch, message: message) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift b/Pods/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift new file mode 100644 index 0000000..39b2dbf --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ElementsEqual.swift @@ -0,0 +1,42 @@ +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain the same elements in +/// the same order. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2854213-elementsequal +public func elementsEqual( + _ expectedValue: Seq2? +) -> Matcher where Seq1.Element: Equatable, Seq1.Element == Seq2.Element { + return Matcher.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return MatcherResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return MatcherResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = expected.elementsEqual(actual) + return MatcherResult(bool: matches, message: msg) + } + } +} + +/// A Nimble matcher that succeeds when the actual sequence and the exepected sequence contain equivalent elements in +/// the same order, using the given matcher as the equivalence test. +/// +/// This is a matcher abstraction for https://developer.apple.com/documentation/swift/sequence/2949668-elementsequal +public func elementsEqual( + _ expectedValue: Seq2?, + by areEquivalent: @escaping (Seq1.Element, Seq2.Element) -> Bool +) -> Matcher { + return Matcher.define("elementsEqual <\(stringify(expectedValue))>") { (actualExpression, msg) in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return MatcherResult(status: .fail, message: msg.appendedBeNilHint()) + case (nil, nil), (_, nil): + return MatcherResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = actual.elementsEqual(expected, by: areEquivalent) + return MatcherResult(bool: matches, message: msg) + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift new file mode 100644 index 0000000..0b61da9 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -0,0 +1,67 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual sequence's last element +/// is equal to the expected value. +public func endWith(_ endingElement: S.Element) -> Matcher where S.Element: Equatable { + return Matcher.simple("end with <\(endingElement)>") { actualExpression in + guard let actualValue = try actualExpression.evaluate() else { return .fail } + + var actualGenerator = actualValue.makeIterator() + var lastItem: S.Element? + var item: S.Element? + repeat { + lastItem = item + item = actualGenerator.next() + } while(item != nil) + + return MatcherStatus(bool: lastItem == endingElement) + } +} + +/// A Nimble matcher that succeeds when the actual collection's last element +/// is equal to the expected object. +public func endWith(_ endingElement: Any) -> Matcher { + return Matcher.simple("end with <\(endingElement)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + + guard collection.count > 0 else { return MatcherStatus(bool: false) } + #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) + let collectionValue = collection.object(at: collection.count - 1) as AnyObject + #else + guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { + return .fail + } + #endif + + return MatcherStatus(bool: collectionValue.isEqual(endingElement)) + } +} + +/// A Nimble matcher that succeeds when the actual string contains the expected substring +/// where the expected substring's location is the actual string's length minus the +/// expected substring's length. +public func endWith(_ endingSubstring: String) -> Matcher { + return Matcher.simple("end with <\(endingSubstring)>") { actualExpression in + guard let collection = try actualExpression.evaluate() else { return .fail } + + return MatcherStatus(bool: collection.hasSuffix(endingSubstring)) + } +} + +#if canImport(Darwin) +extension NMBMatcher { + @objc public class func endWithMatcher(_ expected: Any) -> NMBMatcher { + return NMBMatcher { actualExpression in + let actual = try actualExpression.evaluate() + if actual is String { + let expr = actualExpression.cast { $0 as? String } + // swiftlint:disable:next force_cast + return try endWith(expected as! String).satisfies(expr).toObjectiveC() + } else { + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return try endWith(expected).satisfies(expr).toObjectiveC() + } + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Equal+Tuple.swift b/Pods/Nimble/Sources/Nimble/Matchers/Equal+Tuple.swift new file mode 100644 index 0000000..17b2f2e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Equal+Tuple.swift @@ -0,0 +1,198 @@ +// swiftlint:disable large_tuple vertical_whitespace + +// MARK: Tuple2 + +/// A Nimble matcher that succeeds when the actual tuple is equal to the expected tuple. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: (T1, T2)? +) -> Matcher<(T1, T2)> { + equal(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<(T1, T2)>, + rhs: (T1, T2)? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<(T1, T2)>, + rhs: (T1, T2)? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<(T1, T2)>, + rhs: (T1, T2)? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<(T1, T2)>, + rhs: (T1, T2)? +) async { + await lhs.toNot(equal(rhs)) +} + +// MARK: Tuple3 + +/// A Nimble matcher that succeeds when the actual tuple is equal to the expected tuple. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: (T1, T2, T3)? +) -> Matcher<(T1, T2, T3)> { + equal(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<(T1, T2, T3)>, + rhs: (T1, T2, T3)? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<(T1, T2, T3)>, + rhs: (T1, T2, T3)? +) async { + await lhs.to(equal(rhs)) +} + + +public func != ( + lhs: SyncExpectation<(T1, T2, T3)>, + rhs: (T1, T2, T3)? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<(T1, T2, T3)>, + rhs: (T1, T2, T3)? +) async { + await lhs.toNot(equal(rhs)) +} + + +// MARK: Tuple4 + +/// A Nimble matcher that succeeds when the actual tuple is equal to the expected tuple. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: (T1, T2, T3, T4)? +) -> Matcher<(T1, T2, T3, T4)> { + equal(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<(T1, T2, T3, T4)>, + rhs: (T1, T2, T3, T4)? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<(T1, T2, T3, T4)>, + rhs: (T1, T2, T3, T4)? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<(T1, T2, T3, T4)>, + rhs: (T1, T2, T3, T4)? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<(T1, T2, T3, T4)>, + rhs: (T1, T2, T3, T4)? +) async { + await lhs.toNot(equal(rhs)) +} + + +// MARK: Tuple5 + +/// A Nimble matcher that succeeds when the actual tuple is equal to the expected tuple. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: (T1, T2, T3, T4, T5)? +) -> Matcher<(T1, T2, T3, T4, T5)> { + equal(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<(T1, T2, T3, T4, T5)>, + rhs: (T1, T2, T3, T4, T5)? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<(T1, T2, T3, T4, T5)>, + rhs: (T1, T2, T3, T4, T5)? +) async { + await lhs.to(equal(rhs)) +} + + +public func != ( + lhs: SyncExpectation<(T1, T2, T3, T4, T5)>, + rhs: (T1, T2, T3, T4, T5)? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<(T1, T2, T3, T4, T5)>, + rhs: (T1, T2, T3, T4, T5)? +) async { + await lhs.toNot(equal(rhs)) +} + + +// MARK: Tuple6 + +/// A Nimble matcher that succeeds when the actual tuple is equal to the expected tuple. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: (T1, T2, T3, T4, T5, T6)? +) -> Matcher<(T1, T2, T3, T4, T5, T6)> { + equal(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<(T1, T2, T3, T4, T5, T6)>, + rhs: (T1, T2, T3, T4, T5, T6)? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<(T1, T2, T3, T4, T5, T6)>, + rhs: (T1, T2, T3, T4, T5, T6)? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<(T1, T2, T3, T4, T5, T6)>, + rhs: (T1, T2, T3, T4, T5, T6)? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<(T1, T2, T3, T4, T5, T6)>, + rhs: (T1, T2, T3, T4, T5, T6)? +) async { + await lhs.toNot(equal(rhs)) +} + +// swiftlint:enable large_tuple vertical_whitespace diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Equal+TupleArray.swift b/Pods/Nimble/Sources/Nimble/Matchers/Equal+TupleArray.swift new file mode 100644 index 0000000..eff6168 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Equal+TupleArray.swift @@ -0,0 +1,204 @@ +// swiftlint:disable large_tuple + +// MARK: Tuple2 Array + +/// A Nimble matcher that succeeds when the actual array of tuples is equal to the expected array of tuples. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: [(T1, T2)]? +) -> Matcher<[(T1, T2)]> { + equalTupleArray(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<[(T1, T2)]>, + rhs: [(T1, T2)]? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<[(T1, T2)]>, + rhs: [(T1, T2)]? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<[(T1, T2)]>, + rhs: [(T1, T2)]? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<[(T1, T2)]>, + rhs: [(T1, T2)]? +) async { + await lhs.toNot(equal(rhs)) +} + +// MARK: Tuple3 Array + +/// A Nimble matcher that succeeds when the actual array of tuples is equal to the expected array of tuples. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: [(T1, T2, T3)]? +) -> Matcher<[(T1, T2, T3)]> { + equalTupleArray(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<[(T1, T2, T3)]>, + rhs: [(T1, T2, T3)]? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<[(T1, T2, T3)]>, + rhs: [(T1, T2, T3)]? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<[(T1, T2, T3)]>, + rhs: [(T1, T2, T3)]? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<[(T1, T2, T3)]>, + rhs: [(T1, T2, T3)]? +) async { + await lhs.toNot(equal(rhs)) +} + +// MARK: Tuple4 Array + +/// A Nimble matcher that succeeds when the actual array of tuples is equal to the expected array of tuples. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: [(T1, T2, T3, T4)]? +) -> Matcher<[(T1, T2, T3, T4)]> { + equalTupleArray(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<[(T1, T2, T3, T4)]>, + rhs: [(T1, T2, T3, T4)]? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<[(T1, T2, T3, T4)]>, + rhs: [(T1, T2, T3, T4)]? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<[(T1, T2, T3, T4)]>, + rhs: [(T1, T2, T3, T4)]? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<[(T1, T2, T3, T4)]>, + rhs: [(T1, T2, T3, T4)]? +) async { + await lhs.toNot(equal(rhs)) +} + +// MARK: Tuple5 Array + +/// A Nimble matcher that succeeds when the actual array of tuples is equal to the expected array of tuples. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: [(T1, T2, T3, T4, T5)]? +) -> Matcher<[(T1, T2, T3, T4, T5)]> { + equalTupleArray(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<[(T1, T2, T3, T4, T5)]>, + rhs: [(T1, T2, T3, T4, T5)]? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<[(T1, T2, T3, T4, T5)]>, + rhs: [(T1, T2, T3, T4, T5)]? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<[(T1, T2, T3, T4, T5)]>, + rhs: [(T1, T2, T3, T4, T5)]? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<[(T1, T2, T3, T4, T5)]>, + rhs: [(T1, T2, T3, T4, T5)]? +) async { + await lhs.toNot(equal(rhs)) +} + +// MARK: Tuple6 Array + +/// A Nimble matcher that succeeds when the actual array of tuples is equal to the expected array of tuples. +/// Values can support equal by supporting the Equatable protocol. +public func equal( + _ expectedValue: [(T1, T2, T3, T4, T5, T6)]? +) -> Matcher<[(T1, T2, T3, T4, T5, T6)]> { + equalTupleArray(expectedValue, by: ==) +} + +public func == ( + lhs: SyncExpectation<[(T1, T2, T3, T4, T5, T6)]>, + rhs: [(T1, T2, T3, T4, T5, T6)]? +) { + lhs.to(equal(rhs)) +} + +public func == ( + lhs: AsyncExpectation<[(T1, T2, T3, T4, T5, T6)]>, + rhs: [(T1, T2, T3, T4, T5, T6)]? +) async { + await lhs.to(equal(rhs)) +} + +public func != ( + lhs: SyncExpectation<[(T1, T2, T3, T4, T5, T6)]>, + rhs: [(T1, T2, T3, T4, T5, T6)]? +) { + lhs.toNot(equal(rhs)) +} + +public func != ( + lhs: AsyncExpectation<[(T1, T2, T3, T4, T5, T6)]>, + rhs: [(T1, T2, T3, T4, T5, T6)]? +) async { + await lhs.toNot(equal(rhs)) +} + +// swiftlint:enable large_tuple + +// MARK: Implementation Helpers + +private func equalTupleArray( + _ expectedValue: [(Tuple)]?, + by areTuplesEquivalent: @escaping (Tuple, Tuple) -> Bool +) -> Matcher<[Tuple]> { + equal(expectedValue) { + $0.elementsEqual($1, by: areTuplesEquivalent) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift b/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift new file mode 100644 index 0000000..4ec21e3 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -0,0 +1,272 @@ +internal func equal( + _ expectedValue: T?, + by areEquivalent: @escaping (T, T) -> Bool +) -> Matcher { + Matcher.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in + let actualValue = try actualExpression.evaluate() + switch (expectedValue, actualValue) { + case (nil, _?): + return MatcherResult(status: .fail, message: msg.appendedBeNilHint()) + case (_, nil): + return MatcherResult(status: .fail, message: msg) + case (let expected?, let actual?): + let matches = areEquivalent(expected, actual) + return MatcherResult(bool: matches, message: msg) + } + } +} + +/// A Nimble matcher that succeeds when the actual value is equal to the expected value. +/// Values can support equal by supporting the Equatable protocol. +/// +/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). +public func equal(_ expectedValue: T) -> Matcher { + equal(expectedValue as T?) +} + +/// A Nimble matcher allowing comparison of collection with optional type +public func equal(_ expectedValue: [T?]) -> Matcher<[T?]> { + Matcher.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in + guard let actualValue = try actualExpression.evaluate() else { + return MatcherResult( + status: .fail, + message: msg.appendedBeNilHint() + ) + } + + let matches = expectedValue == actualValue + return MatcherResult(bool: matches, message: msg) + } +} + +/// A Nimble matcher that succeeds when the actual value is equal to the expected value. +/// Values can support equal by supporting the Equatable protocol. +/// +/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). +public func equal(_ expectedValue: T?) -> Matcher { + equal(expectedValue, by: ==) +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(_ expectedValue: Set) -> Matcher> { + equal(expectedValue as Set?) +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(_ expectedValue: Set?) -> Matcher> { + equal(expectedValue, stringify: { stringify($0) }) +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(_ expectedValue: Set) -> Matcher> { + equal(expectedValue as Set?) +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(_ expectedValue: Set?) -> Matcher> { + equal(expectedValue, stringify: { set in + stringify(set.map { Array($0).sorted(by: <) }) + }) +} + +private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) -> String) -> Matcher> { + Matcher { actualExpression in + var errorMessage: ExpectationMessage = + .expectedActualValueTo("equal <\(stringify(expectedValue))>") + + guard let expectedValue = expectedValue else { + return MatcherResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + guard let actualValue = try actualExpression.evaluate() else { + return MatcherResult( + status: .fail, + message: errorMessage.appendedBeNilHint() + ) + } + + errorMessage = .expectedCustomValueTo( + "equal <\(stringify(expectedValue))>", + actual: "<\(stringify(actualValue))>" + ) + + if expectedValue == actualValue { + return MatcherResult( + status: .matches, + message: errorMessage + ) + } + + let missing = expectedValue.subtracting(actualValue) + if missing.count > 0 { + errorMessage = errorMessage.appended(message: ", missing <\(stringify(missing))>") + } + + let extra = actualValue.subtracting(expectedValue) + if extra.count > 0 { + errorMessage = errorMessage.appended(message: ", extra <\(stringify(extra))>") + } + return MatcherResult( + status: .doesNotMatch, + message: errorMessage + ) + } +} + +/// A Nimble matcher that succeeds when the actual dictionary is equal to the expected dictionary +public func equal(_ expectedValue: [K: V?]) -> Matcher<[K: V]> { + Matcher.define("equal <\(stringify(expectedValue))>") { actualExpression, msg in + guard let actualValue = try actualExpression.evaluate() else { + return MatcherResult( + status: .fail, + message: msg.appendedBeNilHint() + ) + } + + let matches = expectedValue == actualValue + return MatcherResult(bool: matches, message: msg) + } +} + +public func == (lhs: SyncExpectation, rhs: T) { + lhs.to(equal(rhs)) +} + +public func == (lhs: SyncExpectation, rhs: T?) { + lhs.to(equal(rhs)) +} + +public func != (lhs: SyncExpectation, rhs: T) { + lhs.toNot(equal(rhs)) +} + +public func != (lhs: SyncExpectation, rhs: T?) { + lhs.toNot(equal(rhs)) +} + +public func == (lhs: SyncExpectation<[T]>, rhs: [T]?) { + lhs.to(equal(rhs)) +} + +public func != (lhs: SyncExpectation<[T]>, rhs: [T]?) { + lhs.toNot(equal(rhs)) +} + +public func == (lhs: SyncExpectation>, rhs: Set) { + lhs.to(equal(rhs)) +} + +public func == (lhs: SyncExpectation>, rhs: Set?) { + lhs.to(equal(rhs)) +} + +public func != (lhs: SyncExpectation>, rhs: Set) { + lhs.toNot(equal(rhs)) +} + +public func != (lhs: SyncExpectation>, rhs: Set?) { + lhs.toNot(equal(rhs)) +} + +public func == (lhs: SyncExpectation>, rhs: Set) { + lhs.to(equal(rhs)) +} + +public func == (lhs: SyncExpectation>, rhs: Set?) { + lhs.to(equal(rhs)) +} + +public func != (lhs: SyncExpectation>, rhs: Set) { + lhs.toNot(equal(rhs)) +} + +public func != (lhs: SyncExpectation>, rhs: Set?) { + lhs.toNot(equal(rhs)) +} + +public func == (lhs: SyncExpectation<[T: C]>, rhs: [T: C]?) { + lhs.to(equal(rhs)) +} + +public func != (lhs: SyncExpectation<[T: C]>, rhs: [T: C]?) { + lhs.toNot(equal(rhs)) +} + +public func == (lhs: AsyncExpectation, rhs: T) async { + await lhs.to(equal(rhs)) +} + +public func == (lhs: AsyncExpectation, rhs: T?) async { + await lhs.to(equal(rhs)) +} + +public func != (lhs: AsyncExpectation, rhs: T) async { + await lhs.toNot(equal(rhs)) +} + +public func != (lhs: AsyncExpectation, rhs: T?) async { + await lhs.toNot(equal(rhs)) +} + +public func == (lhs: AsyncExpectation<[T]>, rhs: [T]?) async { + await lhs.to(equal(rhs)) +} + +public func != (lhs: AsyncExpectation<[T]>, rhs: [T]?) async { + await lhs.toNot(equal(rhs)) +} + +public func == (lhs: AsyncExpectation>, rhs: Set) async { + await lhs.to(equal(rhs)) +} + +public func == (lhs: AsyncExpectation>, rhs: Set?) async { + await lhs.to(equal(rhs)) +} + +public func != (lhs: AsyncExpectation>, rhs: Set) async { + await lhs.toNot(equal(rhs)) +} + +public func != (lhs: AsyncExpectation>, rhs: Set?) async { + await lhs.toNot(equal(rhs)) +} + +public func == (lhs: AsyncExpectation>, rhs: Set) async { + await lhs.to(equal(rhs)) +} + +public func == (lhs: AsyncExpectation>, rhs: Set?) async { + await lhs.to(equal(rhs)) +} + +public func != (lhs: AsyncExpectation>, rhs: Set) async { + await lhs.toNot(equal(rhs)) +} + +public func != (lhs: AsyncExpectation>, rhs: Set?) async { + await lhs.toNot(equal(rhs)) +} + +public func == (lhs: AsyncExpectation<[T: C]>, rhs: [T: C]?) async { + await lhs.to(equal(rhs)) +} + +public func != (lhs: AsyncExpectation<[T: C]>, rhs: [T: C]?) async { + await lhs.toNot(equal(rhs)) +} + +#if canImport(Darwin) +import class Foundation.NSObject + +extension NMBMatcher { + @objc public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { + NMBMatcher { actualExpression in + try equal(expected).satisfies(actualExpression).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift new file mode 100644 index 0000000..7b476d7 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -0,0 +1,73 @@ +// The `haveCount` matchers do not print the full string representation of the collection value, +// instead they only print the type name and the expected count. This makes it easier to understand +// the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. +// The representation of the collection content is provided in a new line as an `extendedMessage`. + +/// A Nimble matcher that succeeds when the actual Collection's count equals +/// the expected value +public func haveCount(_ expectedValue: Int) -> Matcher { + return Matcher.define { actualExpression in + if let actualValue = try actualExpression.evaluate() { + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + actual: "\(actualValue.count)" + ) + .appended(details: "Actual Value: \(stringify(actualValue))") + + let result = expectedValue == actualValue.count + return MatcherResult(bool: result, message: message) + } else { + return MatcherResult(status: .fail, message: .fail("")) + } + } +} + +/// A Nimble matcher that succeeds when the actual collection's count equals +/// the expected value +public func haveCount(_ expectedValue: Int) -> Matcher { + return Matcher { actualExpression in + if let actualValue = try actualExpression.evaluate() { + let message = ExpectationMessage + .expectedCustomValueTo( + "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", + actual: "\(actualValue.count). Actual Value: \(stringify(actualValue))" + ) + + let result = expectedValue == actualValue.count + return MatcherResult(bool: result, message: message) + } else { + return MatcherResult(status: .fail, message: .fail("")) + } + } +} + +#if canImport(Darwin) +import Foundation + +extension NMBMatcher { + @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBMatcher { + return NMBMatcher { actualExpression in + let location = actualExpression.location + let actualValue = try actualExpression.evaluate() + if let value = actualValue as? NMBCollection { + let expr = Expression(expression: ({ value as NMBCollection}), location: location) + return try haveCount(expected.intValue).satisfies(expr).toObjectiveC() + } + + let message: ExpectationMessage + if let actualValue = actualValue { + message = ExpectationMessage.expectedCustomValueTo( + "get type of NSArray, NSSet, NSDictionary, or NSHashTable", + actual: "\(String(describing: type(of: actualValue)))" + ) + } else { + message = ExpectationMessage + .expectedActualValueTo("have a collection with count \(stringify(expected.intValue))") + .appendedBeNilHint() + } + return NMBMatcherResult(status: .fail, message: message.toObjectiveC()) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Map.swift b/Pods/Nimble/Sources/Nimble/Matchers/Map.swift new file mode 100644 index 0000000..7132ab3 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Map.swift @@ -0,0 +1,27 @@ +/// `map` works by transforming the expression to a value that the given matcher uses. +/// +/// For example, you might only care that a particular property on a method equals some other value. +/// So, you could write `expect(myObject).to(lens(\.someIntValue, equal(3))`. +/// This is also useful in conjunction with ``satisfyAllOf`` to do a partial equality of an object. +public func map(_ transform: @escaping (T) throws -> U, _ matcher: Matcher) -> Matcher { + Matcher { (received: Expression) in + try matcher.satisfies(received.cast { value in + guard let value else { return nil } + return try transform(value) + }) + } +} + +/// `map` works by transforming the expression to a value that the given matcher uses. +/// +/// For example, you might only care that a particular property on a method equals some other value. +/// So, you could write `expect(myObject).to(lens(\.someIntValue, equal(3))`. +/// This is also useful in conjunction with ``satisfyAllOf`` to do a partial equality of an object. +public func map(_ transform: @escaping (T) async throws -> U, _ matcher: some AsyncableMatcher) -> AsyncMatcher { + AsyncMatcher { (received: AsyncExpression) in + try await matcher.satisfies(received.cast { value in + guard let value else { return nil } + return try await transform(value) + }) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Match.swift b/Pods/Nimble/Sources/Nimble/Matchers/Match.swift new file mode 100644 index 0000000..b634ad3 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Match.swift @@ -0,0 +1,23 @@ +/// A Nimble matcher that succeeds when the actual string satisfies the regular expression +/// described by the expected string. +public func match(_ expectedValue: String?) -> Matcher { + return Matcher.simple("match <\(stringify(expectedValue))>") { actualExpression in + guard let actual = try actualExpression.evaluate(), let regexp = expectedValue else { return .fail } + + let bool = actual.range(of: regexp, options: .regularExpression) != nil + return MatcherStatus(bool: bool) + } +} + +#if canImport(Darwin) +import class Foundation.NSString + +extension NMBMatcher { + @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { + return NMBMatcher { actualExpression in + let actual = actualExpression.cast { $0 as? String } + return try match(expected.description).satisfies(actual).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift new file mode 100644 index 0000000..10ed86b --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift @@ -0,0 +1,68 @@ +/// A Nimble matcher that succeeds when the actual expression evaluates to an +/// error from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparison by _domain and _code. +public func matchError(_ error: T) -> Matcher { + return Matcher.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let message = messageForError( + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) + + var matches = false + if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { + matches = true + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression evaluates to an +/// error from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +public func matchError(_ error: T) -> Matcher { + return Matcher.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let message = messageForError( + postfixMessageVerb: "match", + actualError: actualError, + error: error + ) + + var matches = false + if let actualError = actualError as? T, error == actualError { + matches = true + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression evaluates to an +/// error of the specified type +public func matchError(_ errorType: T.Type) -> Matcher { + return Matcher.define { actualExpression in + let actualError = try actualExpression.evaluate() + + let message = messageForError( + postfixMessageVerb: "match", + actualError: actualError, + errorType: errorType + ) + + var matches = false + if actualError as? T != nil { + matches = true + } + + return MatcherResult(bool: matches, message: message) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Matcher.swift b/Pods/Nimble/Sources/Nimble/Matchers/Matcher.swift new file mode 100644 index 0000000..375419e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Matcher.swift @@ -0,0 +1,324 @@ +// New Matcher API +// + +/// A Matcher is part of the new matcher API that provides assertions to expectations. +/// +/// Given a code snippet: +/// +/// expect(1).to(equal(2)) +/// ^^^^^^^^ +/// Called a "matcher" +/// +/// A matcher consists of two parts a constructor function and the Matcher. +/// +/// The Matcher provide the heavy lifting on how to assert against a given value. Internally, +/// matchers are simple wrappers around closures to provide static type information and +/// allow composition and wrapping of existing behaviors. +/// +/// In the 2023 Apple Platform releases (macOS 14, iOS 17, watchOS 10, tvOS 17, visionOS 1), Apple +/// renamed `NSMatcher` to `Matcher`. In response, we decided to rename `Matcher` to +/// `Matcher`. +public struct Matcher { + fileprivate var matcher: (Expression) throws -> MatcherResult + + /// Constructs a matcher that knows how take a given value + public init(_ matcher: @escaping (Expression) throws -> MatcherResult) { + self.matcher = matcher + } + + /// Uses a matcher on a given value to see if it passes the matcher. + /// + /// @param expression The value to run the matcher's logic against + /// @returns A matcher result indicate passing or failing and an associated error message. + public func satisfies(_ expression: Expression) throws -> MatcherResult { + return try matcher(expression) + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "Matcher") +public typealias Predicate = Matcher + +/// Provides convenience helpers to defining matchers +extension Matcher { + /// Like Matcher() constructor, but automatically guard against nil (actual) values + public static func define(matcher: @escaping (Expression) throws -> MatcherResult) -> Matcher { + return Matcher { actual in + return try matcher(actual) + }.requireNonNil + } + + /// Defines a matcher with a default message that can be returned in the closure + /// Also ensures the matcher's actual value cannot pass with `nil` given. + public static func define(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> MatcherResult) -> Matcher { + return Matcher { actual in + return try matcher(actual, .expectedActualValueTo(message)) + }.requireNonNil + } + + /// Defines a matcher with a default message that can be returned in the closure + /// Unlike `define`, this allows nil values to succeed if the given closure chooses to. + public static func defineNilable(_ message: String = "match", matcher: @escaping (Expression, ExpectationMessage) throws -> MatcherResult) -> Matcher { + return Matcher { actual in + return try matcher(actual, .expectedActualValueTo(message)) + } + } +} + +extension Matcher { + /// Provides a simple matcher definition that provides no control over the predefined + /// error message. + /// + /// Also ensures the matcher's actual value cannot pass with `nil` given. + public static func simple(_ message: String = "match", matcher: @escaping (Expression) throws -> MatcherStatus) -> Matcher { + return Matcher { actual in + return MatcherResult(status: try matcher(actual), message: .expectedActualValueTo(message)) + }.requireNonNil + } + + /// Provides a simple matcher definition that provides no control over the predefined + /// error message. + /// + /// Unlike `simple`, this allows nil values to succeed if the given closure chooses to. + public static func simpleNilable(_ message: String = "match", matcher: @escaping (Expression) throws -> MatcherStatus) -> Matcher { + return Matcher { actual in + return MatcherResult(status: try matcher(actual), message: .expectedActualValueTo(message)) + } + } +} + +/// The Expectation style intended for comparison to a MatcherStatus. +public enum ExpectationStyle { + case toMatch, toNotMatch +} + +/// The value that a Matcher returns to describe if the given (actual) value matches the +/// matcher. +public struct MatcherResult { + /// Status indicates if the matcher matches, does not match, or fails. + public var status: MatcherStatus + /// The error message that can be displayed if it does not match + public var message: ExpectationMessage + + /// Constructs a new MatcherResult with a given status and error message + public init(status: MatcherStatus, message: ExpectationMessage) { + self.status = status + self.message = message + } + + /// Shorthand to MatcherResult(status: MatcherStatus(bool: bool), message: message) + public init(bool: Bool, message: ExpectationMessage) { + self.status = MatcherStatus(bool: bool) + self.message = message + } + + /// Converts the result to a boolean based on what the expectation intended + public func toBoolean(expectation style: ExpectationStyle) -> Bool { + return status.toBoolean(expectation: style) + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "MatcherResult") +public typealias PredicateResult = MatcherResult + +/// MatcherStatus is a trinary that indicates if a Matcher matches a given value or not +public enum MatcherStatus { + /// Matches indicates if the matcher / matcher passes with the given value + /// + /// For example, `equals(1)` returns `.matches` for `expect(1).to(equal(1))`. + case matches + /// DoesNotMatch indicates if the matcher fails with the given value, but *would* + /// succeed if the expectation was inverted. + /// + /// For example, `equals(2)` returns `.doesNotMatch` for `expect(1).toNot(equal(2))`. + case doesNotMatch + /// Fail indicates the matcher will never satisfy with the given value in any case. + /// A perfect example is that most matchers fail whenever given `nil`. + /// + /// Using `equal(1)` fails both `expect(nil).to(equal(1))` and `expect(nil).toNot(equal(1))`. + /// Note: Matcher's `requireNonNil` property will also provide this feature mostly for free. + /// Your matcher will still need to guard against nils, but error messaging will be + /// handled for you. + case fail + + /// Converts a boolean to either .matches (if true) or .doesNotMatch (if false). + public init(bool matches: Bool) { + if matches { + self = .matches + } else { + self = .doesNotMatch + } + } + + private func shouldMatch() -> Bool { + switch self { + case .matches: return true + case .doesNotMatch, .fail: return false + } + } + + private func shouldNotMatch() -> Bool { + switch self { + case .doesNotMatch: return true + case .matches, .fail: return false + } + } + + /// Converts the MatcherStatus result to a boolean based on what the expectation intended + internal func toBoolean(expectation style: ExpectationStyle) -> Bool { + if style == .toMatch { + return shouldMatch() + } else { + return shouldNotMatch() + } + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "MatcherStatus") +public typealias PredicateStatus = MatcherStatus + +extension Matcher { + // Someday, make this public? Needs documentation + internal func after(f: @escaping (Expression, MatcherResult) throws -> MatcherResult) -> Matcher { + // swiftlint:disable:previous identifier_name + return Matcher { actual -> MatcherResult in + let result = try self.satisfies(actual) + return try f(actual, result) + } + } + + /// Returns a new Matcher based on the current one that always fails if nil is given as + /// the actual value. + public var requireNonNil: Matcher { + return after { actual, result in + if try actual.evaluate() == nil { + return MatcherResult( + status: .fail, + message: result.message.appendedBeNilHint() + ) + } + return result + } + } +} + +#if canImport(Darwin) +import class Foundation.NSObject + +public typealias MatcherBlock = (_ actualExpression: Expression) throws -> NMBMatcherResult + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "MatcherBlock") +public typealias PredicateBlock = MatcherBlock + +public class NMBMatcher: NSObject { + private let matcher: MatcherBlock + + public init(matcher: @escaping MatcherBlock) { + self.matcher = matcher + } + + @available(*, deprecated, renamed: "init(matcher:)") + public convenience init(predicate: @escaping MatcherBlock) { + self.init(matcher: predicate) + } + + func satisfies(_ expression: @escaping () throws -> NSObject?, location: SourceLocation) -> NMBMatcherResult { + let expr = Expression(expression: expression, location: location) + do { + return try self.matcher(expr) + } catch let error { + return MatcherResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")).toObjectiveC() + } + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "NMBMatcher") +public typealias NMBPredicate = NMBMatcher + +final public class NMBMatcherResult: NSObject { + public var status: NMBMatcherStatus + public var message: NMBExpectationMessage + + public init(status: NMBMatcherStatus, message: NMBExpectationMessage) { + self.status = status + self.message = message + } + + public init(bool success: Bool, message: NMBExpectationMessage) { + self.status = NMBMatcherStatus.from(bool: success) + self.message = message + } + + public func toSwift() -> MatcherResult { + return MatcherResult(status: status.toSwift(), + message: message.toSwift()) + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "NMBMatcherResult") +public typealias NMBPredicateResult = NMBMatcherResult + +extension MatcherResult { + public func toObjectiveC() -> NMBMatcherResult { + return NMBMatcherResult(status: status.toObjectiveC(), message: message.toObjectiveC()) + } +} + +final public class NMBMatcherStatus: NSObject { + private let status: Int + private init(status: Int) { + self.status = status + } + + public static let matches: NMBMatcherStatus = NMBMatcherStatus(status: 0) + public static let doesNotMatch: NMBMatcherStatus = NMBMatcherStatus(status: 1) + public static let fail: NMBMatcherStatus = NMBMatcherStatus(status: 2) + + public override var hash: Int { return self.status.hashValue } + + public override func isEqual(_ object: Any?) -> Bool { + guard let otherMatcher = object as? NMBMatcherStatus else { + return false + } + return self.status == otherMatcher.status + } + + public static func from(status: MatcherStatus) -> NMBMatcherStatus { + switch status { + case .matches: return self.matches + case .doesNotMatch: return self.doesNotMatch + case .fail: return self.fail + } + } + + public static func from(bool success: Bool) -> NMBMatcherStatus { + return self.from(status: MatcherStatus(bool: success)) + } + + public func toSwift() -> MatcherStatus { + switch status { + case NMBMatcherStatus.matches.status: return .matches + case NMBMatcherStatus.doesNotMatch.status: return .doesNotMatch + case NMBMatcherStatus.fail.status: return .fail + default: + internalError("Unhandle status for NMBMatcherStatus") + } + } +} + +/// Provides an easy upgrade path for custom Matchers to be renamed to Matchers +@available(*, deprecated, renamed: "NMBMatcherStatus") +public typealias NMBPredicateStatus = NMBMatcherStatus + +extension MatcherStatus { + public func toObjectiveC() -> NMBMatcherStatus { + return NMBMatcherStatus.from(status: self) + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift new file mode 100644 index 0000000..7d969ad --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -0,0 +1,106 @@ +import Foundation +// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. +#if canImport(Darwin) + import CoreGraphics +#endif + +/// Protocol for types that support contain() matcher. +public protocol NMBContainer { + func contains(_ anObject: Any) -> Bool +} + +#if canImport(Darwin) +// swiftlint:disable:next todo +// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a +// extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet +#endif + +extension NSArray: NMBContainer {} +extension NSSet: NMBContainer {} + +/// Protocol for types that support only beEmpty(), haveCount() matchers +public protocol NMBCollection { + var count: Int { get } +} + +#if canImport(Darwin) +extension NSHashTable: NMBCollection {} // Corelibs Foundation does not include these classes yet +extension NSMapTable: NMBCollection {} +#endif + +extension NSSet: NMBCollection {} +extension NSIndexSet: NMBCollection {} +extension NSDictionary: NMBCollection {} + +/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers +public protocol NMBOrderedCollection: NMBCollection { + func object(at index: Int) -> Any +} + +extension NSArray: NMBOrderedCollection {} + +public protocol NMBDoubleConvertible { + var doubleValue: CDouble { get } +} + +extension NSNumber: NMBDoubleConvertible { +} + +#if !os(WASI) +private let dateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS" + formatter.locale = Locale(identifier: "en_US_POSIX") + + return formatter +}() +#endif + +extension Date: NMBDoubleConvertible { + public var doubleValue: CDouble { + return self.timeIntervalSinceReferenceDate + } +} + +extension NSDate: NMBDoubleConvertible { + public var doubleValue: CDouble { + return self.timeIntervalSinceReferenceDate + } +} + +#if !os(WASI) +extension Date: TestOutputStringConvertible { + public var testDescription: String { + return dateFormatter.string(from: self) + } +} + +extension NSDate: TestOutputStringConvertible { + public var testDescription: String { + return dateFormatter.string(from: Date(timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate)) + } +} +#endif + +#if canImport(Darwin) +/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), +/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. +/// +/// Types that conform to Swift's Comparable protocol will work implicitly too +@objc public protocol NMBComparable { + func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult +} + +extension NSNumber: NMBComparable { + public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast + return compare(otherObject as! NSNumber) + } +} +extension NSString: NMBComparable { + public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { + // swiftlint:disable:next force_cast + return compare(otherObject as! String) + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift new file mode 100644 index 0000000..5144cc1 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -0,0 +1,111 @@ +#if !os(WASI) + +#if canImport(Foundation) +import Foundation + +internal class NotificationCollector { + private(set) var observedNotifications: [Notification] + private(set) var observedNotificationDescriptions: [String] + private let notificationCenter: NotificationCenter + private let names: Set + private var tokens: [NSObjectProtocol] + + required init(notificationCenter: NotificationCenter, names: Set = []) { + self.notificationCenter = notificationCenter + self.observedNotifications = [] + self.observedNotificationDescriptions = [] + self.names = names + self.tokens = [] + } + + func startObserving() { + func addObserver(forName name: Notification.Name?) -> NSObjectProtocol { + return notificationCenter.addObserver(forName: name, object: nil, queue: nil) { [weak self] notification in + // linux-swift gets confused by .append(n) + self?.observedNotifications.append(notification) + self?.observedNotificationDescriptions.append(stringify(notification)) + } + } + + if names.isEmpty { + tokens.append(addObserver(forName: nil)) + } else { + names.forEach { name in + tokens.append(addObserver(forName: name)) + } + } + } + + deinit { + tokens.forEach { token in + notificationCenter.removeObserver(token) + } + } +} + +#if !os(Windows) +private let mainThread = pthread_self() +#else +private let mainThread = Thread.mainThread +#endif + +private func _postNotifications( + _ matcher: Matcher<[Notification]>, + from center: NotificationCenter, + names: Set = [] +) -> Matcher { + _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center, names: names) + collector.startObserving() + var once: Bool = false + + return Matcher { actualExpression in + let collectorNotificationsExpression = Expression( + memoizedExpression: { _ in + return collector.observedNotifications + }, + location: actualExpression.location, + withoutCaching: true + ) + + assert(Thread.isMainThread, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + _ = try actualExpression.evaluate() + } + + let actualValue: String + if collector.observedNotifications.isEmpty { + actualValue = "no notifications" + } else { + actualValue = "<\(stringify(collector.observedNotificationDescriptions))>" + } + + var result = try matcher.satisfies(collectorNotificationsExpression) + result.message = result.message.replacedExpectation { message in + return .expectedCustomValueTo(message.expectedMessage, actual: actualValue) + } + return result + } +} + +public func postNotifications( + _ matcher: Matcher<[Notification]>, + from center: NotificationCenter = .default +) -> Matcher { + _postNotifications(matcher, from: center) +} + +#if os(macOS) +public func postDistributedNotifications( + _ matcher: Matcher<[Notification]>, + from center: DistributedNotificationCenter = .default(), + names: Set +) -> Matcher { + _postNotifications(matcher, from: center, names: names) +} +#endif + +#endif // #if canImport(Foundation) + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift new file mode 100644 index 0000000..2bb9409 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -0,0 +1,222 @@ +// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager +#if canImport(Darwin) && !SWIFT_PACKAGE +import class Foundation.NSObject +import class Foundation.NSDictionary +import class Foundation.NSException + +/// A Nimble matcher that succeeds when the actual expression raises an +/// exception with the specified name, reason, and/or userInfo. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the raised exception. The closure only gets called when an exception +/// is raised. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func raiseException( + named: NSExceptionName? = nil, + reason: String? = nil, + userInfo: NSDictionary? = nil, + closure: ((NSException) -> Void)? = nil +) -> Matcher { + return raiseException(named: named?.rawValue, reason: reason, userInfo: userInfo, closure: closure) +} + +/// A Nimble matcher that succeeds when the actual expression raises an +/// exception with the specified name, reason, and/or userInfo. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the raised exception. The closure only gets called when an exception +/// is raised. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func raiseException( + named: String?, + reason: String? = nil, + userInfo: NSDictionary? = nil, + closure: ((NSException) -> Void)? = nil +) -> Matcher { + return Matcher { actualExpression in + var exception: NSException? + let capture = NMBExceptionCapture(handler: ({ e in + exception = e + }), finally: nil) + + do { + try capture.tryBlockThrows { + _ = try actualExpression.evaluate() + } + } catch { + return MatcherResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) + } + + let message = messageForException( + exception: exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + + let matches = exceptionMatchesNonNilFieldsOrClosure( + exception, + named: named, + reason: reason, + userInfo: userInfo, + closure: closure + ) + return MatcherResult(bool: matches, message: message) + } +} + +internal func messageForException( + exception: NSException?, + named: String?, + reason: String?, + userInfo: NSDictionary?, + closure: ((NSException) -> Void)? +) -> ExpectationMessage { + var rawMessage: String = "raise exception" + + if let named = named { + rawMessage += " with name <\(named)>" + } + if let reason = reason { + rawMessage += " with reason <\(reason)>" + } + if let userInfo = userInfo { + rawMessage += " with userInfo <\(userInfo)>" + } + if closure != nil { + rawMessage += " that satisfies block" + } + if named == nil && reason == nil && userInfo == nil && closure == nil { + rawMessage = "raise any exception" + } + + let actual: String + if let exception = exception { + // swiftlint:disable:next line_length + actual = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" + } else { + actual = "no exception" + } + + return .expectedCustomValueTo(rawMessage, actual: actual) +} + +internal func exceptionMatchesNonNilFieldsOrClosure( + _ exception: NSException?, + named: String?, + reason: String?, + userInfo: NSDictionary?, + closure: ((NSException) -> Void)?) -> Bool { + var matches = false + + if let exception = exception { + matches = true + + if let named = named, exception.name.rawValue != named { + matches = false + } + if reason != nil && exception.reason != reason { + matches = false + } + if let userInfo = userInfo, let exceptionUserInfo = exception.userInfo, + (exceptionUserInfo as NSDictionary) != userInfo { + matches = false + } + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(exception) + } + let messages = assertions.map { $0.message } + if messages.count > 0 { + matches = false + } + } + } + + return matches +} + +public class NMBObjCRaiseExceptionMatcher: NMBMatcher { + private let _name: String? + private let _reason: String? + private let _userInfo: NSDictionary? + private let _block: ((NSException) -> Void)? + + fileprivate init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { + _name = name + _reason = reason + _userInfo = userInfo + _block = block + + let matcher: Matcher = raiseException( + named: name, + reason: reason, + userInfo: userInfo, + closure: block + ) + let matcherBlock: MatcherBlock = { actualExpression in + return try matcher.satisfies(actualExpression).toObjectiveC() + } + super.init(matcher: matcherBlock) + } + + @objc public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { + let (reason, userInfo, block) = (_reason, _userInfo, _block) + return { name in + return NMBObjCRaiseExceptionMatcher( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } + + @objc public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { + let (name, userInfo, block) = (_name, _userInfo, _block) + return { reason in + return NMBObjCRaiseExceptionMatcher( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } + + @objc public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { + let (name, reason, block) = (_name, _reason, _block) + return { userInfo in + return NMBObjCRaiseExceptionMatcher( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } + + @objc public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { + let (name, reason, userInfo) = (_name, _reason, _userInfo) + return { block in + return NMBObjCRaiseExceptionMatcher( + name: name, + reason: reason, + userInfo: userInfo, + block: block + ) + } + } +} + +extension NMBMatcher { + @objc public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { + return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift new file mode 100644 index 0000000..30f9045 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift @@ -0,0 +1,123 @@ +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +public func satisfyAllOf(_ matchers: Matcher...) -> Matcher { + return satisfyAllOf(matchers) +} + +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the array of matchers. +public func satisfyAllOf(_ matchers: [Matcher]) -> Matcher { + return Matcher.define { actualExpression in + let cachedExpression = actualExpression.withCaching() + var postfixMessages = [String]() + var status: MatcherStatus = .matches + for matcher in matchers { + let result = try matcher.satisfies(cachedExpression) + if result.status == .fail { + status = .fail + } else if result.status == .doesNotMatch, status != .fail { + status = .doesNotMatch + } + postfixMessages.append("{\(result.message.expectedMessage)}") + } + + var msg: ExpectationMessage + if let actualValue = try cachedExpression.evaluate() { + msg = .expectedCustomValueTo( + "match all of: " + postfixMessages.joined(separator: ", and "), + actual: "\(actualValue)" + ) + } else { + msg = .expectedActualValueTo( + "match all of: " + postfixMessages.joined(separator: ", and ") + ) + } + + return MatcherResult(status: status, message: msg) + } +} + +public func && (left: Matcher, right: Matcher) -> Matcher { + return satisfyAllOf(left, right) +} + +// There's a compiler bug in swift 5.7.2 and earlier (xcode 14.2 and earlier) +// which causes runtime crashes when you use `[any AsyncableMatcher]`. +// https://github.com/apple/swift/issues/61403 +#if swift(>=5.8.0) +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the variable list of matchers. +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func satisfyAllOf(_ matchers: any AsyncableMatcher...) -> AsyncMatcher { + return satisfyAllOf(matchers) +} + +/// A Nimble matcher that succeeds when the actual value matches with all of the matchers +/// provided in the array of matchers. +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func satisfyAllOf(_ matchers: [any AsyncableMatcher]) -> AsyncMatcher { + return AsyncMatcher.define { actualExpression in + let cachedExpression = actualExpression.withCaching() + var postfixMessages = [String]() + var status: MatcherStatus = .matches + for matcher in matchers { + let result = try await matcher.satisfies(cachedExpression) + if result.status == .fail { + status = .fail + } else if result.status == .doesNotMatch, status != .fail { + status = .doesNotMatch + } + postfixMessages.append("{\(result.message.expectedMessage)}") + } + + var msg: ExpectationMessage + if let actualValue = try await cachedExpression.evaluate() { + msg = .expectedCustomValueTo( + "match all of: " + postfixMessages.joined(separator: ", and "), + actual: "\(actualValue)" + ) + } else { + msg = .expectedActualValueTo( + "match all of: " + postfixMessages.joined(separator: ", and ") + ) + } + + return MatcherResult(status: status, message: msg) + } +} + +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func && (left: some AsyncableMatcher, right: some AsyncableMatcher) -> AsyncMatcher { + return satisfyAllOf(left, right) +} +#endif // swift(>=5.8.0) + +#if canImport(Darwin) +import class Foundation.NSObject + +extension NMBMatcher { + @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBMatcher { + return NMBMatcher { actualExpression in + if matchers.isEmpty { + return NMBMatcherResult( + status: NMBMatcherStatus.fail, + message: NMBExpectationMessage( + fail: "satisfyAllOf must be called with at least one matcher" + ) + ) + } + + var elementEvaluators = [Matcher]() + for matcher in matchers { + let elementEvaluator = Matcher { expression in + return matcher.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() + } + + elementEvaluators.append(elementEvaluator) + } + + return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift new file mode 100644 index 0000000..56ffdd1 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -0,0 +1,123 @@ +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(_ matchers: Matcher...) -> Matcher { + return satisfyAnyOf(matchers) +} + +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the array of matchers. +public func satisfyAnyOf(_ matchers: [Matcher]) -> Matcher { + return Matcher.define { actualExpression in + let cachedExpression = actualExpression.withCaching() + var postfixMessages = [String]() + var status: MatcherStatus = .doesNotMatch + for matcher in matchers { + let result = try matcher.satisfies(cachedExpression) + if result.status == .fail { + status = .fail + } else if result.status == .matches, status != .fail { + status = .matches + } + postfixMessages.append("{\(result.message.expectedMessage)}") + } + + var msg: ExpectationMessage + if let actualValue = try cachedExpression.evaluate() { + msg = .expectedCustomValueTo( + "match one of: " + postfixMessages.joined(separator: ", or "), + actual: "\(actualValue)" + ) + } else { + msg = .expectedActualValueTo( + "match one of: " + postfixMessages.joined(separator: ", or ") + ) + } + + return MatcherResult(status: status, message: msg) + } +} + +public func || (left: Matcher, right: Matcher) -> Matcher { + return satisfyAnyOf(left, right) +} + +// There's a compiler bug in swift 5.7.2 and earlier (xcode 14.2 and earlier) +// which causes runtime crashes when you use `[any AsyncableMatcher]`. +// https://github.com/apple/swift/issues/61403 +#if swift(>=5.8.0) +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func satisfyAnyOf(_ matchers: any AsyncableMatcher...) -> AsyncMatcher { + return satisfyAnyOf(matchers) +} + +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the array of matchers. +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func satisfyAnyOf(_ matchers: [any AsyncableMatcher]) -> AsyncMatcher { + return AsyncMatcher.define { actualExpression in + let cachedExpression = actualExpression.withCaching() + var postfixMessages = [String]() + var status: MatcherStatus = .doesNotMatch + for matcher in matchers { + let result = try await matcher.satisfies(cachedExpression) + if result.status == .fail { + status = .fail + } else if result.status == .matches, status != .fail { + status = .matches + } + postfixMessages.append("{\(result.message.expectedMessage)}") + } + + var msg: ExpectationMessage + if let actualValue = try await cachedExpression.evaluate() { + msg = .expectedCustomValueTo( + "match one of: " + postfixMessages.joined(separator: ", or "), + actual: "\(actualValue)" + ) + } else { + msg = .expectedActualValueTo( + "match one of: " + postfixMessages.joined(separator: ", or ") + ) + } + + return MatcherResult(status: status, message: msg) + } +} + +@available(macOS 13.0.0, iOS 16.0.0, tvOS 16.0.0, watchOS 9.0.0, *) +public func || (left: some AsyncableMatcher, right: some AsyncableMatcher) -> AsyncMatcher { + return satisfyAnyOf(left, right) +} +#endif // swift(>=5.8.0) + +#if canImport(Darwin) +import class Foundation.NSObject + +extension NMBMatcher { + @objc public class func satisfyAnyOfMatcher(_ matchers: [NMBMatcher]) -> NMBMatcher { + return NMBMatcher { actualExpression in + if matchers.isEmpty { + return NMBMatcherResult( + status: NMBMatcherStatus.fail, + message: NMBExpectationMessage( + fail: "satisfyAnyOf must be called with at least one matcher" + ) + ) + } + + var elementEvaluators = [Matcher]() + for matcher in matchers { + let elementEvaluator = Matcher { expression in + return matcher.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() + } + + elementEvaluators.append(elementEvaluator) + } + + return try satisfyAnyOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift new file mode 100644 index 0000000..b0c2245 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift @@ -0,0 +1,155 @@ +// swiftlint:disable all +#if canImport(CwlPreconditionTesting) && (os(macOS) || os(iOS) || os(visionOS)) +import CwlPreconditionTesting +#elseif canImport(CwlPosixPreconditionTesting) +import CwlPosixPreconditionTesting +#elseif canImport(Glibc) +import Glibc + +// This function is called from the signal handler to shut down the thread and return 1 (indicating a SIGILL was received). +private func callThreadExit() { + pthread_exit(UnsafeMutableRawPointer(bitPattern: 1)) +} + +// When called, this signal handler simulates a function call to `callThreadExit` +private func sigIllHandler(code: Int32, info: UnsafeMutablePointer?, uap: UnsafeMutableRawPointer?) -> Void { + guard let context = uap?.assumingMemoryBound(to: ucontext_t.self) else { return } + + // 1. Decrement the stack pointer + context.pointee.uc_mcontext.gregs.15 /* REG_RSP */ -= Int64(MemoryLayout.size) + + // 2. Save the old Instruction Pointer to the stack. + let rsp = context.pointee.uc_mcontext.gregs.15 /* REG_RSP */ + if let ump = UnsafeMutablePointer(bitPattern: Int(rsp)) { + ump.pointee = rsp + } + + // 3. Set the Instruction Pointer to the new function's address + var f: @convention(c) () -> Void = callThreadExit + withUnsafePointer(to: &f) { $0.withMemoryRebound(to: Int64.self, capacity: 1) { ptr in + context.pointee.uc_mcontext.gregs.16 /* REG_RIP */ = ptr.pointee + } } +} + +/// Without Mach exceptions or the Objective-C runtime, there's nothing to put in the exception object. It's really just a boolean – either a SIGILL was caught or not. +public class BadInstructionException { +} + +/// Run the provided block. If a POSIX SIGILL is received, handle it and return a BadInstructionException (which is just an empty object in this POSIX signal version). Otherwise return nil. +/// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a SIGILL is received, the block will be interrupted using a C `longjmp`. The risks associated with abrupt jumps apply here: most Swift functions are *not* interrupt-safe. Memory may be leaked and the program will not necessarily be left in a safe state. +/// - parameter block: a function without parameters that will be run +/// - returns: if an SIGILL is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. +public func catchBadInstruction(block: @escaping () -> Void) -> BadInstructionException? { + // Construct the signal action + var sigActionPrev = sigaction() + var sigActionNew = sigaction() + sigemptyset(&sigActionNew.sa_mask) + sigActionNew.sa_flags = SA_SIGINFO + sigActionNew.__sigaction_handler = .init(sa_sigaction: sigIllHandler) + + // Install the signal action + if sigaction(SIGILL, &sigActionNew, &sigActionPrev) != 0 { + fatalError("Sigaction error: \(errno)") + } + + defer { + // Restore the previous signal action + if sigaction(SIGILL, &sigActionPrev, nil) != 0 { + fatalError("Sigaction error: \(errno)") + } + } + + var b = block + let caught: Bool = withUnsafeMutablePointer(to: &b) { blockPtr in + // Run the block on its own thread + var handlerThread: pthread_t = 0 + let e = pthread_create(&handlerThread, nil, { arg in + guard let arg = arg else { return nil } + (arg.assumingMemoryBound(to: (() -> Void).self).pointee)() + return nil + }, blockPtr) + precondition(e == 0, "Unable to create thread") + + // Wait for completion and get the result. It will be either `nil` or bitPattern 1 + var rawResult: UnsafeMutableRawPointer? = nil + let e2 = pthread_join(handlerThread, &rawResult) + precondition(e2 == 0, "Thread join failed") + return Int(bitPattern: rawResult) != 0 + } + + return caught ? BadInstructionException() : nil +} +#endif + +public func throwAssertion() -> Matcher { + return Matcher { actualExpression in + #if (arch(x86_64) || arch(arm64)) + #if (canImport(CwlPreconditionTesting) || canImport(CwlPosixPreconditionTesting) || canImport(Glibc)) + let message = ExpectationMessage.expectedTo("throw an assertion") + var actualError: Error? + let caughtException: BadInstructionException? = catchBadInstruction { + #if os(tvOS) + if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { + print() + print("[Nimble Warning]: If you're getting stuck on a debugger breakpoint for a " + + "fatal error while using throwAssertion(), please disable 'Debug Executable' " + + "in your scheme. Go to 'Edit Scheme > Test > Info' and uncheck " + + "'Debug Executable'. If you've already done that, suppress this warning " + + "by setting `NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true`. " + + "This is required because the standard methods of catching assertions " + + "(mach APIs) are unavailable for tvOS. Instead, the same mechanism the " + + "debugger uses is the fallback method for tvOS." + ) + print() + NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true + } + #elseif os(watchOS) + if !NimbleEnvironment.activeInstance.suppressWatchOSAssertionWarning { + print() + print("[Nimble Warning]: If you're getting stuck on a debugger breakpoint for a " + + "fatal error while using throwAssertion(), please disable 'Debug Executable' " + + "in your scheme. Go to 'Edit Scheme > Test > Info' and uncheck " + + "'Debug Executable'. If you've already done that, suppress this warning " + + "by setting `NimbleEnvironment.activeInstance.suppressWatchOSAssertionWarning = true`. " + + "This is required because the standard methods of catching assertions " + + "(mach APIs) are unavailable for watchOS. Instead, the same mechanism the " + + "debugger uses is the fallback method for watchOS." + ) + print() + NimbleEnvironment.activeInstance.suppressWatchOSAssertionWarning = true + } + #endif + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + } + + if let actualError = actualError { + return MatcherResult( + bool: false, + message: message.appended(message: "; threw error instead <\(actualError)>") + ) + } else { + return MatcherResult(bool: caughtException != nil, message: message) + } + #else + let message = """ + The throwAssertion Nimble matcher does not support your platform. + Note: throwAssertion no longer works on tvOS or watchOS platforms when you use Nimble with Cocoapods. + You will have to use Nimble with Swift Package Manager or Carthage. + """ + fatalError(message) + #endif + #else + let message = """ + The throwAssertion Nimble matcher can only run on x86_64 and arm64 platforms. + You can silence this error by placing the test case inside an #if arch(x86_64) || arch(arm64) conditional \ + statement. + """ + fatalError(message) + #endif + } +} +// swiftlint:enable all diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift new file mode 100644 index 0000000..32c2f6c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift @@ -0,0 +1,261 @@ +/// A Nimble matcher that succeeds when the actual expression throws an +/// error of the specified type or from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparison by _domain and _code. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the thrown error. The closure only gets called when an error was thrown. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func throwError() -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + if let actualError = actualError { + return MatcherResult( + bool: true, + message: .expectedCustomValueTo("throw any error", actual: "<\(actualError)>") + ) + } else { + return MatcherResult( + bool: false, + message: .expectedCustomValueTo("throw any error", actual: "no error") + ) + } + } +} + +/// A Nimble matcher that succeeds when the actual expression throws an +/// error of the specified type or from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the thrown error. The closure only gets called when an error was thrown. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func throwError(_ error: T, closure: ((Error) -> Void)? = nil) -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + let message = messageForError( + actualError: actualError, + error: error, + errorType: nil, + closure: closure + ) + + var matches = false + if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { + matches = true + + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression throws an +/// error of the specified type or from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the thrown error. The closure only gets called when an error was thrown. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func throwError(_ error: T, closure: ((T) -> Void)? = nil) -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + let message = messageForError( + actualError: actualError, + error: error, + errorType: nil, + closure: closure + ) + + var matches = false + if let actualError = actualError as? T, error == actualError { + matches = true + + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression throws an +/// error of the specified type or from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the thrown error. The closure only gets called when an error was thrown. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func throwError( + errorType: T.Type, + closure: ((T) -> Void)? = nil +) -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + let message = messageForError( + actualError: actualError, + error: nil, + errorType: errorType, + closure: closure + ) + + var matches = false + if let actualError = actualError { + matches = true + + if let actualError = actualError as? T { + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + } else { + matches = (actualError is T) + // The closure expects another ErrorProtocol as argument, so this + // is _supposed_ to fail, so that it becomes more obvious. + if let closure = closure { + let assertions = gatherExpectations { + if let actual = actualError as? T { + closure(actual) + } + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + } + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression throws any +/// error or when the passed closures' arbitrary custom matching succeeds. +/// +/// This duplication to it's generic adequate is required to allow to receive +/// values of the existential type `Error` in the closure. +/// +/// The closure only gets called when an error was thrown. +public func throwError(closure: @escaping ((Error) -> Void)) -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + let message = messageForError(actualError: actualError, closure: closure) + + var matches = false + if let actualError = actualError { + matches = true + + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + + return MatcherResult(bool: matches, message: message) + } +} + +/// A Nimble matcher that succeeds when the actual expression throws any +/// error or when the passed closures' arbitrary custom matching succeeds. +/// +/// This duplication to it's generic adequate is required to allow to receive +/// values of the existential type `Error` in the closure. +/// +/// The closure only gets called when an error was thrown. +public func throwError(closure: @escaping ((T) -> Void)) -> Matcher { + return Matcher { actualExpression in + var actualError: Error? + do { + _ = try actualExpression.evaluate() + } catch { + actualError = error + } + + let message = messageForError(actualError: actualError, closure: closure) + + var matches = false + if let actualError = actualError as? T { + matches = true + + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if !messages.isEmpty { + matches = false + } + } + + return MatcherResult(bool: matches, message: message) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ToSucceed.swift b/Pods/Nimble/Sources/Nimble/Matchers/ToSucceed.swift new file mode 100644 index 0000000..2f22991 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ToSucceed.swift @@ -0,0 +1,37 @@ +/** + Used by the `succeed` matcher. + + This is the return type for the closure. + */ +public enum ToSucceedResult { + case succeeded + case failed(reason: String) +} + +/** + A Nimble matcher that takes in a closure for validation. + + Return `.succeeded` when the validation succeeds. + Return `.failed` with a failure reason when the validation fails. + */ +public func succeed() -> Matcher { + return Matcher.define { actualExpression in + let optActual = try actualExpression.evaluate() + guard let actual = optActual else { + return MatcherResult(status: .fail, message: .fail("expected a ToSucceedResult, got ")) + } + + switch actual { + case .succeeded: + return MatcherResult( + bool: true, + message: .expectedCustomValueTo("succeed", actual: "") + ) + case .failed(let reason): + return MatcherResult( + bool: false, + message: .expectedCustomValueTo("succeed", actual: " because <\(reason)>") + ) + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Nimble.h b/Pods/Nimble/Sources/Nimble/Nimble.h new file mode 100644 index 0000000..9fb6ca3 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Nimble.h @@ -0,0 +1,24 @@ +#import + +// When running below Xcode 15, TARGET_OS_VISION is not defined. Since the project has TREAT_WARNINGS_AS_ERROS enabled +// we need to workaround this warning. +#ifndef TARGET_OS_VISION + #define TARGET_OS_VISION 0 +#endif /* TARGET_OS_VISION */ + +#import +#import +#import + +#if TARGET_OS_OSX || TARGET_OS_IOS || TARGET_OS_VISION +#if COCOAPODS + #import + #import +#else + #import "CwlMachBadInstructionHandler.h" + #import "CwlCatchException.h" +#endif +#endif + +FOUNDATION_EXPORT double NimbleVersionNumber; +FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/Pods/Nimble/Sources/Nimble/Polling+AsyncAwait.swift b/Pods/Nimble/Sources/Nimble/Polling+AsyncAwait.swift new file mode 100644 index 0000000..6adb153 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Polling+AsyncAwait.swift @@ -0,0 +1,601 @@ +// swiftlint:disable file_length +#if !os(WASI) + +import Dispatch + +@MainActor +internal func execute(_ expression: AsyncExpression, style: ExpectationStyle, to: String, description: String?, matcherExecutor: () async throws -> MatcherResult) async -> (Bool, FailureMessage) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let result = try await matcherExecutor() + result.message.update(failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(try await expression.evaluate()))>" + } + return (result.toBoolean(expectation: style), msg) + } catch let error { + msg.stringValue = "unexpected error thrown: <\(error)>" + return (false, msg) + } +} + +internal actor Poller { + private var lastMatcherResult: MatcherResult? + + init() {} + + // swiftlint:disable:next function_parameter_count + func poll(expression: AsyncExpression, + style: ExpectationStyle, + matchStyle: AsyncMatchStyle, + timeout: NimbleTimeInterval, + poll: NimbleTimeInterval, + fnName: String, + matcherRunner: @escaping () async throws -> MatcherResult) async -> MatcherResult { + let fnName = "expect(...).\(fnName)(...)" + let result = await pollBlock( + pollInterval: poll, + timeoutInterval: timeout, + file: expression.location.file, + line: expression.location.line, + fnName: fnName) { + if self.updateMatcherResult(result: try await matcherRunner()) + .toBoolean(expectation: style) { + if matchStyle.isContinous { + return .incomplete + } + return .finished(true) + } else { + if matchStyle.isContinous { + return .finished(false) + } else { + return .incomplete + } + } + } + return processPollResult(result.toPollResult(), matchStyle: matchStyle, lastMatcherResult: lastMatcherResult, fnName: fnName) + } + + func updateMatcherResult(result: MatcherResult) -> MatcherResult { + self.lastMatcherResult = result + return result + } +} + +// swiftlint:disable:next function_parameter_count +internal func poll( + expression: AsyncExpression, + style: ExpectationStyle, + matchStyle: AsyncMatchStyle, + timeout: NimbleTimeInterval, + poll: NimbleTimeInterval, + fnName: String, + matcherRunner: @escaping () async throws -> MatcherResult +) async -> MatcherResult { + let poller = Poller() + return await poller.poll( + expression: expression, + style: style, + matchStyle: matchStyle, + timeout: timeout, + poll: poll, + fnName: fnName, + matcherRunner: matcherRunner + ) +} + +extension SyncExpectation { + // MARK: - With Synchronous Matchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } + + // MARK: - With AsyncMatchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } +} + +extension AsyncExpectation { + // MARK: - With Synchronous Matchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } + + // MARK: - With AsyncMatchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> Self { + return await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Polling+Require.swift b/Pods/Nimble/Sources/Nimble/Polling+Require.swift new file mode 100644 index 0000000..7f9c926 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Polling+Require.swift @@ -0,0 +1,762 @@ +// swiftlint:disable file_length +#if !os(WASI) + +import Dispatch + +extension SyncRequirement { + // MARK: - Dispatch Polling with Synchronous Matchers + /// Require the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toEventually` does not work in any kind of async context. Use the async form of `toEventually` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `toEventually` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toMatch, + poll( + style: .toMatch, + matchStyle: .eventually, + matcher: matcher, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually" + ), + to: "to eventually", + description: description, + captureExceptions: false + ) + return try verify(pass, msg, try expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toEventuallyNot` does not work in any kind of async context. + /// Use the async form of `toEventuallyNot` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `toEventuallyNot` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toNotMatch, + poll( + style: .toNotMatch, + matchStyle: .eventually, + matcher: matcher, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot" + ), + to: "to eventually not", + description: description, + captureExceptions: false + ) + return try verify(pass, msg, try expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toNotEventually` does not work in any kind of async context. + /// Use the async form of `toNotEventually` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `toNotEventually` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + return try toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toNever` does not work in any kind of async context. + /// Use the async form of `toNever` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `toNever` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toNotMatch, + poll( + style: .toNotMatch, + matchStyle: .never, + matcher: matcher, + timeout: until, + poll: pollInterval, + fnName: "toNever" + ), + to: "to never", + description: description, + captureExceptions: false + ) + return try verify(pass, msg, try expression.evaluate()) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `neverTo` does not work in any kind of async context. + /// Use the async form of `neverTo` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `neverTo` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + return try toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toAlways` does not work in any kind of async context. + /// Use the async form of `toAlways` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `toAlways` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toMatch, + poll( + style: .toMatch, + matchStyle: .always, + matcher: matcher, + timeout: until, + poll: pollInterval, + fnName: "toAlways" + ), + to: "to always", + description: description, + captureExceptions: false + ) + return try verify(pass, msg, try expression.evaluate()) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `alwaysTo` does not work in any kind of async context. + /// Use the async form of `alwaysTo` if you are running tests in an async context. + @available(*, noasync, message: "the sync variant of `alwaysTo` does not work in async contexts. Use the async variant as a drop-in replacement") + @discardableResult + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) throws -> Value { + return try toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } + + // MARK: - Async Polling with Synchronous Matchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { @MainActor in + try matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } + + // MARK: - Async Polling With AsyncMatchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: asyncExpression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + let asyncExpression = expression.toAsyncExpression() + + let (pass, msg) = await execute( + asyncExpression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: asyncExpression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { @MainActor in + try await matcher.satisfies(expression.withoutCaching().toAsyncExpression()) + } + } + return try verify(pass, msg, try await asyncExpression.evaluate()) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } +} + +extension AsyncRequirement { + // MARK: - Async Polling With Synchronous Matchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { + try matcher.satisfies(await expression.withoutCaching().toSynchronousExpression()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } + + // MARK: - Async Polling With AsyncMatchers + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + @discardableResult + public func toEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to eventually", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toEventuallyNot(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to eventually not", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .eventually, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + @discardableResult + public func toNotEventually(_ matcher: AsyncMatcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + @discardableResult + public func toNever(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toNotMatch, + to: "to never", + description: description) { + await poll( + expression: expression, + style: .toNotMatch, + matchStyle: .never, + timeout: until, + poll: pollInterval, + fnName: "toNever") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + @discardableResult + public func neverTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + @discardableResult + public func toAlways(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = await execute( + expression, + style: .toMatch, + to: "to always", + description: description) { + await poll( + expression: expression, + style: .toMatch, + matchStyle: .always, + timeout: until, + poll: pollInterval, + fnName: "toAlways") { + try await matcher.satisfies(expression.withoutCaching()) + } + } + return try verify(pass, msg, try await expression.evaluate()) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + @discardableResult + public func alwaysTo(_ matcher: AsyncMatcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async throws -> Value { + return try await toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } +} + +// MARK: - UnwrapEventually + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrap(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) throws -> T { + try require(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrap(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) throws -> T { + try require(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwraps(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () throws -> T?) throws -> T { + try require(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `require(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwraps(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() throws -> T?)) throws -> T { + try require(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrap(file: FileString = #file, line: UInt = #line, _ expression: @escaping () async throws -> T?) async throws -> T { + try await requirea(file: file, line: line, try await expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrap(file: FileString = #file, line: UInt = #line, _ expression: () -> (() async throws -> T?)) async throws -> T { + try await requirea(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrapa(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure @escaping () async throws -> T?) async throws -> T { + try await requirea(file: file, line: line, try await expression()).toEventuallyNot(beNil()) +} + +/// Makes sure that the async expression evaluates to a non-nil value, otherwise throw an error. +/// As you can tell, this is a much less verbose equivalent to `requirea(expression).toEventuallyNot(beNil())` +@discardableResult +public func pollUnwrapa(file: FileString = #file, line: UInt = #line, _ expression: @autoclosure () -> (() async throws -> T?)) async throws -> T { + try await requirea(file: file, line: line, expression()).toEventuallyNot(beNil()) +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Polling.swift b/Pods/Nimble/Sources/Nimble/Polling.swift new file mode 100644 index 0000000..31a03d7 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Polling.swift @@ -0,0 +1,327 @@ +#if !os(WASI) + +import Foundation +import Dispatch + +/// If you are running on a slower machine, it could be useful to increase the default timeout value +/// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01. +/// +/// - Warning: This has been renamed to ``PollingDefaults``. Starting in Nimble 14, `AsyncDefaults` will be removed entirely. +/// +/// For the time being, `AsyncDefaults` will function the same. +/// However, `AsyncDefaults` will be removed in a future release. +@available(*, unavailable, renamed: "PollingDefaults") +public struct AsyncDefaults { + public static var timeout: NimbleTimeInterval { + get { + PollingDefaults.timeout + } + set { + PollingDefaults.timeout = newValue + } + } + public static var pollInterval: NimbleTimeInterval { + get { + PollingDefaults.pollInterval + } + set { + PollingDefaults.pollInterval = newValue + } + } +} + +/// If you are running on a slower machine, it could be useful to increase the default timeout value +/// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01. +/// +/// - Note: This used to be known as ``AsyncDefaults``. +public struct PollingDefaults { + public static var timeout: NimbleTimeInterval = .seconds(1) + public static var pollInterval: NimbleTimeInterval = .milliseconds(10) +} + +internal enum AsyncMatchStyle { + case eventually, never, always + + var isContinous: Bool { + switch self { + case .eventually: + return false + case .never, .always: + return true + } + } +} + +// swiftlint:disable:next function_parameter_count +internal func poll( + style: ExpectationStyle, + matchStyle: AsyncMatchStyle, + matcher: Matcher, + timeout: NimbleTimeInterval, + poll: NimbleTimeInterval, + fnName: String +) -> Matcher { + return Matcher { actualExpression in + let uncachedExpression = actualExpression.withoutCaching() + let fnName = "expect(...).\(fnName)(...)" + var lastMatcherResult: MatcherResult? + let result = pollBlock( + pollInterval: poll, + timeoutInterval: timeout, + file: actualExpression.location.file, + line: actualExpression.location.line, + fnName: fnName) { + lastMatcherResult = try matcher.satisfies(uncachedExpression) + if lastMatcherResult!.toBoolean(expectation: style) { + if matchStyle.isContinous { + return .incomplete + } + return .finished(true) + } else { + if matchStyle.isContinous { + return .finished(false) + } else { + return .incomplete + } + } + } + return processPollResult(result, matchStyle: matchStyle, lastMatcherResult: lastMatcherResult, fnName: fnName) + } +} + +// swiftlint:disable:next cyclomatic_complexity +internal func processPollResult(_ result: PollResult, matchStyle: AsyncMatchStyle, lastMatcherResult: MatcherResult?, fnName: String) -> MatcherResult { + switch result { + case .completed: + switch matchStyle { + case .eventually: + return lastMatcherResult! + case .never: + return MatcherResult( + status: .fail, + message: lastMatcherResult?.message ?? .fail("matched the matcher when it shouldn't have") + ) + case .always: + return MatcherResult( + status: .fail, + message: lastMatcherResult?.message ?? .fail("didn't match the matcher when it should have") + ) + } + case .timedOut: + switch matchStyle { + case .eventually: + let message = lastMatcherResult?.message ?? .fail("timed out before returning a value") + return MatcherResult(status: .fail, message: message) + case .never: + return MatcherResult(status: .doesNotMatch, message: .expectedTo("never match the matcher")) + case .always: + return MatcherResult(status: .matches, message: .expectedTo("always match the matcher")) + } + case let .errorThrown(error): + return MatcherResult(status: .fail, message: .fail("unexpected error thrown: <\(error)>")) + case let .raisedException(exception): + return MatcherResult(status: .fail, message: .fail("unexpected exception raised: \(exception)")) + case .blockedRunLoop: + let message = lastMatcherResult?.message.appended(message: " (timed out, but main run loop was unresponsive).") ?? + .fail("main run loop was unresponsive") + return MatcherResult(status: .fail, message: message) + case .incomplete: + internalError("Reached .incomplete state for \(fnName)(...).") + } +} + +internal let toEventuallyRequiresClosureError = FailureMessage( + stringValue: """ + expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) ) + Swift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function + """ +) + +extension SyncExpectation { + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toEventually` does not work in any kind of async context. Use the async form of `toEventually` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `toEventually` does not work in async contexts. Use the async variant as a drop-in replacement") + public func toEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toMatch, + poll( + style: .toMatch, + matchStyle: .eventually, + matcher: matcher, + timeout: timeout, + poll: pollInterval, + fnName: "toEventually" + ), + to: "to eventually", + description: description, + captureExceptions: false + ) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toEventuallyNot` does not work in any kind of async context. + /// Use the async form of `toEventuallyNot` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `toEventuallyNot` does not work in async contexts. Use the async variant as a drop-in replacement") + public func toEventuallyNot(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toNotMatch, + poll( + style: .toNotMatch, + matchStyle: .eventually, + matcher: matcher, + timeout: timeout, + poll: pollInterval, + fnName: "toEventuallyNot" + ), + to: "to eventually not", + description: description, + captureExceptions: false + ) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toNotEventually` does not work in any kind of async context. + /// Use the async form of `toNotEventually` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `toNotEventually` does not work in async contexts. Use the async variant as a drop-in replacement") + public func toNotEventually(_ matcher: Matcher, timeout: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toNever` does not work in any kind of async context. + /// Use the async form of `toNever` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `toNever` does not work in async contexts. Use the async variant as a drop-in replacement") + public func toNever(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toNotMatch, + poll( + style: .toNotMatch, + matchStyle: .never, + matcher: matcher, + timeout: until, + poll: pollInterval, + fnName: "toNever" + ), + to: "to never", + description: description, + captureExceptions: false + ) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to never match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toNever() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `neverTo` does not work in any kind of async context. + /// Use the async form of `neverTo` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `neverTo` does not work in async contexts. Use the async variant as a drop-in replacement") + public func neverTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + return toNever(matcher, until: until, pollInterval: pollInterval, description: description) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `toAlways` does not work in any kind of async context. + /// Use the async form of `toAlways` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `toAlways` does not work in async contexts. Use the async variant as a drop-in replacement") + public func toAlways(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue) + + let (pass, msg) = execute( + expression, + .toMatch, + poll( + style: .toMatch, + matchStyle: .always, + matcher: matcher, + timeout: until, + poll: pollInterval, + fnName: "toAlways" + ), + to: "to always", + description: description, + captureExceptions: false + ) + return verify(pass, msg) + } + + /// Tests the actual value using a matcher to always match by checking + /// continusouly at each pollInterval until the timeout is reached + /// + /// Alias of toAlways() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + /// + /// @warning + /// This form of `alwaysTo` does not work in any kind of async context. + /// Use the async form of `alwaysTo` if you are running tests in an async context. + @discardableResult + @available(*, noasync, message: "the sync variant of `alwaysTo` does not work in async contexts. Use the async variant as a drop-in replacement") + public func alwaysTo(_ matcher: Matcher, until: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> Self { + return toAlways(matcher, until: until, pollInterval: pollInterval, description: description) + } +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Requirement.swift b/Pods/Nimble/Sources/Nimble/Requirement.swift new file mode 100644 index 0000000..91c8487 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Requirement.swift @@ -0,0 +1,210 @@ +import Foundation + +public struct RequireError: Error, CustomNSError { + let message: String + let location: SourceLocation + + var localizedDescription: String { message } + public var errorUserInfo: [String: Any] { + // Required to prevent Xcode from reporting that we threw an error. + // The default assertionHandlers will report this to XCode for us. + ["XCTestErrorUserInfoKeyShouldIgnore": true] + } + + static func unknown(_ location: SourceLocation) -> RequireError { + RequireError(message: "Nimble error - file a bug if you see this!", location: location) + } +} +internal func executeRequire(_ expression: Expression, _ style: ExpectationStyle, _ matcher: Matcher, to: String, description: String?, captureExceptions: Bool = true) -> (Bool, FailureMessage, T?) { + func run() -> (Bool, FailureMessage, T?) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let cachedExpression = expression.withCaching() + let result = try matcher.satisfies(cachedExpression) + let value = try cachedExpression.evaluate() + result.message.update(failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(value))>" + } + return (result.toBoolean(expectation: style), msg, value) + } catch let error { + msg.stringValue = "unexpected error thrown: <\(error)>" + return (false, msg, nil) + } + } + + var result: (Bool, FailureMessage, T?) = (false, FailureMessage(), nil) + if captureExceptions { + let capture = NMBExceptionCapture(handler: ({ exception -> Void in + let msg = FailureMessage() + msg.stringValue = "unexpected exception raised: \(exception)" + result = (false, msg, nil) + }), finally: nil) + capture.tryBlock { + result = run() + } + } else { + result = run() + } + + return result +} + +internal func executeRequire(_ expression: AsyncExpression, _ style: ExpectationStyle, _ matcher: AsyncMatcher, to: String, description: String?) async -> (Bool, FailureMessage, T?) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let cachedExpression = expression.withCaching() + let result = try await matcher.satisfies(cachedExpression) + let value = try await cachedExpression.evaluate() + result.message.update(failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(value))>" + } + return (result.toBoolean(expectation: style), msg, value) + } catch let error { + msg.stringValue = "unexpected error thrown: <\(error)>" + return (false, msg, nil) + } +} + +public struct SyncRequirement { + public let expression: Expression + + /// A custom error to throw. + /// If nil, then we will throw a ``RequireError`` on failure. + public let customError: Error? + + public var location: SourceLocation { expression.location } + + public init(expression: Expression, customError: Error?) { + self.expression = expression + self.customError = customError + } + + public func verify(_ pass: Bool, _ message: FailureMessage, _ value: Value?) throws -> Value { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(pass, message: message, location: expression.location) + guard pass, let value else { + throw customError ?? RequireError(message: message.stringValue, location: self.location) + } + return value + } + + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: Matcher, description: String? = nil) throws -> Value { + let (pass, msg, result) = executeRequire(expression, .toMatch, matcher, to: "to", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: Matcher, description: String? = nil) throws -> Value { + let (pass, msg, result) = executeRequire(expression, .toNotMatch, matcher, to: "to not", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: Matcher, description: String? = nil) throws -> Value { + try toNot(matcher, description: description) + } + + // MARK: - AsyncMatchers + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = await executeRequire(expression.toAsyncExpression(), .toMatch, matcher, to: "to", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = await executeRequire(expression.toAsyncExpression(), .toNotMatch, matcher, to: "to not", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + try await toNot(matcher, description: description) + } +} + +public struct AsyncRequirement { + public let expression: AsyncExpression + + /// A custom error to throw. + /// If nil, then we will throw a ``RequireError`` on failure. + public let customError: Error? + + public var location: SourceLocation { expression.location } + + public init(expression: AsyncExpression, customError: Error?) { + self.expression = expression + self.customError = customError + } + + public func verify(_ pass: Bool, _ message: FailureMessage, _ value: Value?) throws -> Value { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(pass, message: message, location: expression.location) + guard pass, let value else { + throw customError ?? RequireError(message: message.stringValue, location: self.location) + } + return value + } + + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: Matcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = executeRequire(await expression.toSynchronousExpression(), .toMatch, matcher, to: "to", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: Matcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = executeRequire(await expression.toSynchronousExpression(), .toNotMatch, matcher, to: "to not", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: Matcher, description: String? = nil) async throws -> Value { + try await toNot(matcher, description: description) + } + + // MARK: - AsyncMatchers + /// Tests the actual value using a matcher to match. + @discardableResult + public func to(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = await executeRequire(expression, .toMatch, matcher, to: "to", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + @discardableResult + public func toNot(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + let (pass, msg, result) = await executeRequire(expression, .toNotMatch, matcher, to: "to not", description: description) + return try verify(pass, msg, result) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + @discardableResult + public func notTo(_ matcher: AsyncMatcher, description: String? = nil) async throws -> Value { + try await toNot(matcher, description: description) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/AsyncAwait.swift b/Pods/Nimble/Sources/Nimble/Utils/AsyncAwait.swift new file mode 100644 index 0000000..1e58843 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/AsyncAwait.swift @@ -0,0 +1,336 @@ +#if !os(WASI) + +#if canImport(CoreFoundation) +import CoreFoundation +#endif + +import Dispatch +import Foundation + +private let timeoutLeeway = NimbleTimeInterval.milliseconds(1) +private let pollLeeway = NimbleTimeInterval.milliseconds(1) + +// Like PollResult, except it doesn't support objective-c exceptions. +// Which is tolerable because Swift Concurrency doesn't support recording objective-c exceptions. +internal enum AsyncPollResult { + /// Incomplete indicates None (aka - this value hasn't been fulfilled yet) + case incomplete + /// TimedOut indicates the result reached its defined timeout limit before returning + case timedOut + /// BlockedRunLoop indicates the main runloop is too busy processing other blocks to trigger + /// the timeout code. + /// + /// This may also mean the async code waiting upon may have never actually ran within the + /// required time because other timers & sources are running on the main run loop. + case blockedRunLoop + /// The async block successfully executed and returned a given result + case completed(T) + /// When a Swift Error is thrown + case errorThrown(Error) + + func isIncomplete() -> Bool { + switch self { + case .incomplete: return true + default: return false + } + } + + func isCompleted() -> Bool { + switch self { + case .completed: return true + default: return false + } + } + + func toPollResult() -> PollResult { + switch self { + case .incomplete: return .incomplete + case .timedOut: return .timedOut + case .blockedRunLoop: return .blockedRunLoop + case .completed(let value): return .completed(value) + case .errorThrown(let error): return .errorThrown(error) + } + } +} + +// A mechanism to send a single value between 2 tasks. +// Inspired by swift-async-algorithm's AsyncChannel, but massively simplified +// especially given Nimble's usecase. +// AsyncChannel: https://github.com/apple/swift-async-algorithms/blob/main/Sources/AsyncAlgorithms/Channels/AsyncChannel.swift +internal actor AsyncPromise { + private let storage = Storage() + + private final class Storage { + private var continuations: [UnsafeContinuation] = [] + private var value: T? + // Yes, this is not the fastest lock, but it's platform independent, + // which means we don't have to have a Lock protocol and separate Lock + // implementations for Linux & Darwin (and Windows if we ever add + // support for that). + private let lock = NSLock() + + func await() async -> T { + await withUnsafeContinuation { continuation in + lock.lock() + defer { lock.unlock() } + if let value { + continuation.resume(returning: value) + } else { + continuations.append(continuation) + } + } + } + + func send(_ value: T) { + lock.lock() + defer { lock.unlock() } + if self.value != nil { return } + continuations.forEach { continuation in + continuation.resume(returning: value) + } + continuations = [] + self.value = value + } + } + + nonisolated func send(_ value: T) { + self.storage.send(value) + } + + var value: T { + get async { + await self.storage.await() + } + } +} + +/// Wait until the timeout period, then checks why the matcher might have timed out +/// +/// Why Dispatch? +/// +/// Using Dispatch gives us mechanisms for detecting why the matcher timed out. +/// If it timed out because the main thread was blocked, then we want to report that, +/// as that's a performance concern. If it timed out otherwise, then we need to +/// report that. +/// This **could** be done using mechanisms like locks, but instead we use +/// `DispatchSemaphore`. That's because `DispatchSemaphore` is fast and +/// platform independent. However, while `DispatchSemaphore` itself is +/// `Sendable`, the `wait` method is not safe to use in an async context. +/// To get around that, we must ensure that all usages of +/// `DispatchSemaphore.wait` are in synchronous contexts, which +/// we can ensure by dispatching to a `DispatchQueue`. Unlike directly calling +/// a synchronous closure, or using something ilke `MainActor.run`, using +/// a `DispatchQueue` to run synchronous code will actually run it in a +/// synchronous context. +/// +/// +/// Run Loop Management +/// +/// In order to properly interrupt the waiting behavior performed by this factory class, +/// this timer stops the main run loop to tell the waiter code that the result should be +/// checked. +/// +/// In addition, stopping the run loop is used to halt code executed on the main run loop. +private func timeout(timeoutQueue: DispatchQueue, timeoutInterval: NimbleTimeInterval, forcefullyAbortTimeout: NimbleTimeInterval) async -> AsyncPollResult { + do { + try await Task.sleep(nanoseconds: timeoutInterval.nanoseconds) + } catch {} + + let promise = AsyncPromise>() + + let timedOutSem = DispatchSemaphore(value: 0) + let semTimedOutOrBlocked = DispatchSemaphore(value: 0) + semTimedOutOrBlocked.signal() + + DispatchQueue.main.async { + if semTimedOutOrBlocked.wait(timeout: .now()) == .success { + timedOutSem.signal() + semTimedOutOrBlocked.signal() + promise.send(.timedOut) + } + } + + // potentially interrupt blocking code on run loop to let timeout code run + timeoutQueue.async { + let abortTimeout = DispatchTime.now() + timeoutInterval.divided.dispatchTimeInterval + let didNotTimeOut = timedOutSem.wait(timeout: abortTimeout) != .success + let timeoutWasNotTriggered = semTimedOutOrBlocked.wait(timeout: .now()) == .success + if didNotTimeOut && timeoutWasNotTriggered { + promise.send(.blockedRunLoop) + } else { + promise.send(.timedOut) + } + } + + return await promise.value +} + +private func poll(_ pollInterval: NimbleTimeInterval, expression: @escaping () async throws -> PollStatus) async -> AsyncPollResult { + for try await _ in AsyncTimerSequence(interval: pollInterval) { + do { + if case .finished(let result) = try await expression() { + return .completed(result) + } + } catch { + return .errorThrown(error) + } + } + return .completed(false) +} + +/// Blocks for an asynchronous result. +/// +/// @discussion +/// This function cannot be nested. This is because this function (and it's related methods) +/// coordinate through the main run loop. Tampering with the run loop can cause undesirable behavior. +/// +/// This method will return an AwaitResult in the following cases: +/// +/// - The main run loop is blocked by other operations and the async expectation cannot be +/// be stopped. +/// - The async expectation timed out +/// - The async expectation succeeded +/// - The async expectation raised an unexpected exception (objc) +/// - The async expectation raised an unexpected error (swift) +/// +/// The returned AsyncPollResult will NEVER be .incomplete. +private func runPoller( + timeoutInterval: NimbleTimeInterval, + pollInterval: NimbleTimeInterval, + awaiter: Awaiter, + fnName: String = #function, file: FileString = #file, line: UInt = #line, + expression: @escaping () async throws -> PollStatus +) async -> AsyncPollResult { + awaiter.waitLock.acquireWaitingLock( + fnName, + file: file, + line: line) + + defer { + awaiter.waitLock.releaseWaitingLock() + } + let timeoutQueue = awaiter.timeoutQueue + return await withTaskGroup(of: AsyncPollResult.self) { taskGroup in + taskGroup.addTask { + await timeout( + timeoutQueue: timeoutQueue, + timeoutInterval: timeoutInterval, + forcefullyAbortTimeout: timeoutInterval.divided + ) + } + + taskGroup.addTask { + await poll(pollInterval, expression: expression) + } + + defer { + taskGroup.cancelAll() + } + + return await taskGroup.next() ?? .timedOut + } +} + +private final class Box: @unchecked Sendable { + private var _value: T + var value: T { + lock.lock() + defer { lock.unlock() } + return _value + } + + private let lock = NSLock() + + init(value: T) { + _value = value + } + + func operate(_ closure: @Sendable (T) -> T) { + lock.lock() + defer { lock.unlock() } + _value = closure(_value) + } +} + +// swiftlint:disable:next function_parameter_count +private func runAwaitTrigger( + awaiter: Awaiter, + timeoutInterval: NimbleTimeInterval, + leeway: NimbleTimeInterval, + file: FileString, line: UInt, + _ closure: @escaping (@escaping (T) -> Void) async throws -> Void +) async -> AsyncPollResult { + let timeoutQueue = awaiter.timeoutQueue + let completionCount = Box(value: 0) + return await withTaskGroup(of: AsyncPollResult.self) { taskGroup in + let promise = AsyncPromise() + + taskGroup.addTask { + defer { + promise.send(nil) + } + return await timeout( + timeoutQueue: timeoutQueue, + timeoutInterval: timeoutInterval, + forcefullyAbortTimeout: leeway + ) + } + + taskGroup.addTask { + do { + try await closure { result in + completionCount.operate { $0 + 1 } + if completionCount.value < 2 { + promise.send(result) + } else { + fail("waitUntil(..) expects its completion closure to be only called once", + file: file, line: line) + } + } + if let value = await promise.value { + return .completed(value) + } else { + return .timedOut + } + } catch { + return .errorThrown(error) + } + } + + defer { + taskGroup.cancelAll() + } + + return await taskGroup.next() ?? .timedOut + } +} + +internal func performBlock( + timeoutInterval: NimbleTimeInterval, + leeway: NimbleTimeInterval, + file: FileString, line: UInt, + _ closure: @escaping (@escaping (T) -> Void) async throws -> Void +) async -> AsyncPollResult { + await runAwaitTrigger( + awaiter: NimbleEnvironment.activeInstance.awaiter, + timeoutInterval: timeoutInterval, + leeway: leeway, + file: file, line: line, closure) +} + +internal func pollBlock( + pollInterval: NimbleTimeInterval, + timeoutInterval: NimbleTimeInterval, + file: FileString, + line: UInt, + fnName: String = #function, + expression: @escaping () async throws -> PollStatus) async -> AsyncPollResult { + await runPoller( + timeoutInterval: timeoutInterval, + pollInterval: pollInterval, + awaiter: NimbleEnvironment.activeInstance.awaiter, + expression: expression + ) + } + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Utils/AsyncTimerSequence.swift b/Pods/Nimble/Sources/Nimble/Utils/AsyncTimerSequence.swift new file mode 100644 index 0000000..83c2485 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/AsyncTimerSequence.swift @@ -0,0 +1,140 @@ +#if !os(WASI) + +#if canImport(CoreFoundation) +import CoreFoundation +#endif +import Dispatch +import Foundation + +// Basically a re-implementation of Clock and InstantProtocol. +// This can be removed once we drop support for iOS < 16. +internal protocol NimbleClockProtocol: Sendable { + associatedtype Instant: NimbleInstantProtocol + + func now() -> Instant + + func sleep(until: Instant) async throws +} + +internal protocol NimbleInstantProtocol: Sendable, Comparable { + associatedtype Interval: NimbleIntervalProtocol + + func advanced(byInterval: Interval) -> Self + + func intervalSince(_: Self) -> Interval +} + +internal protocol NimbleIntervalProtocol: Sendable, Comparable { + static func + (lhs: Self, rhs: Self) -> Self + static func - (lhs: Self, rhs: Self) -> Self + static func * (lhs: Self, rhs: Self) -> Self + static func / (lhs: Self, rhs: Self) -> Self + + func rounded(_ rule: FloatingPointRoundingRule) -> Self +} + +internal struct DateClock: NimbleClockProtocol { + typealias Instant = Date + + func now() -> Instant { + Date() + } + + func sleep(until: Instant) async throws { + try await Task.sleep(nanoseconds: UInt64(Swift.max(0, until.timeIntervalSinceNow * 1_000_000_000))) + } +} + +// Date is Sendable as of at least iOS 16. +// But as of Swift 5.9, it's still not Sendable in the open source version. +extension Date: @unchecked Sendable {} + +extension Date: NimbleInstantProtocol { + typealias Interval = NimbleTimeInterval + + func advanced(byInterval interval: NimbleTimeInterval) -> Date { + advanced(by: interval.timeInterval) + } + + func intervalSince(_ other: Date) -> NimbleTimeInterval { + timeIntervalSince(other).nimbleInterval + } +} + +extension NimbleTimeInterval: NimbleIntervalProtocol { + func rounded(_ rule: FloatingPointRoundingRule) -> NimbleTimeInterval { + timeInterval.rounded(rule).nimbleInterval + } + + static func + (lhs: NimbleTimeInterval, rhs: NimbleTimeInterval) -> NimbleTimeInterval { + (lhs.timeInterval + rhs.timeInterval).nimbleInterval + } + + static func - (lhs: NimbleTimeInterval, rhs: NimbleTimeInterval) -> NimbleTimeInterval { + (lhs.timeInterval - rhs.timeInterval).nimbleInterval + } + + static func * (lhs: NimbleTimeInterval, rhs: NimbleTimeInterval) -> NimbleTimeInterval { + (lhs.timeInterval * rhs.timeInterval).nimbleInterval + } + + static func / (lhs: NimbleTimeInterval, rhs: NimbleTimeInterval) -> NimbleTimeInterval { + (lhs.timeInterval / rhs.timeInterval).nimbleInterval + } + + public static func < (lhs: NimbleTimeInterval, rhs: NimbleTimeInterval) -> Bool { + lhs.timeInterval < rhs.timeInterval + } +} + +// Similar to (made by directly referencing) swift-async-algorithm's AsyncTimerSequence. +// https://github.com/apple/swift-async-algorithms/blob/main/Sources/AsyncAlgorithms/AsyncTimerSequence.swift +// Only this one is compatible with OS versions that Nimble supports. +struct AsyncTimerSequence: AsyncSequence { + typealias Element = Void + let clock: Clock + let interval: Clock.Instant.Interval + + struct AsyncIterator: AsyncIteratorProtocol { + let clock: Clock + let interval: Clock.Instant.Interval + + var last: Clock.Instant? + + func nextDeadline() -> Clock.Instant { + let now = clock.now() + + let last = self.last ?? now + let next = last.advanced(byInterval: interval) + if next < now { + let nextTimestep = interval * (now.intervalSince(next) / interval).rounded(.up) + return last.advanced(byInterval: nextTimestep) + } else { + return next + } + } + + mutating func next() async -> Void? { + let next = nextDeadline() + do { + try await clock.sleep(until: next) + } catch { + return nil + } + last = next + return () + } + } + + func makeAsyncIterator() -> AsyncIterator { + return AsyncIterator(clock: clock, interval: interval) + } +} + +extension AsyncTimerSequence { + init(interval: NimbleTimeInterval) { + self.init(clock: DateClock(), interval: interval) + } +} + +#endif // os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Utils/Errors.swift b/Pods/Nimble/Sources/Nimble/Utils/Errors.swift new file mode 100644 index 0000000..4c3e434 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Errors.swift @@ -0,0 +1,63 @@ +// Generic + +internal func messageForError( + postfixMessageVerb: String = "throw", + actualError: Error?, + error: T? = nil, + errorType: T.Type? = nil, + closure: ((T) -> Void)? = nil +) -> ExpectationMessage { + var rawMessage = "\(postfixMessageVerb) error" + + if let error = error { + rawMessage += " <\(error)>" + } else if errorType != nil || closure != nil { + rawMessage += " from type <\(T.self)>" + } + if closure != nil { + rawMessage += " that satisfies block" + } + if error == nil && errorType == nil && closure == nil { + rawMessage = "\(postfixMessageVerb) any error" + } + + let actual: String + if let actualError = actualError { + actual = "<\(actualError)>" + } else { + actual = "no error" + } + + return .expectedCustomValueTo(rawMessage, actual: actual) +} + +internal func errorMatchesExpectedError( + _ actualError: Error, + expectedError: T) -> Bool { + return actualError._domain == expectedError._domain + && actualError._code == expectedError._code +} + +// Non-generic + +internal func messageForError( + actualError: Error?, + closure: ((Error) -> Void)? +) -> ExpectationMessage { + var rawMessage = "throw error" + + if closure != nil { + rawMessage += " that satisfies block" + } else { + rawMessage = "throw any error" + } + + let actual: String + if let actualError = actualError { + actual = "<\(actualError)>" + } else { + actual = "no error" + } + + return .expectedCustomValueTo(rawMessage, actual: actual) +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/NimbleTimeInterval.swift b/Pods/Nimble/Sources/Nimble/Utils/NimbleTimeInterval.swift new file mode 100644 index 0000000..abe0218 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/NimbleTimeInterval.swift @@ -0,0 +1,89 @@ +#if !os(WASI) + +import Dispatch + +#if canImport(CDispatch) +import CDispatch +#endif + +/// A reimplementation of `DispatchTimeInterval` without the `never` case, and conforming to `Sendable`. +public enum NimbleTimeInterval: Sendable, Equatable { + case seconds(Int) + case milliseconds(Int) + case microseconds(Int) + case nanoseconds(Int) +} + +extension NimbleTimeInterval: CustomStringConvertible { + public var dispatchTimeInterval: DispatchTimeInterval { + switch self { + case .seconds(let int): + return .seconds(int) + case .milliseconds(let int): + return .milliseconds(int) + case .microseconds(let int): + return .microseconds(int) + case .nanoseconds(let int): + return .nanoseconds(int) + } + } + + // ** Note: We cannot simply divide the time interval because NimbleTimeInterval associated value type is Int + internal var divided: NimbleTimeInterval { + switch self { + case let .seconds(val): return val < 2 ? .milliseconds(Int(Float(val)/2*1000)) : .seconds(val/2) + case let .milliseconds(val): return .milliseconds(val/2) + case let .microseconds(val): return .microseconds(val/2) + case let .nanoseconds(val): return .nanoseconds(val/2) + } + } + + public var nanoseconds: UInt64 { + switch self { + case .seconds(let int): return UInt64(int) * 1_000_000_000 + case .milliseconds(let int): return UInt64(int) * 1_000_000 + case .microseconds(let int): return UInt64(int) * 1_000 + case .nanoseconds(let int): return UInt64(int) + } + } + + public var description: String { + switch self { + case let .seconds(val): return val == 1 ? "\(Float(val)) second" : "\(Float(val)) seconds" + case let .milliseconds(val): return "\(Float(val)/1_000) seconds" + case let .microseconds(val): return "\(Float(val)/1_000_000) seconds" + case let .nanoseconds(val): return "\(Float(val)/1_000_000_000) seconds" + } + } +} + +#if canImport(Foundation) +import Foundation + +extension NimbleTimeInterval { + public var timeInterval: TimeInterval { + switch self { + case .seconds(let int): return TimeInterval(int) + case .milliseconds(let int): return TimeInterval(int) / 1_000 + case .microseconds(let int): return TimeInterval(int) / 1_000_000 + case .nanoseconds(let int): return TimeInterval(int) / 1_000_000_000 + } + } +} + +extension TimeInterval { + public var nimbleInterval: NimbleTimeInterval { + let microseconds = Int64(self * TimeInterval(USEC_PER_SEC)) + // perhaps use nanoseconds, though would more often be > Int.max + return microseconds < Int.max ? .microseconds(Int(microseconds)) : .seconds(Int(self)) + } +} + +extension Date { + public func advanced(by nimbleTimeInterval: NimbleTimeInterval) -> Date { + self.advanced(by: nimbleTimeInterval.timeInterval) + } +} +#endif + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Utils/PollAwait.swift b/Pods/Nimble/Sources/Nimble/Utils/PollAwait.swift new file mode 100644 index 0000000..9c045c4 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/PollAwait.swift @@ -0,0 +1,421 @@ +#if !os(WASI) + +#if canImport(CoreFoundation) +import CoreFoundation +#endif +import Dispatch +import Foundation + +private let timeoutLeeway = NimbleTimeInterval.milliseconds(1) +private let pollLeeway = NimbleTimeInterval.milliseconds(1) + +/// Stores debugging information about callers +internal struct WaitingInfo: CustomStringConvertible, Sendable { + let name: String + let file: FileString + let lineNumber: UInt + + var description: String { + return "\(name) at \(file):\(lineNumber)" + } +} + +internal protocol WaitLock { + func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) + func releaseWaitingLock() + func isWaitingLocked() -> Bool +} + +internal final class AssertionWaitLock: WaitLock, @unchecked Sendable { + private var currentWaiter: WaitingInfo? + private let lock = NSRecursiveLock() + + init() { } + + func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { + lock.lock() + defer { lock.unlock() } + let info = WaitingInfo(name: fnName, file: file, lineNumber: line) + nimblePrecondition( + currentWaiter == nil, + "InvalidNimbleAPIUsage", + """ + Nested async expectations are not allowed to avoid creating flaky tests. + + The call to + \t\(info) + triggered this exception because + \t\(currentWaiter!) + is currently managing the main run loop. + """ + ) + currentWaiter = info + } + + func isWaitingLocked() -> Bool { + lock.lock() + defer { lock.unlock() } + return currentWaiter != nil + } + + func releaseWaitingLock() { + lock.lock() + defer { lock.unlock() } + currentWaiter = nil + } +} + +internal enum PollResult { + /// Incomplete indicates None (aka - this value hasn't been fulfilled yet) + case incomplete + /// TimedOut indicates the result reached its defined timeout limit before returning + case timedOut + /// BlockedRunLoop indicates the main runloop is too busy processing other blocks to trigger + /// the timeout code. + /// + /// This may also mean the async code waiting upon may have never actually ran within the + /// required time because other timers & sources are running on the main run loop. + case blockedRunLoop + /// The async block successfully executed and returned a given result + case completed(T) + /// When a Swift Error is thrown + case errorThrown(Error) + /// When an Objective-C Exception is raised + case raisedException(NSException) + + func isIncomplete() -> Bool { + switch self { + case .incomplete: return true + default: return false + } + } + + func isCompleted() -> Bool { + switch self { + case .completed: return true + default: return false + } + } +} + +internal enum PollStatus { + case finished(Bool) + case incomplete +} + +/// Holds the resulting value from an asynchronous expectation. +/// This class is thread-safe at receiving a "response" to this promise. +internal final class AwaitPromise { + private(set) internal var asyncResult: PollResult = .incomplete + private var signal: DispatchSemaphore + + init() { + signal = DispatchSemaphore(value: 1) + } + + deinit { + signal.signal() + } + + /// Resolves the promise with the given result if it has not been resolved. Repeated calls to + /// this method will resolve in a no-op. + /// + /// @returns a Bool that indicates if the async result was accepted or rejected because another + /// value was received first. + @discardableResult + func resolveResult(_ result: PollResult) -> Bool { + if signal.wait(timeout: .now()) == .success { + self.asyncResult = result + return true + } else { + return false + } + } +} + +internal struct PollAwaitTrigger { + let timeoutSource: DispatchSourceTimer + let actionSource: DispatchSourceTimer? + let start: () throws -> Void +} + +/// Factory for building fully configured AwaitPromises and waiting for their results. +/// +/// This factory stores all the state for an async expectation so that Await doesn't +/// doesn't have to manage it. +internal class AwaitPromiseBuilder { + let awaiter: Awaiter + let waitLock: WaitLock + let trigger: PollAwaitTrigger + let promise: AwaitPromise + + internal init( + awaiter: Awaiter, + waitLock: WaitLock, + promise: AwaitPromise, + trigger: PollAwaitTrigger) { + self.awaiter = awaiter + self.waitLock = waitLock + self.promise = promise + self.trigger = trigger + } + + func timeout(_ timeoutInterval: NimbleTimeInterval, forcefullyAbortTimeout: NimbleTimeInterval) -> Self { + /// = Discussion = + /// + /// There's a lot of technical decisions here that is useful to elaborate on. This is + /// definitely more lower-level than the previous NSRunLoop based implementation. + /// + /// + /// Why Dispatch Source? + /// + /// + /// We're using a dispatch source to have better control of the run loop behavior. + /// A timer source gives us deferred-timing control without having to rely as much on + /// a run loop's traditional dispatching machinery (eg - NSTimers, DefaultRunLoopMode, etc.) + /// which is ripe for getting corrupted by application code. + /// + /// And unlike `dispatch_async()`, we can control how likely our code gets prioritized to + /// executed (see leeway parameter) + DISPATCH_TIMER_STRICT. + /// + /// This timer is assumed to run on the HIGH priority queue to ensure it maintains the + /// highest priority over normal application / test code when possible. + /// + /// + /// Run Loop Management + /// + /// In order to properly interrupt the waiting behavior performed by this factory class, + /// this timer stops the main run loop to tell the waiter code that the result should be + /// checked. + /// + /// In addition, stopping the run loop is used to halt code executed on the main run loop. + trigger.timeoutSource.schedule( + deadline: DispatchTime.now() + timeoutInterval.dispatchTimeInterval, + repeating: .never, + leeway: timeoutLeeway.dispatchTimeInterval + ) + trigger.timeoutSource.setEventHandler { + guard self.promise.asyncResult.isIncomplete() else { return } + let timedOutSem = DispatchSemaphore(value: 0) + let semTimedOutOrBlocked = DispatchSemaphore(value: 0) + semTimedOutOrBlocked.signal() + #if canImport(CoreFoundation) + let runLoop = CFRunLoopGetMain() + #if canImport(Darwin) + let runLoopMode = CFRunLoopMode.defaultMode.rawValue + #else + let runLoopMode = kCFRunLoopDefaultMode + #endif + CFRunLoopPerformBlock(runLoop, runLoopMode) { + if semTimedOutOrBlocked.wait(timeout: .now()) == .success { + timedOutSem.signal() + semTimedOutOrBlocked.signal() + if self.promise.resolveResult(.timedOut) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + } + // potentially interrupt blocking code on run loop to let timeout code run + CFRunLoopStop(runLoop) + #else + let runLoop = RunLoop.main + runLoop.perform(inModes: [.default], block: { + if semTimedOutOrBlocked.wait(timeout: .now()) == .success { + timedOutSem.signal() + semTimedOutOrBlocked.signal() + if self.promise.resolveResult(.timedOut) { + RunLoop.main._stop() + } + } + }) + // potentially interrupt blocking code on run loop to let timeout code run + runLoop._stop() + #endif + let now = DispatchTime.now() + forcefullyAbortTimeout.dispatchTimeInterval + let didNotTimeOut = timedOutSem.wait(timeout: now) != .success + let timeoutWasNotTriggered = semTimedOutOrBlocked.wait(timeout: .now()) == .success + if didNotTimeOut && timeoutWasNotTriggered { + if self.promise.resolveResult(.blockedRunLoop) { + #if canImport(CoreFoundation) + CFRunLoopStop(CFRunLoopGetMain()) + #else + RunLoop.main._stop() + #endif + } + } + } + return self + } + + /// Blocks for an asynchronous result. + /// + /// @discussion + /// This function cannot be nested. This is because this function (and it's related methods) + /// coordinate through the main run loop. Tampering with the run loop can cause undesirable behavior. + /// + /// This method will return an AwaitResult in the following cases: + /// + /// - The main run loop is blocked by other operations and the async expectation cannot be + /// be stopped. + /// - The async expectation timed out + /// - The async expectation succeeded + /// - The async expectation raised an unexpected exception (objc) + /// - The async expectation raised an unexpected error (swift) + /// + /// The returned PollResult will NEVER be .incomplete. + func wait(_ fnName: String = #function, file: FileString = #file, line: UInt = #line) -> PollResult { + waitLock.acquireWaitingLock( + fnName, + file: file, + line: line) + + let capture = NMBExceptionCapture(handler: ({ exception in + _ = self.promise.resolveResult(.raisedException(exception)) + }), finally: ({ + self.waitLock.releaseWaitingLock() + })) + capture.tryBlock { + do { + try self.trigger.start() + } catch let error { + _ = self.promise.resolveResult(.errorThrown(error)) + } + self.trigger.timeoutSource.resume() + while self.promise.asyncResult.isIncomplete() { + // Stopping the run loop does not work unless we run only 1 mode + _ = RunLoop.current.run(mode: .default, before: .distantFuture) + } + + self.trigger.timeoutSource.cancel() + if let asyncSource = self.trigger.actionSource { + asyncSource.cancel() + } + } + + return promise.asyncResult + } +} + +internal class Awaiter { + let waitLock: WaitLock + let timeoutQueue: DispatchQueue + let asyncQueue: DispatchQueue + + internal init( + waitLock: WaitLock, + asyncQueue: DispatchQueue, + timeoutQueue: DispatchQueue) { + self.waitLock = waitLock + self.asyncQueue = asyncQueue + self.timeoutQueue = timeoutQueue + } + + internal func createTimerSource(_ queue: DispatchQueue) -> DispatchSourceTimer { + return DispatchSource.makeTimerSource(flags: .strict, queue: queue) + } + + func performBlock( + file: FileString, + line: UInt, + _ closure: @escaping (@escaping (T) -> Void) throws -> Void + ) -> AwaitPromiseBuilder { + let promise = AwaitPromise() + let timeoutSource = createTimerSource(timeoutQueue) + var completionCount = 0 + let trigger = PollAwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { + try closure { result in + completionCount += 1 + if completionCount < 2 { + func completeBlock() { + if promise.resolveResult(.completed(result)) { + #if canImport(CoreFoundation) + CFRunLoopStop(CFRunLoopGetMain()) + #else + RunLoop.main._stop() + #endif + } + } + + if Thread.isMainThread { + completeBlock() + } else { + DispatchQueue.main.async { completeBlock() } + } + } else { + fail("waitUntil(..) expects its completion closure to be only called once", + file: file, line: line) + } + } + } + + return AwaitPromiseBuilder( + awaiter: self, + waitLock: waitLock, + promise: promise, + trigger: trigger) + } + + func poll(_ pollInterval: NimbleTimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { + let promise = AwaitPromise() + let timeoutSource = createTimerSource(timeoutQueue) + let asyncSource = createTimerSource(asyncQueue) + let trigger = PollAwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { + let interval = pollInterval + asyncSource.schedule( + deadline: .now(), + repeating: interval.dispatchTimeInterval, + leeway: pollLeeway.dispatchTimeInterval + ) + asyncSource.setEventHandler { + do { + if let result = try closure() { + if promise.resolveResult(.completed(result)) { + #if canImport(CoreFoundation) + CFRunLoopStop(CFRunLoopGetCurrent()) + #else + RunLoop.current._stop() + #endif + } + } + } catch let error { + if promise.resolveResult(.errorThrown(error)) { + #if canImport(CoreFoundation) + CFRunLoopStop(CFRunLoopGetCurrent()) + #else + RunLoop.current._stop() + #endif + } + } + } + asyncSource.resume() + } + + return AwaitPromiseBuilder( + awaiter: self, + waitLock: waitLock, + promise: promise, + trigger: trigger) + } +} + +internal func pollBlock( + pollInterval: NimbleTimeInterval, + timeoutInterval: NimbleTimeInterval, + file: FileString, + line: UInt, + fnName: String = #function, + expression: @escaping () throws -> PollStatus) -> PollResult { + let awaiter = NimbleEnvironment.activeInstance.awaiter + let result = awaiter.poll(pollInterval) { () throws -> Bool? in + if case .finished(let result) = try expression() { + return result + } + return nil + } + .timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval.divided) + .wait(fnName, file: file, line: line) + + return result +} + +#endif // #if !os(WASI) diff --git a/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift b/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift new file mode 100644 index 0000000..64838ff --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift @@ -0,0 +1,31 @@ +import Foundation + +// Ideally we would always use `StaticString` as the type for tracking the file name +// that expectations originate from, for consistency with `assert` etc. from the +// stdlib, and because recent versions of the XCTest overlay require `StaticString` +// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we +// have to use `String` instead because StaticString can't be generated from Objective-C +#if !canImport(Darwin) +public typealias FileString = StaticString +#else +public typealias FileString = String +#endif + +public final class SourceLocation: NSObject { + public let file: FileString + public let line: UInt + + override init() { + file = "Unknown File" + line = 0 + } + + init(file: FileString, line: UInt) { + self.file = file + self.line = line + } + + override public var description: String { + return "\(file):\(line)" + } +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift b/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift new file mode 100644 index 0000000..88e84bb --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -0,0 +1,188 @@ +import Foundation + +internal func identityAsString(_ value: Any?) -> String { + let anyObject = value as AnyObject? + if let value = anyObject { + return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description + } else { + return "nil" + } +} + +internal func arrayAsString(_ items: [T], joiner: String = ", ") -> String { + return items.reduce("") { accum, item in + let prefix = (accum.isEmpty ? "" : joiner) + return accum + prefix + "\(stringify(item))" + } +} + +/// A type with a customized test output text representation. +/// +/// This textual representation is produced when values will be +/// printed in test runs, and may be useful when producing +/// error messages in custom matchers. +/// +/// - SeeAlso: `CustomDebugStringConvertible` +public protocol TestOutputStringConvertible { + var testDescription: String { get } +} + +extension Double: TestOutputStringConvertible { + public var testDescription: String { + return NSNumber(value: self).testDescription + } +} + +extension Float: TestOutputStringConvertible { + public var testDescription: String { + return NSNumber(value: self).testDescription + } +} + +extension NSNumber: TestOutputStringConvertible { + public var testDescription: String { + let description = self.description + + if description.contains(".") { + let decimalPlaces = description.split(separator: ".")[1] + switch decimalPlaces.count { + case 1: + return String(format: "%0.1f", doubleValue) + case 2: + return String(format: "%0.2f", doubleValue) + case 3: + return String(format: "%0.3f", doubleValue) + default: + return String(format: "%0.4f", doubleValue) + } + } + + return description + } +} + +extension Array: TestOutputStringConvertible { + public var testDescription: String { + let list = self.map(Nimble.stringify).joined(separator: ", ") + return "[\(list)]" + } +} + +extension AnySequence: TestOutputStringConvertible { + public var testDescription: String { + let generator = self.makeIterator() + var strings = [String]() + var value: AnySequence.Element? + + repeat { + value = generator.next() + if let value = value { + strings.append(stringify(value)) + } + } while value != nil + + let list = strings.joined(separator: ", ") + return "[\(list)]" + } +} + +extension NSArray: TestOutputStringConvertible { + public var testDescription: String { + let list = Array(self).map(Nimble.stringify).joined(separator: ", ") + return "(\(list))" + } +} + +extension NSIndexSet: TestOutputStringConvertible { + public var testDescription: String { + let list = Array(self).map(Nimble.stringify).joined(separator: ", ") + return "(\(list))" + } +} + +extension String: TestOutputStringConvertible { + public var testDescription: String { + return self + } +} + +extension Data: TestOutputStringConvertible { + public var testDescription: String { + return "Data" + } +} + +/// +/// Returns a string appropriate for displaying in test output +/// from the provided value. +/// +/// - parameter value: A value that will show up in a test's output. +/// +/// - returns: The string that is returned can be +/// customized per type by conforming a type to the `TestOutputStringConvertible` +/// protocol. When stringifying a non-`TestOutputStringConvertible` type, this +/// function will return the value's debug description and then its +/// normal description if available and in that order. Otherwise it +/// will return the result of constructing a string from the value. +/// +/// - SeeAlso: `TestOutputStringConvertible` +public func stringify(_ value: T?) -> String { + guard let value = value else { return "nil" } + + if let value = value as? TestOutputStringConvertible { + return value.testDescription + } + + if let value = value as? CustomDebugStringConvertible { + return value.debugDescription + } + + return String(describing: value) +} + +#if canImport(Darwin) +@objc public class NMBStringer: NSObject { + @objc public class func stringify(_ obj: Any?) -> String { + return Nimble.stringify(obj) + } +} +#endif + +// MARK: Collection Type Stringers + +/// Attempts to generate a pretty type string for a given value. If the value is of a Objective-C +/// collection type, or a subclass thereof, (e.g. `NSArray`, `NSDictionary`, etc.). +/// This function will return the type name of the root class of the class cluster for better +/// readability (e.g. `NSArray` instead of `__NSArrayI`). +/// +/// For values that don't have a type of an Objective-C collection, this function returns the +/// default type description. +/// +/// - parameter value: A value that will be used to determine a type name. +/// +/// - returns: The name of the class cluster root class for Objective-C collection types, or the +/// the `dynamicType` of the value for values of any other type. +public func prettyCollectionType(_ value: T) -> String { + switch value { + case is NSArray: + return String(describing: NSArray.self) + case is NSDictionary: + return String(describing: NSDictionary.self) + case is NSSet: + return String(describing: NSSet.self) + case is NSIndexSet: + return String(describing: NSIndexSet.self) + default: + return String(describing: value) + } +} + +/// Returns the type name for a given collection type. This overload is used by Swift +/// collection types. +/// +/// - parameter collection: A Swift `CollectionType` value. +/// +/// - returns: A string representing the `dynamicType` of the value. +public func prettyCollectionType(_ collection: T) -> String { + return String(describing: type(of: collection)) +} diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m b/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m new file mode 100644 index 0000000..2ab37ef --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m @@ -0,0 +1,167 @@ +#import "DSL.h" + +#if SWIFT_PACKAGE +@import Nimble; +#else +#if __has_include("Nimble-Swift.h") +#import "Nimble-Swift.h" +#else +#import +#endif +#endif + + +NS_ASSUME_NONNULL_BEGIN + + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBExpectation *__nonnull NMB_expect(id __nullable(^actualBlock)(void), NSString *__nonnull file, NSUInteger line) { + return [[NMBExpectation alloc] initWithActualBlock:actualBlock + negative:NO + file:file + line:line]; +} + +NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSString *file, NSUInteger line) { + return NMB_expect(^id{ + actualBlock(); + return nil; + }, file, line); +} + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line) { + return [NMBExpectation failWithMessage:msg file:file line:line]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beAnInstanceOf(Class expectedClass) { + return [NMBMatcher beAnInstanceOfMatcher:expectedClass]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beAKindOf(Class expectedClass) { + return [NMBMatcher beAKindOfMatcher:expectedClass]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { + return [NMBMatcher beCloseToMatcher:expectedValue within:0.001]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beginWith(id itemElementOrSubstring) { + return [NMBMatcher beginWithMatcher:itemElementOrSubstring]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_beGreaterThan(NSNumber *expectedValue) { + return [NMBMatcher beGreaterThanMatcher:expectedValue]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { + return [NMBMatcher beGreaterThanOrEqualToMatcher:expectedValue]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beIdenticalTo(id expectedInstance) { + return [NMBMatcher beIdenticalToMatcher:expectedInstance]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_be(id expectedInstance) { + return [NMBMatcher beIdenticalToMatcher:expectedInstance]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_beLessThan(NSNumber *expectedValue) { + return [NMBMatcher beLessThanMatcher:expectedValue]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { + return [NMBMatcher beLessThanOrEqualToMatcher:expectedValue]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beTruthy(void) { + return [NMBMatcher beTruthyMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beFalsy(void) { + return [NMBMatcher beFalsyMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beTrue(void) { + return [NMBMatcher beTrueMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beFalse(void) { + return [NMBMatcher beFalseMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beNil(void) { + return [NMBMatcher beNilMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_beEmpty(void) { + return [NMBMatcher beEmptyMatcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_containWithNilTermination(id itemOrSubstring, ...) { + NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; + + if (itemOrSubstring) { + [itemOrSubstringArray addObject:itemOrSubstring]; + + va_list args; + va_start(args, itemOrSubstring); + id next; + while ((next = va_arg(args, id))) { + [itemOrSubstringArray addObject:next]; + } + va_end(args); + } + + return [NMBMatcher containMatcher:itemOrSubstringArray]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_containElementSatisfying(BOOL(^matcher)(id)) { + return [NMBMatcher containElementSatisfyingMatcher:matcher]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_endWith(id itemElementOrSubstring) { + return [NMBMatcher endWithMatcher:itemElementOrSubstring]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_equal(__nullable id expectedValue) { + return [NMBMatcher equalMatcher:expectedValue]; +} + +NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBMatcher *NMB_haveCount(id expectedValue) { + return [NMBMatcher haveCountMatcher:expectedValue]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_match(id expectedValue) { + return [NMBMatcher matchMatcher:expectedValue]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_allPass(id expectedValue) { + return [NMBMatcher allPassMatcher:expectedValue]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_satisfyAnyOfWithMatchers(id matchers) { + return [NMBMatcher satisfyAnyOfMatcher:matchers]; +} + +NIMBLE_EXPORT NMBMatcher *NMB_satisfyAllOfWithMatchers(id matchers) { + return [NMBMatcher satisfyAllOfMatcher:matchers]; +} + +#if !SWIFT_PACKAGE +NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void) { + return [NMBMatcher raiseExceptionMatcher]; +} +#endif + +NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { + return ^(NSTimeInterval timeout, void (^ _Nonnull action)(void (^ _Nonnull)(void))) { + [NMBWait untilTimeout:timeout file:file line:line action:action]; + }; +} + +NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line) { + return ^(void (^ _Nonnull action)(void (^ _Nonnull)(void))) { + [NMBWait untilFile:file line:line action:action]; + }; +} + +NS_ASSUME_NONNULL_END diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m b/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m new file mode 100644 index 0000000..52684b7 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m @@ -0,0 +1,35 @@ +#import "NMBExceptionCapture.h" + +@interface NMBExceptionCapture () +@property (nonatomic, copy) void(^ _Nullable handler)(NSException * _Nullable); +@property (nonatomic, copy) void(^ _Nullable finally)(void); +@end + +@implementation NMBExceptionCapture + +- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally { + self = [super init]; + if (self) { + self.handler = handler; + self.finally = finally; + } + return self; +} + +- (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock { + @try { + unsafeBlock(); + } + @catch (NSException *exception) { + if (self.handler) { + self.handler(exception); + } + } + @finally { + if (self.finally) { + self.finally(); + } + } +} + +@end diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m b/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m new file mode 100644 index 0000000..5890e22 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m @@ -0,0 +1,15 @@ +#import "NMBStringify.h" + +#if SWIFT_PACKAGE +@import Nimble; +#else +#if __has_include("Nimble-Swift.h") +#import "Nimble-Swift.h" +#else +#import +#endif +#endif + +NSString *_Nonnull NMBStringify(id _Nullable anyObject) { + return [NMBStringer stringify:anyObject]; +} diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m b/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m new file mode 100644 index 0000000..4f1ce63 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m @@ -0,0 +1,21 @@ +#import + +#if SWIFT_PACKAGE +@import Nimble; +#else +#if __has_include("Nimble-Swift.h") +#import "Nimble-Swift.h" +#else +#import +#endif +#endif + +#pragma mark - Private + +@implementation XCTestObservationCenter (Register) + ++ (void)load { + [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:[CurrentTestCaseTracker sharedInstance]]; +} + +@end diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/include/DSL.h b/Pods/Nimble/Sources/NimbleObjectiveC/include/DSL.h new file mode 100644 index 0000000..5d20fb1 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/include/DSL.h @@ -0,0 +1,389 @@ +#import + +@class NMBExpectation; +@class NMBMatcher; +@class NMBObjCBeCloseToMatcher; +@class NMBObjCRaiseExceptionMatcher; + + +NS_ASSUME_NONNULL_BEGIN + + +#define NIMBLE_OVERLOADABLE __attribute__((overloadable)) +#define NIMBLE_EXPORT FOUNDATION_EXPORT +#define NIMBLE_EXPORT_INLINE FOUNDATION_STATIC_INLINE + +#define NIMBLE_VALUE_OF(VAL) ({ \ + __typeof__((VAL)) val = (VAL); \ + [NSValue valueWithBytes:&val objCType:@encode(__typeof__((VAL)))]; \ +}) + +#ifdef NIMBLE_DISABLE_SHORT_SYNTAX +#define NIMBLE_SHORT(PROTO, ORIGINAL) +#define NIMBLE_SHORT_OVERLOADED(PROTO, ORIGINAL) +#else +#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); } +#define NIMBLE_SHORT_OVERLOADED(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE NIMBLE_OVERLOADABLE PROTO { return (ORIGINAL); } +#endif + + + +#define DEFINE_NMB_EXPECT_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBExpectation *NMB_expect(TYPE(^actualBlock)(void), NSString *file, NSUInteger line) { \ + return NMB_expect(^id { return EXPR; }, file, line); \ + } + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBExpectation *NMB_expect(id(^actualBlock)(void), NSString *file, NSUInteger line); + + // overloaded dispatch for nils - expect(nil) + DEFINE_NMB_EXPECT_OVERLOAD(void*, nil) + DEFINE_NMB_EXPECT_OVERLOAD(NSRange, NIMBLE_VALUE_OF(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(long, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(unsigned long, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(int, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(unsigned int, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(float, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(double, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(long long, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(unsigned long long, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(char, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(unsigned char, @(actualBlock())) + // bool doesn't get the compiler to dispatch to BOOL types, but using BOOL here seems to allow + // the compiler to dispatch to bool. + DEFINE_NMB_EXPECT_OVERLOAD(BOOL, @(actualBlock())) + DEFINE_NMB_EXPECT_OVERLOAD(char *, @(actualBlock())) + + +#undef DEFINE_NMB_EXPECT_OVERLOAD + + + +NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(void), NSString *file, NSUInteger line); + + + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_equal(TYPE expectedValue) { \ + return NMB_equal((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *equal(TYPE expectedValue), NMB_equal(expectedValue)); + + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_equal(__nullable id expectedValue); + + NIMBLE_SHORT_OVERLOADED(NMBMatcher *equal(__nullable id expectedValue), + NMB_equal(expectedValue)); + + // overloaded dispatch for nils - expect(nil) + DEFINE_OVERLOAD(void*__nullable, (id)nil) + DEFINE_OVERLOAD(NSRange, NIMBLE_VALUE_OF(expectedValue)) + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + // bool doesn't get the compiler to dispatch to BOOL types, but using BOOL here seems to allow + // the compiler to dispatch to bool. + DEFINE_OVERLOAD(BOOL, @(expectedValue)) + DEFINE_OVERLOAD(char *, @(expectedValue)) + +#undef DEFINE_OVERLOAD + + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_haveCount(TYPE expectedValue) { \ + return NMB_haveCount((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *haveCount(TYPE expectedValue), \ + NMB_haveCount(expectedValue)); + + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_haveCount(id expectedValue); + + NIMBLE_SHORT_OVERLOADED(NMBMatcher *haveCount(id expectedValue), + NMB_haveCount(expectedValue)); + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + +#undef DEFINE_OVERLOAD + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBObjCBeCloseToMatcher *NMB_beCloseTo(TYPE expectedValue) { \ + return NMB_beCloseTo((NSNumber *)(EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(TYPE expectedValue), \ + NMB_beCloseTo(expectedValue)); + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); + NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(NSNumber *expectedValue), + NMB_beCloseTo(expectedValue)); + + // it would be better to only overload float & double, but zero becomes ambigious + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + +#undef DEFINE_OVERLOAD + +NIMBLE_EXPORT NMBMatcher *NMB_beAnInstanceOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBMatcher *beAnInstanceOf(Class expectedClass) { + return NMB_beAnInstanceOf(expectedClass); +} + +NIMBLE_EXPORT NMBMatcher *NMB_beAKindOf(Class expectedClass); +NIMBLE_EXPORT_INLINE NMBMatcher *beAKindOf(Class expectedClass) { + return NMB_beAKindOf(expectedClass); +} + +NIMBLE_EXPORT NMBMatcher *NMB_beginWith(id itemElementOrSubstring); +NIMBLE_EXPORT_INLINE NMBMatcher *beginWith(id itemElementOrSubstring) { + return NMB_beginWith(itemElementOrSubstring); +} + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_beGreaterThan(TYPE expectedValue) { \ + return NMB_beGreaterThan((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_beGreaterThan(NSNumber *expectedValue); + + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE + NMBMatcher *beGreaterThan(NSNumber *expectedValue) { + return NMB_beGreaterThan(expectedValue); + } + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + +#undef DEFINE_OVERLOAD + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ + return NMB_beGreaterThanOrEqualTo((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *beGreaterThanOrEqualTo(TYPE expectedValue), \ + NMB_beGreaterThanOrEqualTo(expectedValue)); + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); + + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE + NMBMatcher *beGreaterThanOrEqualTo(NSNumber *expectedValue) { + return NMB_beGreaterThanOrEqualTo(expectedValue); + } + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + + +#undef DEFINE_OVERLOAD + +NIMBLE_EXPORT NMBMatcher *NMB_beIdenticalTo(id expectedInstance); +NIMBLE_SHORT(NMBMatcher *beIdenticalTo(id expectedInstance), + NMB_beIdenticalTo(expectedInstance)); + +NIMBLE_EXPORT NMBMatcher *NMB_be(id expectedInstance); +NIMBLE_SHORT(NMBMatcher *be(id expectedInstance), + NMB_be(expectedInstance)); + + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_beLessThan(TYPE expectedValue) { \ + return NMB_beLessThan((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *beLessThan(TYPE expectedValue), \ + NMB_beLessThan(expectedValue)); + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_beLessThan(NSNumber *expectedValue); + + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE + NMBMatcher *beLessThan(NSNumber *expectedValue) { + return NMB_beLessThan(expectedValue); + } + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + +#undef DEFINE_OVERLOAD + + +#define DEFINE_OVERLOAD(TYPE, EXPR) \ + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ + NMBMatcher *NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ + return NMB_beLessThanOrEqualTo((EXPR)); \ + } \ + NIMBLE_SHORT_OVERLOADED(NMBMatcher *beLessThanOrEqualTo(TYPE expectedValue), \ + NMB_beLessThanOrEqualTo(expectedValue)); + + + NIMBLE_EXPORT NIMBLE_OVERLOADABLE + NMBMatcher *NMB_beLessThanOrEqualTo(NSNumber *expectedValue); + + NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE + NMBMatcher *beLessThanOrEqualTo(NSNumber *expectedValue) { + return NMB_beLessThanOrEqualTo(expectedValue); + } + + DEFINE_OVERLOAD(long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long, @(expectedValue)) + DEFINE_OVERLOAD(int, @(expectedValue)) + DEFINE_OVERLOAD(unsigned int, @(expectedValue)) + DEFINE_OVERLOAD(float, @(expectedValue)) + DEFINE_OVERLOAD(double, @(expectedValue)) + DEFINE_OVERLOAD(long long, @(expectedValue)) + DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) + DEFINE_OVERLOAD(char, @(expectedValue)) + DEFINE_OVERLOAD(unsigned char, @(expectedValue)) + +#undef DEFINE_OVERLOAD + +NIMBLE_EXPORT NMBMatcher *NMB_beTruthy(void); +NIMBLE_SHORT(NMBMatcher *beTruthy(void), + NMB_beTruthy()); + +NIMBLE_EXPORT NMBMatcher *NMB_beFalsy(void); +NIMBLE_SHORT(NMBMatcher *beFalsy(void), + NMB_beFalsy()); + +NIMBLE_EXPORT NMBMatcher *NMB_beTrue(void); +NIMBLE_SHORT(NMBMatcher *beTrue(void), + NMB_beTrue()); + +NIMBLE_EXPORT NMBMatcher *NMB_beFalse(void); +NIMBLE_SHORT(NMBMatcher *beFalse(void), + NMB_beFalse()); + +NIMBLE_EXPORT NMBMatcher *NMB_beNil(void); +NIMBLE_SHORT(NMBMatcher *beNil(void), + NMB_beNil()); + +NIMBLE_EXPORT NMBMatcher *NMB_beEmpty(void); +NIMBLE_SHORT(NMBMatcher *beEmpty(void), + NMB_beEmpty()); + +NIMBLE_EXPORT NMBMatcher *NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; +#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define contain(...) NMB_contain(__VA_ARGS__) +#endif + +NIMBLE_EXPORT NMBMatcher *NMB_containElementSatisfying(BOOL(^matcher)(id)); +NIMBLE_SHORT(NMBMatcher *containElementSatisfying(BOOL(^matcher)(id)), + NMB_containElementSatisfying(matcher)); + +NIMBLE_EXPORT NMBMatcher *NMB_endWith(id itemElementOrSubstring); +NIMBLE_SHORT(NMBMatcher *endWith(id itemElementOrSubstring), + NMB_endWith(itemElementOrSubstring)); + +NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); +NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), + NMB_raiseException()); + +NIMBLE_EXPORT NMBMatcher *NMB_match(id expectedValue); +NIMBLE_SHORT(NMBMatcher *match(id expectedValue), + NMB_match(expectedValue)); + +NIMBLE_EXPORT NMBMatcher *NMB_allPass(id matcher); +NIMBLE_SHORT(NMBMatcher *allPass(id matcher), + NMB_allPass(matcher)); + +NIMBLE_EXPORT NMBMatcher *NMB_satisfyAnyOfWithMatchers(id matchers); +#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) +#endif + +NIMBLE_EXPORT NMBMatcher *NMB_satisfyAllOfWithMatchers(id matchers); +#define NMB_satisfyAllOf(...) NMB_satisfyAllOfWithMatchers(@[__VA_ARGS__]) +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define satisfyAllOf(...) NMB_satisfyAllOf(__VA_ARGS__) +#endif + +// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__, +// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout +// and action arguments. See https://github.com/Quick/Quick/pull/185 for details. +typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void))); +typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void))); + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); + +NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line); +NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line); + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); + +#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__) +#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__) + +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define expect(...) NMB_expect(^{ return (__VA_ARGS__); }, @(__FILE__), __LINE__) +#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__) +#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__) +#define fail() failWithMessage(@"fail() always fails") + + +#define waitUntilTimeout NMB_waitUntilTimeout +#define waitUntil NMB_waitUntil + +#undef NIMBLE_VALUE_OF + +#endif + +NS_ASSUME_NONNULL_END diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBExceptionCapture.h b/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBExceptionCapture.h new file mode 100644 index 0000000..e6e0272 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBExceptionCapture.h @@ -0,0 +1,11 @@ +#import +#import + +@interface NMBExceptionCapture : NSObject + +- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally; +- (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); + +@end + +typedef void(^NMBSourceCallbackBlock)(BOOL successful); diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBStringify.h b/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBStringify.h new file mode 100644 index 0000000..7938bca --- /dev/null +++ b/Pods/Nimble/Sources/NimbleObjectiveC/include/NMBStringify.h @@ -0,0 +1,18 @@ +@class NSString; + +/** + * Returns a string appropriate for displaying in test output + * from the provided value. + * + * @param anyObject A value that will show up in a test's output. + * + * @return The string that is returned can be + * customized per type by conforming a type to the `TestOutputStringConvertible` + * protocol. When stringifying a non-`TestOutputStringConvertible` type, this + * function will return the value's debug description and then its + * normal description if available and in that order. Otherwise it + * will return the result of constructing a string from the value. + * + * @see `TestOutputStringConvertible` + */ +extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); diff --git a/Pods/Nimble/Sources/NimbleSharedTestHelpers/utils.swift b/Pods/Nimble/Sources/NimbleSharedTestHelpers/utils.swift new file mode 100644 index 0000000..ae234c8 --- /dev/null +++ b/Pods/Nimble/Sources/NimbleSharedTestHelpers/utils.swift @@ -0,0 +1,235 @@ +#if !os(WASI) +import Dispatch +#endif +import Foundation +@testable import Nimble +#if SWIFT_PACKAGE && canImport(Darwin) +@testable import NimbleObjectiveC +#endif +import XCTest + +public func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { + var filePath = file + var lineNumber = line + + let recorder = AssertionRecorder() + withAssertionHandler(recorder, file: file, line: line, closure: closure) + + for msg in messages { + var lastFailure: AssertionRecord? + var foundFailureMessage = false + + for assertion in recorder.assertions where assertion.message.stringValue == msg && !assertion.success { + lastFailure = assertion + foundFailureMessage = true + break + } + + if foundFailureMessage { + continue + } + + if preferOriginalSourceLocation { + if let failure = lastFailure { + filePath = failure.location.file + lineNumber = failure.location.line + } + } + + let message: String + if let lastFailure = lastFailure { + message = "Got failure message: \"\(lastFailure.message.stringValue)\", but expected \"\(msg)\"" + } else { + let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } + let knownFailuresJoined = knownFailures.joined(separator: ", ") + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ + } + NimbleAssertionHandler.assert(false, + message: FailureMessage(stringValue: message), + location: SourceLocation(file: filePath, line: lineNumber)) + } +} + +// Verifies that the error message matches the given regex. +public func failsWithErrorRegex(_ regex: String, file: FileString = #file, line: UInt = #line, closure: () throws -> Void) { + let recorder = AssertionRecorder() + withAssertionHandler(recorder, file: file, line: line, closure: closure) + + for assertion in recorder.assertions where assertion.message.stringValue.range(of: regex, options: .regularExpression) != nil && !assertion.success { + return + } + + let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } + let knownFailuresJoined = knownFailures.joined(separator: ", ") + let message = """ + Expected error message to match regex (\(regex)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ + NimbleAssertionHandler.assert(false, + message: FailureMessage(stringValue: message), + location: SourceLocation(file: file, line: line)) +} + +public func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { + failsWithErrorMessage( + [message], + file: file, + line: line, + preferOriginalSourceLocation: preferOriginalSourceLocation, + closure: closure + ) +} + +public func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () throws -> Void) { + failsWithErrorMessage( + "\(message) (use beNil() to match nils)", + file: file, + line: line, + preferOriginalSourceLocation: preferOriginalSourceLocation, + closure: closure + ) +} + +public func failsWithErrorMessage(_ messages: [String], file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () async throws -> Void) async { + var filePath = file + var lineNumber = line + + let recorder = AssertionRecorder() + await withAssertionHandler(recorder, file: file, line: line, closure: closure) + + for msg in messages { + var lastFailure: AssertionRecord? + var foundFailureMessage = false + + for assertion in recorder.assertions where assertion.message.stringValue == msg && !assertion.success { + lastFailure = assertion + foundFailureMessage = true + break + } + + if foundFailureMessage { + continue + } + + if preferOriginalSourceLocation { + if let failure = lastFailure { + filePath = failure.location.file + lineNumber = failure.location.line + } + } + + let message: String + if let lastFailure = lastFailure { + message = "Got failure message: \"\(lastFailure.message.stringValue)\", but expected \"\(msg)\"" + } else { + let knownFailures = recorder.assertions.filter { !$0.success }.map { $0.message.stringValue } + let knownFailuresJoined = knownFailures.joined(separator: ", ") + message = """ + Expected error message (\(msg)), got (\(knownFailuresJoined)) + + Assertions Received: + \(recorder.assertions) + """ + } + NimbleAssertionHandler.assert(false, + message: FailureMessage(stringValue: message), + location: SourceLocation(file: filePath, line: lineNumber)) + } +} + +public func failsWithErrorMessage(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () async throws -> Void) async { + await failsWithErrorMessage( + [message], + file: file, + line: line, + preferOriginalSourceLocation: preferOriginalSourceLocation, + closure: closure + ) +} + +public func failsWithErrorMessageForNil(_ message: String, file: FileString = #file, line: UInt = #line, preferOriginalSourceLocation: Bool = false, closure: () async throws -> Void) async { + await failsWithErrorMessage( + "\(message) (use beNil() to match nils)", + file: file, + line: line, + preferOriginalSourceLocation: preferOriginalSourceLocation, + closure: closure + ) +} + +@discardableResult +public func suppressErrors(closure: () -> T) -> T { + var output: T? + let recorder = AssertionRecorder() + withAssertionHandler(recorder) { + output = closure() + } + return output! +} + +public func producesStatus(_ status: ExpectationStatus, file: FileString = #file, line: UInt = #line, closure: () -> SyncExpectation) { + let expectation = suppressErrors(closure: closure) + + expect(file: file, line: line, expectation.status).to(equal(status)) +} + +public func producesStatus(_ status: ExpectationStatus, file: FileString = #file, line: UInt = #line, closure: () -> AsyncExpectation) { + let expectation = suppressErrors(closure: closure) + + expect(file: file, line: line, expectation.status).to(equal(status)) +} + +#if !os(WASI) +public func deferToMainQueue(action: @escaping () -> Void) { + DispatchQueue.main.async { + Thread.sleep(forTimeInterval: 0.01) + action() + } +} +#endif + +#if canImport(Darwin) +public class NimbleHelper: NSObject { + @objc public class func expectFailureMessage(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { + failsWithErrorMessage(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) + } + + @objc public class func expectFailureMessages(_ messages: [NSString], block: () -> Void, file: FileString, line: UInt) { + failsWithErrorMessage(messages.map({String(describing: $0)}), file: file, line: line, preferOriginalSourceLocation: true, closure: block) + } + + @objc public class func expectFailureMessageForNil(_ message: NSString, block: () -> Void, file: FileString, line: UInt) { + failsWithErrorMessageForNil(String(describing: message), file: file, line: line, preferOriginalSourceLocation: true, closure: block) + } + + @objc public class func expectFailureMessageRegex(_ regex: NSString, block: () -> Void, file: FileString, line: UInt) { + + } +} +#endif + +#if !os(WASI) +extension Date { + public init(dateTimeString: String) { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + let date = dateFormatter.date(from: dateTimeString)! + self.init(timeInterval: 0, since: date) + } +} + +extension NSDate { + public convenience init(dateTimeString: String) { + let date = Date(dateTimeString: dateTimeString) + self.init(timeIntervalSinceReferenceDate: date.timeIntervalSinceReferenceDate) + } +} +#endif diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..fbdf431 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,2456 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 0197623979A778492C933778D80DD791 /* TestSelectorNameProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427FDF816893162B86CD95A8B6ECA6F3 /* TestSelectorNameProvider.swift */; }; + 02862925CA6AC122C7D7FAFA6EAFE9B4 /* BeGreaterThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F716D0A883C3817ABCC3DFCD093A12 /* BeGreaterThan.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 02A19A4480813B8CD5BD418095D21B2B /* CwlPosixPreconditionTesting-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = A06152D2BDE64E2A5494483F26A48791 /* CwlPosixPreconditionTesting-dummy.m */; }; + 05BE0BCB8F600E9095F0949E246AE63F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 072CBEE458E411A7386FEA40EDB74F78 /* ErrorUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF020ABF4E2332FCE7BAA228CEA6F5F0 /* ErrorUtility.swift */; }; + 086E1CE4E10D430F1E947C0EB6EE585D /* Nimble-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B1B115D5D9F328D12E904FB04B999415 /* Nimble-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0A411DB578B132909FECBE652B271BEF /* NMBStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = FBE175B9962D91CD880D0B7F93C35D89 /* NMBStringify.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 0BED3C790949A2E29BB3C56B0C7D0912 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B188395FBCB9792D62AC9A1BF5BD82A /* Stringers.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 0C0D56E489977C4C3AAC657267CBE490 /* Pods-OSPaymentsLib-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FAE50E0E3AD48853025A2E73597E47B /* Pods-OSPaymentsLib-dummy.m */; }; + 104E39CF62CF4D1A95389513C6732A3F /* QuickSelectedTestSuiteBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDD16B3AFA84E81570BD160CB3C2A7E /* QuickSelectedTestSuiteBuilder.swift */; }; + 12D53B67A082D15ED18B4B51CD4C9ABA /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 42C914EA4F30C3E61E293FEFA6D1F328 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1368326833020E1381CC35FE204C0543 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFB2D30DA0F7B20CFFC21F790F4203A /* Equal.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 14FD1319FDF44431950DBE146939F966 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F1174270109F74C66D01348D1F514E /* Expression.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 168E76699C1ADF9D9B8214FD4BB48F44 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 010573E4A5C4F5A5C6D0AFDFB7978306 /* CwlDarwinDefinitions.swift */; }; + 170B8362049B9E7C134C392EF01C1B11 /* Nimble-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B0E6009957030250D61B6963C55C947 /* Nimble-dummy.m */; }; + 1876CE44E8440A4737CF40117A68F309 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0021D8C637CD17D0FA0721864E91ADBE /* DSL+Wait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 19CB73099257045327239879DB6CFCD5 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = CC9F06E5FEEF43271BABE69FE5CD6DA8 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1CC7BC97342645FD4DFCC8C7A445A364 /* QuickConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 305246987AF80E372148798DC39EC054 /* QuickConfiguration.swift */; }; + 1DAF13110AC3B5A462DD10202848DC38 /* ToSucceed.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA7B179133900F7BADE2BF3E46232413 /* ToSucceed.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 210E28965A04075F4DC3960D269F3BFE /* BeAnInstanceOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31E775260D1FD8A55FD7DF970BEDF5C /* BeAnInstanceOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 21601609288258F44177C9A71A1A5012 /* Pods-OSPaymentsLib-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 02F5AF25FD35DDCE251A9006737617A5 /* Pods-OSPaymentsLib-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 23CE269175242B42A00AC562C0446EBC /* BeVoid.swift in Sources */ = {isa = PBXBuildFile; fileRef = F14600C0E9673E4CC7E4EA806FF0E5F3 /* BeVoid.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 2481095DCDF1162F5FA5AF4E9BDB7463 /* QCKDSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B4BC423F6F6DA19672E4D0DDBFF15B30 /* QCKDSL.m */; }; + 2708C3D34AD6410DB563CBCA5205D89F /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5EED09E9911F8688FB72A1FD574D617 /* ThrowError.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 273C2200A3CCD17914F16621CA8918F1 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D7454A7A71134BA53000CEA4197CF29 /* Map.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 27E52183EDFE2F83356620EC190632CC /* BeLessThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FE954440EDA2E7E87A363CA332ABB6D /* BeLessThan.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 28C50DB2279706C3C47A38C9D7DEF9A6 /* AllPass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B9DC5C7E87A938A767BE98EBCC3AC34 /* AllPass.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 2A05C7950CB354EA6FEF8649F3B82067 /* QuickConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 503AB4E90BA02160208142DFCEAD3A05 /* QuickConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2C632E96DC0025A2C0036B7CC037A407 /* CwlMachBadInstructionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DA9BA00CFF48AA3C0D2FC7CA0EA6011 /* CwlMachBadInstructionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2CAA65A58918F5EC6815F86DFF0C9145 /* ExpectationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22C8372C0C245DC0B51C4009E88E5C8D /* ExpectationMessage.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 2D6226020DF075BC08C179CE9D1E57C4 /* QuickSpecBase.h in Headers */ = {isa = PBXBuildFile; fileRef = AD35251EED24E7D573ADCE99E37EBF6D /* QuickSpecBase.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 2DAF34A5F2861544A6F247268044EA97 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7644AFBF58E73F3D0F2AA2474A8268D7 /* SourceLocation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 2F0EA3496EE6BA0E3A41CC09AE663B97 /* StopTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9881E951A68EBF0A090E1E78C38E6A7 /* StopTest.swift */; }; + 30AA415F142E3E5F6E15497D254550E4 /* AsyncDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFF3C577D7D9C6CC62FAC9221ACC9BF6 /* AsyncDSL.swift */; }; + 30C5D12AB6B5B930EFCFADA8ABCBF63B /* AssertionRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2EBB799FB9B932A1E46754C4F5A0944 /* AssertionRecorder.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 386035701616A55133490CC5B7D599A1 /* BeAKindOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34AD4F01F38CB60FFB422A7A72C065FA /* BeAKindOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 39FA1995EBCBC081DF2B2353C50ACC4A /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3CDF327328618001FE959FDD269008 /* HooksPhase.swift */; }; + 3A8AD07A6240BCF821FF670ED4AEA227 /* Requirement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 060983B9072CE76B5C27D0C6F7A26FCE /* Requirement.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 3C0E7EFA4D5514BD647146F181F02F32 /* Behavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 428AA7F17E16C956AA8B0D86D3A6DC25 /* Behavior.swift */; }; + 3CE63C7B763466F2B1E5A50BF4A1C55C /* BeLessThanOrEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = D779B4E1CDC07AF68A9253611560A36D /* BeLessThanOrEqual.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 3E245FE6735FC9C037D4DD30C2EA9C20 /* AsyncExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0A97EB9203D4825B685982429EE22D7 /* AsyncExample.swift */; }; + 4235C79508CB73F9F3960AEFBEE95287 /* AsyncAllPass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C7DDA29CAFB3DB6CA497855D433E8B /* AsyncAllPass.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 43C46479311D1489DAE6A0581448BE0C /* DSL+Require.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ED99CD2818C890CE81D07A9699309F9 /* DSL+Require.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 462F0CA8B3C9AF1257FE0E07BD271087 /* Quick-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C45D995FC0579F56843554DAED0AB29F /* Quick-dummy.m */; }; + 48F8927D667FF87502CD4DD8C200FECB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 49471D499F667B43EE5EB46A43D39EB5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 4C1C46B7FF57E43C3D7037D860510A05 /* URL+FileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6ADA6A1E7D8BFBDD30C695EAB397C74 /* URL+FileName.swift */; }; + 4C9212B5D4D4ABC7C9245E1260987D5A /* Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D3A8BF3C48BD1892DD33A7126753E72F /* Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m */; }; + 4FF46429ED8253B45C2DBCCA6E85D146 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = BC47A61A4228C402DFCE82B29F85BC26 /* mach_excServer.c */; }; + 4FFFE078561455276BD8D7DBBD4B82B7 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B2D42ECB3E82916486FEC9384FA249D /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5031354613E1B45DD616C9428C168A9A /* SatisfyAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11F7DAF34099D8324849BE1BA1898A94 /* SatisfyAllOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 5034FA01DC379A5479D202CC1C2FBE4A /* Equal+TupleArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837E401928ED3F08917C35F9DE2F1D67 /* Equal+TupleArray.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 5053A17F2081784AB080F30B0F5865F4 /* ElementsEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFA1EFABF9C0EE69A3A3FFCFC97C309A /* ElementsEqual.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 50A1759496E2BFBEBD4E4D947BF3EF49 /* CwlPreconditionTesting-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 64FAD5D5D8489BD37FC62F154800B9F3 /* CwlPreconditionTesting-dummy.m */; }; + 534B183FDA625BCEF7D1D3B3AAD90FB8 /* Polling+Require.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8BA4C9986D8F59C1F8DD66594BA5270 /* Polling+Require.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 53A2DF915F7360AC657F9F7118E2C127 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E4331AAF01CB7B1A5791AC2F317893 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 54C73470DE4EFE7038D8BCC96394CB7A /* AsyncTimerSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6650BB42E1D839AEF9C12E5D6D334420 /* AsyncTimerSequence.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 58345F4B6D877E7B7C0F5E62BD617F3B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 58B391FC2D923A51FADDFE09E01D4324 /* CwlBadInstructionException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EF6C7606EB9BAEACB549B0DC7521A3A /* CwlBadInstructionException.swift */; }; + 5A28B94D6EE4BE9349685EECB112D7A6 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D2F7CDABDEF157CC25E87A3FF94D228 /* CwlCatchBadInstruction.swift */; }; + 5F4300F4985C00C7E50879D5DA25069D /* AdapterProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07F6C19E6B79D6A62A98047137C186E4 /* AdapterProtocols.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 608FC9113349A392FAF68461DEE56450 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 61FBDD8958A28F726EE3A66795A628AB /* utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20C1FD548A2F133D7F0735173B4FEF82 /* utils.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 63640E2BAE8AFCD81A8F952297171486 /* Closures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 906140C81634F7F2BBA3F01EFDE88849 /* Closures.swift */; }; + 64705DF3A1868C524870711259043F58 /* EndWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7AFBB5B4125D85D39A72E20725E5FA /* EndWith.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 65D65FA4541FC9393C3A50D04583E0B5 /* QuickSpecBase.m in Sources */ = {isa = PBXBuildFile; fileRef = E25520DDA95FBAE29B03465454EADD45 /* QuickSpecBase.m */; }; + 6B5F43788CF310B9DAD46A09B8DCACD2 /* SuiteHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C9CECA6F1C8F71F9B94D93137EF0EA /* SuiteHooks.swift */; }; + 6C3DB5E93A27526C2717382FFCFEA7C7 /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C319EEB2331278DFC6A67C94D00908B /* DSL.swift */; }; + 717F4536032D9AD18B34543BB16B5785 /* BeLogical.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60BA7DA88753D1953169A962D2A1F11A /* BeLogical.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 73B0052F6EF7783BA3C1A532D75EB1D8 /* CwlMachBadInstructionHandler-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 22860578BE441530DE0EF805F57485CA /* CwlMachBadInstructionHandler-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7531CA08B8E24EDD00485B42BB7DA8FD /* ThrowAssertion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E78EA237A79CA2DE923F31EC39C90FF /* ThrowAssertion.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 771F212CFBA566E4C01AF9ACFB254A05 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 781AF529033437C39A1E1D5CDF9D266D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + 7847936EDCDA1B01C677C31B0D3D4E6C /* Matcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05198D9443349CC308FC2B63E492C461 /* Matcher.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 79DBE9693E2198943A783ABFD29AD8E0 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B98088616FD55D1953AAC7DD9D0DCE1 /* Errors.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 7AE7F1A36F091AC368D7C86B207FFB0E /* AsyncExampleGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28881D40AD493F4CB4F35D16F9BC30E7 /* AsyncExampleGroup.swift */; }; + 7D788AE341F323351D1ADEE5E65F68F2 /* CwlCatchBadInstructionPosix.swift in Sources */ = {isa = PBXBuildFile; fileRef = F38617FFBE06F9A4113A1FF4C8F0EB5B /* CwlCatchBadInstructionPosix.swift */; }; + 7DC09E8ED20036275FF7D0A27143F596 /* CwlCatchException.m in Sources */ = {isa = PBXBuildFile; fileRef = 2703D5CC047D4B818556425E18C03970 /* CwlCatchException.m */; }; + 7FD700715732587DA0D9587E45209ECB /* Quick.h in Headers */ = {isa = PBXBuildFile; fileRef = 60D6820E01BCA61C82E683E13A9A5FAB /* Quick.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8082D3FBF990D28DC8051FD6A2C44650 /* QuickSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F3B1C888E10C2600437AB3BEC1FA572 /* QuickSpec.m */; }; + 8153776DC743A3F708498232C91024EB /* TestState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84952211AB6C6062704AE0C091B569BB /* TestState.swift */; }; + 83464DA07AA59C01E4C5A5D5B736C32E /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 246CA8E9B8172FE91C2D047224A9E94C /* Filter.swift */; }; + 8370BD520FB666EC353C8F721C3675DB /* CurrentSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3666C5127185639B35619163DE5164E9 /* CurrentSpec.swift */; }; + 84EA7731D14E937368671377E4CAD56F /* PostNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F12ECBFA4CC53AB57E018768F98CD00B /* PostNotification.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 883E3CE7566CDAED097D74819DF969A4 /* Polling+AsyncAwait.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7993940D6DB64D4951F356CEFDC450D /* Polling+AsyncAwait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 8982BD9FA66C8988A24C5B03517931A2 /* CwlPosixPreconditionTesting-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 431556E94698D895BBE3D506D2D06048 /* CwlPosixPreconditionTesting-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 89FC9CA354F1BE3BA4947368D6EDA77D /* NMBExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB6F1225A0F71F797015B4DCE1998BE4 /* NMBExpectation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 8A085B7C40368D8F5DFB06CFE8541809 /* AsyncAwait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99BC84518076E755101DF735D5CB217F /* AsyncAwait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 8BA9506936BAF58874A11686DE9209FC /* NimbleXCTestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 981572B1BC0940E3ACB3E4865F13A926 /* NimbleXCTestHandler.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 92D38CFA30428553FA8C7B607F77188B /* MatchError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A827F3B8A11664638D6829EE312B7C0 /* MatchError.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 934BAB9A75561F779175AA12A1BEF3E6 /* BeWithin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33A340E461ABFD5B557BFAEA10B6484A /* BeWithin.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 95E0B03539ADBAFEE8E4F645278FF85A /* QuickObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE7250A5BCFFCD70959A4527E1E5525 /* QuickObjCRuntime.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 97A4451BFC7BBB956541232190ED804E /* NMBExceptionCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B58393042028545F4ACE967F4B5A2C /* NMBExceptionCapture.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 9842709E4F626F7563E9709D28324787 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EBC8F300895E39EA0DF6D6B2B5E6BCD /* XCTest.framework */; }; + 98BF01027C0ED277FA44A5976CCAC48B /* BeGreaterThanOrEqualTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8E0B39232C5995A8C46830D30017957 /* BeGreaterThanOrEqualTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + 9B230DE2E00CC2CA78561DD3DF028339 /* CwlCatchException-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BE3413E1EEA3C3E1DE19AE5BE8440E2 /* CwlCatchException-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9DD804A47165A7BE0A7ABF60B8A198AE /* CwlMachBadInstructionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 02BA9A6B3D35D0E8DBCCF45B2AAA2800 /* CwlMachBadInstructionHandler.m */; }; + 9F65F1675C50F3AEA034A1C7AE105438 /* CwlCatchException-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CE17CB6ADBF606BD40F18E3CFCB080E4 /* CwlCatchException-dummy.m */; }; + 9FEC431B72D606CE1F9A7519ED52F067 /* Expectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DC37FD66556F5AFA0F6C8ED8DFEDDC6 /* Expectation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + A00B5714E574282285C79934F3931973 /* Polling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818508BB86C7028A61F1668B8F393B52 /* Polling.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + A06102F3D994B4F3EE5F7EF68FEBBD22 /* QuickTestObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F256CD46A9ADC44C9665AED5DCAE51AE /* QuickTestObservation.swift */; }; + A17F986159251EAB78F7A14D9CE751CD /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 3696664980112689674627D9EE8CF099 /* DSL.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + A4A2FACD0FBF3480F60A4F6CD7248C36 /* QCKConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A5E6BAD81672C178803F3279DF3F2A /* QCKConfiguration.swift */; }; + A5C6D97101B799F260827304A7A0FEB1 /* QuickConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA3CB1DF6F496D0D192C2CE67B32E2A /* QuickConfiguration.m */; }; + A8743EE43AD09651A91D1C0535590218 /* AsyncBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73F2F55231738EB7D67BD0E2FCA99B10 /* AsyncBehavior.swift */; }; + A8E7FA7DB26F2CE5AB231F60C8211956 /* AsyncSpec+testMethodSelectors.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B9A8B11FC7C1531FCA4B6B2BC51630F /* AsyncSpec+testMethodSelectors.m */; }; + AF73B574BAEA6A4890092B7BB4C5E1EF /* BeEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754297B4F9BC227D7D84B1CB651EF8B4 /* BeEmpty.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + AF8A390A34E0C9260BFC20B123D5330A /* CwlCatchException.h in Headers */ = {isa = PBXBuildFile; fileRef = 81E069ED072343385C014B7B48C416CD /* CwlCatchException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B0024D71B366915E7FF1A526649F2A4C /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D42904EF72A0426F7895677B65F22D5 /* XCTestSuite+QuickTestSuiteBuilder.m */; }; + B01FBBF046DB33409BCAD0CC418B1915 /* Quick-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F8AD33D990DFB47A310ABB106FFCC44 /* Quick-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B1F8913FCD67F4863C2F89120395AEFB /* NimbleEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = E66F8D3D05B48F66C8BB0A0161CE6B23 /* NimbleEnvironment.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + B299AB0AE55C25E6B62F0E6EADBAC7CF /* mach_excServer.h in Headers */ = {isa = PBXBuildFile; fileRef = E618038AC16CB30F3B5E8F40C9F2749B /* mach_excServer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B39DA59A1B61AAF40791929F4CCFDC04 /* FailureMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CBDD353F57D9D94EF81C3AD956CF141 /* FailureMessage.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + B77FF9D43361BBF2AA444C2635415459 /* NSBundle+CurrentTestBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C0117628C789996B8C3ADBE64D0F14 /* NSBundle+CurrentTestBundle.swift */; }; + B84C161C8D6F6D45B54F4A0540EC46BA /* BeNil.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C13876A6C1AC39203D6CB258EB04BA /* BeNil.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + B9DF33D4019BC27D9DFC286EA4889458 /* ContainElementSatisfying.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56E6D71C0EE2A714724EBF17F983257 /* ContainElementSatisfying.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + BAC5FAF0CDF05730BEE178C94C61DF24 /* AsyncSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4479584A655CE3F1DD7D8A74ACFCFD16 /* AsyncSpec.swift */; }; + BE5CB274210C6D83CBF6F2D222FF0C20 /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3960D0AAF8FB8850DFA65C1A58F33EB /* AssertionDispatcher.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + C152028DCCBF496E39ADA0306CE2102E /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A99AE93C9F6B8E96883ABD0C5E6730C /* Example.swift */; }; + C2DB1B3BA2AC1ADA9572527A408E2133 /* BeIdenticalTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C3FCFB435FCD32941C03A1563D1FA50 /* BeIdenticalTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + C2E5477E32519DF248EE41B1E6182E1A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + C5166B8B226EA61D351F98AFC5EF05B7 /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A6E2F0AEDBA03FE3630124BBE5E4C4A /* DSL.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + C5FC81492CFF91B1BAD3417ADF80FC06 /* AsyncExampleHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620C2570C5DD2595C455386F70D838EA /* AsyncExampleHooks.swift */; }; + C70974CDB744D70499372A6AD39711E9 /* World.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC758B9BC4F50D82ED882BB08DC817AC /* World.swift */; }; + C7C0E737E36967917577A44E01367CE1 /* BeginWithPrefix.swift in Sources */ = {isa = PBXBuildFile; fileRef = E46294DD3B28C2E71094B73581F9C462 /* BeginWithPrefix.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + CE845A999012F17514A2F3B857300186 /* Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B1D21BE1B5A742AA9C8EEE801D57559C /* Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D218D06508938E7E60BA9CA24BCB2D7F /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8186012C6C9DB52500D35A7B89FC6684 /* Match.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + D3BD1F7254F7AF70D812D4C965EF54F9 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4975483BFE3CD106070E2F8DD0286676 /* MatcherProtocols.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + D52A6CF8DE6EB018BDC007090B811610 /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB44237D2357864CBA63BAD83C5E21F /* HaveCount.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + D6B4AA83CDA43927DB46E614FC3EDF09 /* AsyncExpression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B4A6523F00DDE83CE65B121647FD8E2 /* AsyncExpression.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + D6DBC83664E74D070050CD81DA0E064C /* BeResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83443A3D70BB725B1D7AB14A9C15E021 /* BeResult.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + D8867B60C823F8B93753E9AAB63CEE9C /* CwlCatchException.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81EE8F55A395438492CA563784B65AF /* CwlCatchException.swift */; }; + DD136D9F0BA4405B4AF7E888FBBC03D0 /* AssertionRecorder+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC2C3FDE19B021EB58A60A72DD2ACBFD /* AssertionRecorder+Async.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + DDC7CA0733F6D405C6E0C56785297B2C /* CwlPreconditionTesting-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB13D18C8050C2E09BB64993CFB979A /* CwlPreconditionTesting-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DEAD70130BED26DFF01DB8335048AE6E /* Equal+Tuple.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1FB77A5A37F5E0F1A113F62AA792B4E /* Equal+Tuple.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + E1A63FD6FBFFA3F07C2AED6C1125BC1E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */; }; + E20BF25CC9FE502D37CED510E7ADFEAC /* PollAwait.swift in Sources */ = {isa = PBXBuildFile; fileRef = E801BCC406D59656CEF188513F018621 /* PollAwait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + E3A03088B7A2305F0C89C83ADB7CA2C1 /* String+C99ExtendedIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B228EA0DD8BC8FAFF20CFE730CDC996 /* String+C99ExtendedIdentifier.swift */; }; + E61B94D072E329A90151493C2CBA4FBB /* SatisfyAnyOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2C37A766EADAD32057A6A484EEADEC6 /* SatisfyAnyOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + E7559E209C22EEC9084F6C26CE4B5ED1 /* SubclassDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E5C2543DA8D4B9393A5FB9ECF49F8D /* SubclassDetection.swift */; }; + EA5E8E6F1D3AA73B3C99473F39C4FF4D /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF100BA1D20D429B60743ABBB177B17 /* RaisesException.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + EAE05B70AA9690C0DA3AD1DC0BC975CD /* BeginWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1878738073B88CF961FE08390412EABE /* BeginWith.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + EB498AC2278DE4F7153349E5EDC46FD7 /* XCTestObservationCenter+Register.m in Sources */ = {isa = PBXBuildFile; fileRef = 314A4C0D938EE986C2A37A6D8BAB1152 /* XCTestObservationCenter+Register.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + EB66279A6CD609B89BEC8BCAE4B304A4 /* QuickTestSuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35F24F73875586851CFD5D87FB6A1EBD /* QuickTestSuite.swift */; }; + EC69AC1DF6EA3752AF91F6FE44840D73 /* CwlCatchExceptionSupport-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ED0CD33F95F0FDEFD02E0DBF797B9204 /* CwlCatchExceptionSupport-dummy.m */; }; + ECAD05FDCA266B54D2890FD130312FFE /* ExampleGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368654B1226C940259AA0FA7B72CEF03 /* ExampleGroup.swift */; }; + ECB25D327813D791F8B04BFDC5C22A56 /* BeCloseTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = FABC44C2BD2F8559216A7708ADA1DBDE /* BeCloseTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + ED602BA6C6EE6083E36E982C1C9E8457 /* QCKDSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 86DC8A84C96ED2ABE0EFC4802822CF77 /* QCKDSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EE219A1D6B7901E2841AF289B9C2D2C4 /* DSL+AsyncAwait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BE289D761E2E1918931D1B4E6C6C5D1 /* DSL+AsyncAwait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + EE87C0C5AA90643DAD9359F5B942EFCA /* NimbleTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957DED59E916A59823E7DAAFE69CEC7F /* NimbleTimeInterval.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + EEBE9B46D49C94CC305245EB3B45A237 /* Contain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C4DF9A0EBA04AE1D0BAFA86ABD22EFF /* Contain.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + F02BFF95B68F481A59DBBA6B85919333 /* AsyncWorld.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCDFEFC7D9A0BC6495AC66BBFE46BAA /* AsyncWorld.swift */; }; + F14C6A7A9EC794B7F60E244D5227E1DE /* AsyncMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D99B7A054EF9EC2955269411275F6E9 /* AsyncMatcher.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; + F2C4FCB88A23C8CD9798ABD09DEDBBB7 /* CwlCatchExceptionSupport-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 70C225AA58E38C105D07EA6123151291 /* CwlCatchExceptionSupport-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3177C284538D6D35D50B39CEFEA3C74 /* CwlMachBadInstructionHandler-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AF635B7E6F47677E46BD2F572AF69D29 /* CwlMachBadInstructionHandler-dummy.m */; }; + F773D7DF42F0698A40A005C797FAF3FD /* ExampleHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83EEBB4AB25331652969E7E9CB405FC /* ExampleHooks.swift */; }; + F80622B10127233EA9F85B364DAFE74C /* World+DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85BA9500FBD3B1098283277F9F751E2F /* World+DSL.swift */; }; + FA3851317E698A50769EE23A523A4D28 /* Callsite.swift in Sources */ = {isa = PBXBuildFile; fileRef = E446EFCAAE611F817204DFD70B47776A /* Callsite.swift */; }; + FC7DA1DAD8367E9D82A2E8BA7D96BFBD /* ExampleMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8C6D9912D990689EE4492AC88B09392 /* ExampleMetadata.swift */; }; + FD9D9565069953A0F3298E34848E8730 /* QuickSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 5BC4FE4A3A2381093059EF05B1395B9A /* QuickSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FF312523DB23087460148A6AEC0E23B9 /* AsyncWorld+DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CA8E4AA787A7D1C62C1A02CE7815436 /* AsyncWorld+DSL.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 680A774DAB6760B2C93AF74888246677 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = CA3D99499260B4C146BBB22670C1D8AD; + remoteInfo = CwlCatchExceptionSupport; + }; + 6DF229CD1960DF7A69CE57688797DB9D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = CA3D99499260B4C146BBB22670C1D8AD; + remoteInfo = CwlCatchExceptionSupport; + }; + 98EA497D27303619F8B18ECC1E663EE7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EB8B23AD889CF5BE4A85CD0D8EF2DF99; + remoteInfo = CwlPosixPreconditionTesting; + }; + A2EA725195BF4DEA0BDF10073FB148C7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 308B5C440C446909122081D367A27A8F; + remoteInfo = CwlCatchException; + }; + B92147CAF60149351DBCDE8A51220C55 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E4D853F6FBAB5A9BDBE843E4EFB22EB7; + remoteInfo = CwlPreconditionTesting; + }; + BDB1986F32302AFBDB2F58B81F2A213D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 308B5C440C446909122081D367A27A8F; + remoteInfo = CwlCatchException; + }; + D37643C36FA2B89036A7873AD2BFA57B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C82891EAB7293DBEE916B21F57E8474D; + remoteInfo = Quick; + }; + D802A6F826E2597180B239E1AECD0EC0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3BBD87E27EAD36B90D168213ED6DC32C; + remoteInfo = CwlMachBadInstructionHandler; + }; + DEE7A76326A3AC448377CDEA4CDAAE68 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E4D853F6FBAB5A9BDBE843E4EFB22EB7; + remoteInfo = CwlPreconditionTesting; + }; + EE2996B22F196FAF55CA8539865BFF97 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6F13695E06195A78EA8A95F8C7ED0D2F; + remoteInfo = Nimble; + }; + F703D2EE1DF327ED02A370536DED54AB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EB8B23AD889CF5BE4A85CD0D8EF2DF99; + remoteInfo = CwlPosixPreconditionTesting; + }; + FE9936BE72A2D9CA0E3D38732DC3AC80 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3BBD87E27EAD36B90D168213ED6DC32C; + remoteInfo = CwlMachBadInstructionHandler; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0021D8C637CD17D0FA0721864E91ADBE /* DSL+Wait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+Wait.swift"; path = "Sources/Nimble/DSL+Wait.swift"; sourceTree = ""; }; + 010573E4A5C4F5A5C6D0AFDFB7978306 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlDarwinDefinitions.swift; path = Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift; sourceTree = ""; }; + 02BA9A6B3D35D0E8DBCCF45B2AAA2800 /* CwlMachBadInstructionHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CwlMachBadInstructionHandler.m; path = Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m; sourceTree = ""; }; + 02C9CECA6F1C8F71F9B94D93137EF0EA /* SuiteHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SuiteHooks.swift; path = Sources/Quick/Hooks/SuiteHooks.swift; sourceTree = ""; }; + 02F5AF25FD35DDCE251A9006737617A5 /* Pods-OSPaymentsLib-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-OSPaymentsLib-umbrella.h"; sourceTree = ""; }; + 05198D9443349CC308FC2B63E492C461 /* Matcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Matcher.swift; path = Sources/Nimble/Matchers/Matcher.swift; sourceTree = ""; }; + 060983B9072CE76B5C27D0C6F7A26FCE /* Requirement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Requirement.swift; path = Sources/Nimble/Requirement.swift; sourceTree = ""; }; + 07B837DB1F58318777C1630726AEA23A /* CwlCatchExceptionSupport.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlCatchExceptionSupport.release.xcconfig; sourceTree = ""; }; + 07D0FF898AFEF00EF5DD10347811C347 /* CwlCatchException.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlCatchException.release.xcconfig; sourceTree = ""; }; + 07F6C19E6B79D6A62A98047137C186E4 /* AdapterProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AdapterProtocols.swift; path = Sources/Nimble/Adapters/AdapterProtocols.swift; sourceTree = ""; }; + 0A2CA0650F7537ACE178096CD0C6BA4C /* Nimble.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Nimble.release.xcconfig; sourceTree = ""; }; + 0A827F3B8A11664638D6829EE312B7C0 /* MatchError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatchError.swift; path = Sources/Nimble/Matchers/MatchError.swift; sourceTree = ""; }; + 0B9A8B11FC7C1531FCA4B6B2BC51630F /* AsyncSpec+testMethodSelectors.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "AsyncSpec+testMethodSelectors.m"; path = "Sources/QuickObjectiveC/AsyncSpec+testMethodSelectors.m"; sourceTree = ""; }; + 0B9DC5C7E87A938A767BE98EBCC3AC34 /* AllPass.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AllPass.swift; path = Sources/Nimble/Matchers/AllPass.swift; sourceTree = ""; }; + 0C319EEB2331278DFC6A67C94D00908B /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Quick/DSL/DSL.swift; sourceTree = ""; }; + 0C4DF9A0EBA04AE1D0BAFA86ABD22EFF /* Contain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Contain.swift; path = Sources/Nimble/Matchers/Contain.swift; sourceTree = ""; }; + 0D631E9908483F9525A6B3F36F16CC61 /* Quick */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Quick; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 0D7454A7A71134BA53000CEA4197CF29 /* Map.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Map.swift; path = Sources/Nimble/Matchers/Map.swift; sourceTree = ""; }; + 0D904E98038DAE649AA050DAE20B884A /* Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap"; sourceTree = ""; }; + 0DC37FD66556F5AFA0F6C8ED8DFEDDC6 /* Expectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expectation.swift; path = Sources/Nimble/Expectation.swift; sourceTree = ""; }; + 107B1F29BE07EF1662B3B4BF2A9E0BE9 /* Pods-OSPaymentsLib-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OSPaymentsLib-acknowledgements.plist"; sourceTree = ""; }; + 11F7DAF34099D8324849BE1BA1898A94 /* SatisfyAllOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SatisfyAllOf.swift; path = Sources/Nimble/Matchers/SatisfyAllOf.swift; sourceTree = ""; }; + 12E8A18E971F2D6544B8344097DFB058 /* CwlPreconditionTesting.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlPreconditionTesting.debug.xcconfig; sourceTree = ""; }; + 183EA06E783DC15564B47398DA299505 /* Pods-OSPaymentsLib-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-OSPaymentsLib-acknowledgements.markdown"; sourceTree = ""; }; + 1878738073B88CF961FE08390412EABE /* BeginWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeginWith.swift; path = Sources/Nimble/Matchers/BeginWith.swift; sourceTree = ""; }; + 1CA8E4AA787A7D1C62C1A02CE7815436 /* AsyncWorld+DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "AsyncWorld+DSL.swift"; path = "Sources/Quick/DSL/AsyncWorld+DSL.swift"; sourceTree = ""; }; + 1CBDD353F57D9D94EF81C3AD956CF141 /* FailureMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FailureMessage.swift; path = Sources/Nimble/FailureMessage.swift; sourceTree = ""; }; + 20C1FD548A2F133D7F0735173B4FEF82 /* utils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = utils.swift; path = Sources/NimbleSharedTestHelpers/utils.swift; sourceTree = ""; }; + 20E1B798DBEB86AC4A92335528B04354 /* CwlCatchExceptionSupport-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlCatchExceptionSupport-prefix.pch"; sourceTree = ""; }; + 220D1365CED5CB83C4C0CE1E3DABD3B0 /* CwlCatchExceptionSupport */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CwlCatchExceptionSupport; path = CwlCatchExceptionSupport.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 22860578BE441530DE0EF805F57485CA /* CwlMachBadInstructionHandler-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlMachBadInstructionHandler-umbrella.h"; sourceTree = ""; }; + 22C8372C0C245DC0B51C4009E88E5C8D /* ExpectationMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpectationMessage.swift; path = Sources/Nimble/ExpectationMessage.swift; sourceTree = ""; }; + 246CA8E9B8172FE91C2D047224A9E94C /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = Sources/Quick/Filter.swift; sourceTree = ""; }; + 2703D5CC047D4B818556425E18C03970 /* CwlCatchException.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CwlCatchException.m; path = Sources/CwlCatchExceptionSupport/CwlCatchException.m; sourceTree = ""; }; + 28881D40AD493F4CB4F35D16F9BC30E7 /* AsyncExampleGroup.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncExampleGroup.swift; path = Sources/Quick/Async/AsyncExampleGroup.swift; sourceTree = ""; }; + 2AF7D9F65D40A8677C2734EE27783405 /* CwlPosixPreconditionTesting-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "CwlPosixPreconditionTesting-Info.plist"; sourceTree = ""; }; + 2B0E6009957030250D61B6963C55C947 /* Nimble-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Nimble-dummy.m"; sourceTree = ""; }; + 2B4A6523F00DDE83CE65B121647FD8E2 /* AsyncExpression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncExpression.swift; path = Sources/Nimble/AsyncExpression.swift; sourceTree = ""; }; + 305246987AF80E372148798DC39EC054 /* QuickConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickConfiguration.swift; path = Sources/Quick/Configuration/QuickConfiguration.swift; sourceTree = ""; }; + 314A4C0D938EE986C2A37A6D8BAB1152 /* XCTestObservationCenter+Register.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestObservationCenter+Register.m"; path = "Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m"; sourceTree = ""; }; + 3188B641B9C20E4D45A0883C087E57FF /* CwlMachBadInstructionHandler.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlMachBadInstructionHandler.debug.xcconfig; sourceTree = ""; }; + 33A340E461ABFD5B557BFAEA10B6484A /* BeWithin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeWithin.swift; path = Sources/Nimble/Matchers/BeWithin.swift; sourceTree = ""; }; + 34AD4F01F38CB60FFB422A7A72C065FA /* BeAKindOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAKindOf.swift; path = Sources/Nimble/Matchers/BeAKindOf.swift; sourceTree = ""; }; + 35F24F73875586851CFD5D87FB6A1EBD /* QuickTestSuite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickTestSuite.swift; path = Sources/Quick/QuickTestSuite.swift; sourceTree = ""; }; + 3666C5127185639B35619163DE5164E9 /* CurrentSpec.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CurrentSpec.swift; path = Sources/Quick/CurrentSpec.swift; sourceTree = ""; }; + 368654B1226C940259AA0FA7B72CEF03 /* ExampleGroup.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleGroup.swift; path = Sources/Quick/ExampleGroup.swift; sourceTree = ""; }; + 3696664980112689674627D9EE8CF099 /* DSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DSL.m; path = Sources/NimbleObjectiveC/DSL.m; sourceTree = ""; }; + 3A99AE93C9F6B8E96883ABD0C5E6730C /* Example.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Example.swift; path = Sources/Quick/Examples/Example.swift; sourceTree = ""; }; + 3BE3413E1EEA3C3E1DE19AE5BE8440E2 /* CwlCatchException-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlCatchException-umbrella.h"; sourceTree = ""; }; + 3CF100BA1D20D429B60743ABBB177B17 /* RaisesException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RaisesException.swift; path = Sources/Nimble/Matchers/RaisesException.swift; sourceTree = ""; }; + 3D2F7CDABDEF157CC25E87A3FF94D228 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlCatchBadInstruction.swift; path = Sources/CwlPreconditionTesting/CwlCatchBadInstruction.swift; sourceTree = ""; }; + 3DA9BA00CFF48AA3C0D2FC7CA0EA6011 /* CwlMachBadInstructionHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CwlMachBadInstructionHandler.h; path = Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h; sourceTree = ""; }; + 3ED99CD2818C890CE81D07A9699309F9 /* DSL+Require.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+Require.swift"; path = "Sources/Nimble/DSL+Require.swift"; sourceTree = ""; }; + 40163553F5FC158BA38AC8108AC7F62B /* CwlMachBadInstructionHandler.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlMachBadInstructionHandler.release.xcconfig; sourceTree = ""; }; + 427FDF816893162B86CD95A8B6ECA6F3 /* TestSelectorNameProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestSelectorNameProvider.swift; path = Sources/Quick/TestSelectorNameProvider.swift; sourceTree = ""; }; + 428AA7F17E16C956AA8B0D86D3A6DC25 /* Behavior.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Behavior.swift; path = Sources/Quick/Behavior.swift; sourceTree = ""; }; + 42C914EA4F30C3E61E293FEFA6D1F328 /* NMBExceptionCapture.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBExceptionCapture.h; path = Sources/NimbleObjectiveC/include/NMBExceptionCapture.h; sourceTree = ""; }; + 431556E94698D895BBE3D506D2D06048 /* CwlPosixPreconditionTesting-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlPosixPreconditionTesting-umbrella.h"; sourceTree = ""; }; + 4479584A655CE3F1DD7D8A74ACFCFD16 /* AsyncSpec.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncSpec.swift; path = Sources/Quick/Async/AsyncSpec.swift; sourceTree = ""; }; + 45F65E1C399788463EB3B81F94BBBD0A /* Quick-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-prefix.pch"; sourceTree = ""; }; + 4975483BFE3CD106070E2F8DD0286676 /* MatcherProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherProtocols.swift; path = Sources/Nimble/Matchers/MatcherProtocols.swift; sourceTree = ""; }; + 49E4331AAF01CB7B1A5791AC2F317893 /* NMBStringify.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBStringify.h; path = Sources/NimbleObjectiveC/include/NMBStringify.h; sourceTree = ""; }; + 4B6E333D4666FC2F1DBFF0A1BC569ECA /* Nimble-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-prefix.pch"; sourceTree = ""; }; + 4C157CC35B7ABF301C81384661B151DC /* Pods-OSPaymentsLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OSPaymentsLib.debug.xcconfig"; sourceTree = ""; }; + 4C3FCFB435FCD32941C03A1563D1FA50 /* BeIdenticalTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeIdenticalTo.swift; path = Sources/Nimble/Matchers/BeIdenticalTo.swift; sourceTree = ""; }; + 4D42904EF72A0426F7895677B65F22D5 /* XCTestSuite+QuickTestSuiteBuilder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestSuite+QuickTestSuiteBuilder.m"; path = "Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m"; sourceTree = ""; }; + 4E78EA237A79CA2DE923F31EC39C90FF /* ThrowAssertion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowAssertion.swift; path = Sources/Nimble/Matchers/ThrowAssertion.swift; sourceTree = ""; }; + 503AB4E90BA02160208142DFCEAD3A05 /* QuickConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickConfiguration.h; path = Sources/QuickObjectiveC/Configuration/QuickConfiguration.h; sourceTree = ""; }; + 560BCAF8AFBA708862FAB6417AB4175D /* CwlMachBadInstructionHandler-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlMachBadInstructionHandler-prefix.pch"; sourceTree = ""; }; + 56EBDC39EB609F54DFA2CDBCE20B63A7 /* CwlPosixPreconditionTesting.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlPosixPreconditionTesting.release.xcconfig; sourceTree = ""; }; + 5AAA74622C8B0B2167156F4EBE359608 /* Pods-OSPaymentsLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OSPaymentsLib.release.xcconfig"; sourceTree = ""; }; + 5B228EA0DD8BC8FAFF20CFE730CDC996 /* String+C99ExtendedIdentifier.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+C99ExtendedIdentifier.swift"; path = "Sources/Quick/String+C99ExtendedIdentifier.swift"; sourceTree = ""; }; + 5BC4FE4A3A2381093059EF05B1395B9A /* QuickSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickSpec.h; path = Sources/QuickObjectiveC/QuickSpec.h; sourceTree = ""; }; + 5EBC8F300895E39EA0DF6D6B2B5E6BCD /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 60BA7DA88753D1953169A962D2A1F11A /* BeLogical.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLogical.swift; path = Sources/Nimble/Matchers/BeLogical.swift; sourceTree = ""; }; + 60D6820E01BCA61C82E683E13A9A5FAB /* Quick.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Quick.h; path = Sources/QuickObjectiveC/Quick.h; sourceTree = ""; }; + 61C7DDA29CAFB3DB6CA497855D433E8B /* AsyncAllPass.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncAllPass.swift; path = Sources/Nimble/Matchers/AsyncAllPass.swift; sourceTree = ""; }; + 620C2570C5DD2595C455386F70D838EA /* AsyncExampleHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncExampleHooks.swift; path = Sources/Quick/Hooks/AsyncExampleHooks.swift; sourceTree = ""; }; + 64921B170418D2F8EF1C54FBA90FDE02 /* CwlCatchExceptionSupport.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlCatchExceptionSupport.debug.xcconfig; sourceTree = ""; }; + 64FAD5D5D8489BD37FC62F154800B9F3 /* CwlPreconditionTesting-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CwlPreconditionTesting-dummy.m"; sourceTree = ""; }; + 6650BB42E1D839AEF9C12E5D6D334420 /* AsyncTimerSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncTimerSequence.swift; path = Sources/Nimble/Utils/AsyncTimerSequence.swift; sourceTree = ""; }; + 66F1174270109F74C66D01348D1F514E /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = Sources/Nimble/Expression.swift; sourceTree = ""; }; + 6A6E2F0AEDBA03FE3630124BBE5E4C4A /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Nimble/DSL.swift; sourceTree = ""; }; + 6BA3CB1DF6F496D0D192C2CE67B32E2A /* QuickConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickConfiguration.m; path = Sources/QuickObjectiveC/Configuration/QuickConfiguration.m; sourceTree = ""; }; + 6BB44237D2357864CBA63BAD83C5E21F /* HaveCount.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HaveCount.swift; path = Sources/Nimble/Matchers/HaveCount.swift; sourceTree = ""; }; + 6BE7250A5BCFFCD70959A4527E1E5525 /* QuickObjCRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickObjCRuntime.h; path = Sources/QuickObjCRuntime/include/QuickObjCRuntime.h; sourceTree = ""; }; + 6D3CDF327328618001FE959FDD269008 /* HooksPhase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HooksPhase.swift; path = Sources/Quick/Hooks/HooksPhase.swift; sourceTree = ""; }; + 6EF6C7606EB9BAEACB549B0DC7521A3A /* CwlBadInstructionException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlBadInstructionException.swift; path = Sources/CwlPreconditionTesting/CwlBadInstructionException.swift; sourceTree = ""; }; + 6FE954440EDA2E7E87A363CA332ABB6D /* BeLessThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThan.swift; path = Sources/Nimble/Matchers/BeLessThan.swift; sourceTree = ""; }; + 70C225AA58E38C105D07EA6123151291 /* CwlCatchExceptionSupport-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlCatchExceptionSupport-umbrella.h"; sourceTree = ""; }; + 72650BCF9E15BA7772C201F04B20DF8A /* Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist"; sourceTree = ""; }; + 72B58393042028545F4ACE967F4B5A2C /* NMBExceptionCapture.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBExceptionCapture.m; path = Sources/NimbleObjectiveC/NMBExceptionCapture.m; sourceTree = ""; }; + 732C335BAE36E8A4C58FB1DAA85E612E /* Quick.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Quick.modulemap; sourceTree = ""; }; + 73F2F55231738EB7D67BD0E2FCA99B10 /* AsyncBehavior.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncBehavior.swift; path = Sources/Quick/Async/AsyncBehavior.swift; sourceTree = ""; }; + 754297B4F9BC227D7D84B1CB651EF8B4 /* BeEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeEmpty.swift; path = Sources/Nimble/Matchers/BeEmpty.swift; sourceTree = ""; }; + 7644AFBF58E73F3D0F2AA2474A8268D7 /* SourceLocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SourceLocation.swift; path = Sources/Nimble/Utils/SourceLocation.swift; sourceTree = ""; }; + 7AB13D18C8050C2E09BB64993CFB979A /* CwlPreconditionTesting-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlPreconditionTesting-umbrella.h"; sourceTree = ""; }; + 7AFB2D30DA0F7B20CFFC21F790F4203A /* Equal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Equal.swift; path = Sources/Nimble/Matchers/Equal.swift; sourceTree = ""; }; + 7B2D42ECB3E82916486FEC9384FA249D /* DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DSL.h; path = Sources/NimbleObjectiveC/include/DSL.h; sourceTree = ""; }; + 7DDD16B3AFA84E81570BD160CB3C2A7E /* QuickSelectedTestSuiteBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickSelectedTestSuiteBuilder.swift; path = Sources/Quick/QuickSelectedTestSuiteBuilder.swift; sourceTree = ""; }; + 7F3B1C888E10C2600437AB3BEC1FA572 /* QuickSpec.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickSpec.m; path = Sources/QuickObjectiveC/QuickSpec.m; sourceTree = ""; }; + 7FAF6F207E838D5D5C9B10D229774CCD /* CwlCatchException.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlCatchException.debug.xcconfig; sourceTree = ""; }; + 818508BB86C7028A61F1668B8F393B52 /* Polling.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Polling.swift; path = Sources/Nimble/Polling.swift; sourceTree = ""; }; + 8186012C6C9DB52500D35A7B89FC6684 /* Match.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Match.swift; path = Sources/Nimble/Matchers/Match.swift; sourceTree = ""; }; + 81E069ED072343385C014B7B48C416CD /* CwlCatchException.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CwlCatchException.h; path = Sources/CwlCatchExceptionSupport/include/CwlCatchException.h; sourceTree = ""; }; + 83443A3D70BB725B1D7AB14A9C15E021 /* BeResult.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeResult.swift; path = Sources/Nimble/Matchers/BeResult.swift; sourceTree = ""; }; + 837E401928ED3F08917C35F9DE2F1D67 /* Equal+TupleArray.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Equal+TupleArray.swift"; path = "Sources/Nimble/Matchers/Equal+TupleArray.swift"; sourceTree = ""; }; + 84952211AB6C6062704AE0C091B569BB /* TestState.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestState.swift; path = Sources/Quick/TestState.swift; sourceTree = ""; }; + 84A5E6BAD81672C178803F3279DF3F2A /* QCKConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QCKConfiguration.swift; path = Sources/Quick/Configuration/QCKConfiguration.swift; sourceTree = ""; }; + 85BA9500FBD3B1098283277F9F751E2F /* World+DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "World+DSL.swift"; path = "Sources/Quick/DSL/World+DSL.swift"; sourceTree = ""; }; + 8691A5A49862A69A0E7B43FCF632BD81 /* Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown"; sourceTree = ""; }; + 86DC8A84C96ED2ABE0EFC4802822CF77 /* QCKDSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QCKDSL.h; path = Sources/QuickObjectiveC/DSL/QCKDSL.h; sourceTree = ""; }; + 898D3821CD6035CCA30F112BAE11DE10 /* Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh"; sourceTree = ""; }; + 8B188395FBCB9792D62AC9A1BF5BD82A /* Stringers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Stringers.swift; path = Sources/Nimble/Utils/Stringers.swift; sourceTree = ""; }; + 8B98088616FD55D1953AAC7DD9D0DCE1 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = Sources/Nimble/Utils/Errors.swift; sourceTree = ""; }; + 8C06596BBCA5557642E7E09A51858B4B /* CwlPosixPreconditionTesting-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlPosixPreconditionTesting-prefix.pch"; sourceTree = ""; }; + 8D99B7A054EF9EC2955269411275F6E9 /* AsyncMatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncMatcher.swift; path = Sources/Nimble/Matchers/AsyncMatcher.swift; sourceTree = ""; }; + 8F8AD33D990DFB47A310ABB106FFCC44 /* Quick-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-umbrella.h"; sourceTree = ""; }; + 8FAE50E0E3AD48853025A2E73597E47B /* Pods-OSPaymentsLib-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-OSPaymentsLib-dummy.m"; sourceTree = ""; }; + 906140C81634F7F2BBA3F01EFDE88849 /* Closures.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Closures.swift; path = Sources/Quick/Hooks/Closures.swift; sourceTree = ""; }; + 922E79F3DE744919AE43C09528485E0E /* Quick.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Quick.debug.xcconfig; sourceTree = ""; }; + 957DED59E916A59823E7DAAFE69CEC7F /* NimbleTimeInterval.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleTimeInterval.swift; path = Sources/Nimble/Utils/NimbleTimeInterval.swift; sourceTree = ""; }; + 9609CBE74715F4BDFAC30EDDF6960A47 /* Nimble.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Nimble.debug.xcconfig; sourceTree = ""; }; + 981572B1BC0940E3ACB3E4865F13A926 /* NimbleXCTestHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleXCTestHandler.swift; path = Sources/Nimble/Adapters/NimbleXCTestHandler.swift; sourceTree = ""; }; + 99BC84518076E755101DF735D5CB217F /* AsyncAwait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncAwait.swift; path = Sources/Nimble/Utils/AsyncAwait.swift; sourceTree = ""; }; + 9BE289D761E2E1918931D1B4E6C6C5D1 /* DSL+AsyncAwait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+AsyncAwait.swift"; path = "Sources/Nimble/DSL+AsyncAwait.swift"; sourceTree = ""; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + A06152D2BDE64E2A5494483F26A48791 /* CwlPosixPreconditionTesting-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CwlPosixPreconditionTesting-dummy.m"; sourceTree = ""; }; + A0A97EB9203D4825B685982429EE22D7 /* AsyncExample.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncExample.swift; path = Sources/Quick/Examples/AsyncExample.swift; sourceTree = ""; }; + A1EB030E8B779E04BF98E7491DF8E4CD /* CwlCatchExceptionSupport.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CwlCatchExceptionSupport.modulemap; sourceTree = ""; }; + A20DC11E3C92801B14EFF334B281E8CA /* CwlCatchExceptionSupport-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "CwlCatchExceptionSupport-Info.plist"; sourceTree = ""; }; + A3960D0AAF8FB8850DFA65C1A58F33EB /* AssertionDispatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionDispatcher.swift; path = Sources/Nimble/Adapters/AssertionDispatcher.swift; sourceTree = ""; }; + A83EEBB4AB25331652969E7E9CB405FC /* ExampleHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleHooks.swift; path = Sources/Quick/Hooks/ExampleHooks.swift; sourceTree = ""; }; + AA4B854E598EEEDE26BB0916ECBA21B3 /* Quick-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Quick-Info.plist"; sourceTree = ""; }; + AD35251EED24E7D573ADCE99E37EBF6D /* QuickSpecBase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickSpecBase.h; path = Sources/QuickObjCRuntime/include/QuickSpecBase.h; sourceTree = ""; }; + AD5DF8CDEC89D9FBE179229C33AA9EC3 /* CwlCatchException-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "CwlCatchException-Info.plist"; sourceTree = ""; }; + AF635B7E6F47677E46BD2F572AF69D29 /* CwlMachBadInstructionHandler-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CwlMachBadInstructionHandler-dummy.m"; sourceTree = ""; }; + AFFBFF09BF4043371F58A7807B75F35A /* CwlMachBadInstructionHandler.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CwlMachBadInstructionHandler.modulemap; sourceTree = ""; }; + B1B115D5D9F328D12E904FB04B999415 /* Nimble-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-umbrella.h"; sourceTree = ""; }; + B1D21BE1B5A742AA9C8EEE801D57559C /* Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h"; sourceTree = ""; }; + B22103AE676FAE45408C0FFCD20688FE /* Pods-OSPaymentsLib-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OSPaymentsLib-Info.plist"; sourceTree = ""; }; + B4BC423F6F6DA19672E4D0DDBFF15B30 /* QCKDSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QCKDSL.m; path = Sources/QuickObjectiveC/DSL/QCKDSL.m; sourceTree = ""; }; + B5E5C2543DA8D4B9393A5FB9ECF49F8D /* SubclassDetection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubclassDetection.swift; path = Sources/Quick/SubclassDetection.swift; sourceTree = ""; }; + B69D8666D871F2F21C4849FB9DC16BDE /* Quick.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Quick.release.xcconfig; sourceTree = ""; }; + B8BA4C9986D8F59C1F8DD66594BA5270 /* Polling+Require.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Polling+Require.swift"; path = "Sources/Nimble/Polling+Require.swift"; sourceTree = ""; }; + BAE263041362D074978BB3B577DF0A05 /* Nimble */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Nimble; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BC47A61A4228C402DFCE82B29F85BC26 /* mach_excServer.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mach_excServer.c; path = Sources/CwlMachBadInstructionHandler/mach_excServer.c; sourceTree = ""; }; + BDF6CC5EE6ACB29381E0A7B825E936BC /* CwlPreconditionTesting-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "CwlPreconditionTesting-Info.plist"; sourceTree = ""; }; + BEB97334DF3B76513D34EB7C70369D82 /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig"; sourceTree = ""; }; + BFCDFEFC7D9A0BC6495AC66BBFE46BAA /* AsyncWorld.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncWorld.swift; path = Sources/Quick/Async/AsyncWorld.swift; sourceTree = ""; }; + C132D6453AE83D32563F487897825298 /* CwlCatchException.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CwlCatchException.modulemap; sourceTree = ""; }; + C45D995FC0579F56843554DAED0AB29F /* Quick-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Quick-dummy.m"; sourceTree = ""; }; + C7993940D6DB64D4951F356CEFDC450D /* Polling+AsyncAwait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Polling+AsyncAwait.swift"; path = "Sources/Nimble/Polling+AsyncAwait.swift"; sourceTree = ""; }; + C914B482E199C7EDA35291B58CEC2E5E /* Pods-OSPaymentsLib */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-OSPaymentsLib"; path = Pods_OSPaymentsLib.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + CB6F1225A0F71F797015B4DCE1998BE4 /* NMBExpectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBExpectation.swift; path = Sources/Nimble/Adapters/NMBExpectation.swift; sourceTree = ""; }; + CC56497384E780278F916D6C57EA4951 /* CwlPreconditionTesting */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CwlPreconditionTesting; path = CwlPreconditionTesting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CC82CA60A225BC73F809E0F8661CC4A0 /* CwlCatchException-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlCatchException-prefix.pch"; sourceTree = ""; }; + CC9F06E5FEEF43271BABE69FE5CD6DA8 /* Nimble.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Nimble.h; path = Sources/Nimble/Nimble.h; sourceTree = ""; }; + CD42A80B2554994C5EAD08D03004B093 /* CwlPosixPreconditionTesting.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CwlPosixPreconditionTesting.modulemap; sourceTree = ""; }; + CD7AFBB5B4125D85D39A72E20725E5FA /* EndWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EndWith.swift; path = Sources/Nimble/Matchers/EndWith.swift; sourceTree = ""; }; + CE17CB6ADBF606BD40F18E3CFCB080E4 /* CwlCatchException-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CwlCatchException-dummy.m"; sourceTree = ""; }; + CFA1EFABF9C0EE69A3A3FFCFC97C309A /* ElementsEqual.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ElementsEqual.swift; path = Sources/Nimble/Matchers/ElementsEqual.swift; sourceTree = ""; }; + D2AD834000B280096FEB80FBEBD9A414 /* CwlPosixPreconditionTesting */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CwlPosixPreconditionTesting; path = CwlPosixPreconditionTesting.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D2EBB799FB9B932A1E46754C4F5A0944 /* AssertionRecorder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionRecorder.swift; path = Sources/Nimble/Adapters/AssertionRecorder.swift; sourceTree = ""; }; + D3A8BF3C48BD1892DD33A7126753E72F /* Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m"; sourceTree = ""; }; + D433C194A6EED6E5DC527AA72FCCF1A4 /* Pods-OSPaymentsLib.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-OSPaymentsLib.modulemap"; sourceTree = ""; }; + D51FDA1819AB5AE370C57A418BF75B10 /* Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist"; sourceTree = ""; }; + D56E6D71C0EE2A714724EBF17F983257 /* ContainElementSatisfying.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ContainElementSatisfying.swift; path = Sources/Nimble/Matchers/ContainElementSatisfying.swift; sourceTree = ""; }; + D5F716D0A883C3817ABCC3DFCD093A12 /* BeGreaterThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThan.swift; path = Sources/Nimble/Matchers/BeGreaterThan.swift; sourceTree = ""; }; + D779B4E1CDC07AF68A9253611560A36D /* BeLessThanOrEqual.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThanOrEqual.swift; path = Sources/Nimble/Matchers/BeLessThanOrEqual.swift; sourceTree = ""; }; + D90157D5CDC0BB15EADC2A1E8149F99C /* CwlPreconditionTesting.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = CwlPreconditionTesting.modulemap; sourceTree = ""; }; + DB4B81CB588224154E8C15DA7196F9E8 /* CwlPreconditionTesting.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlPreconditionTesting.release.xcconfig; sourceTree = ""; }; + DB635A9A4445AB464609BF97A3ED19F4 /* CwlMachBadInstructionHandler-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "CwlMachBadInstructionHandler-Info.plist"; sourceTree = ""; }; + DDA26739F6B5A6C3427A79B507B90119 /* CwlPosixPreconditionTesting.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = CwlPosixPreconditionTesting.debug.xcconfig; sourceTree = ""; }; + E0BC8BB0FE4725CF87EB0A9F5D400FD6 /* CwlCatchException */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CwlCatchException; path = CwlCatchException.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E1176A8E7C8F4162FFCA404BE6EEBB1C /* CwlMachBadInstructionHandler */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CwlMachBadInstructionHandler; path = CwlMachBadInstructionHandler.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E1FB77A5A37F5E0F1A113F62AA792B4E /* Equal+Tuple.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Equal+Tuple.swift"; path = "Sources/Nimble/Matchers/Equal+Tuple.swift"; sourceTree = ""; }; + E25520DDA95FBAE29B03465454EADD45 /* QuickSpecBase.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickSpecBase.m; path = Sources/QuickObjCRuntime/QuickSpecBase.m; sourceTree = ""; }; + E2C37A766EADAD32057A6A484EEADEC6 /* SatisfyAnyOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SatisfyAnyOf.swift; path = Sources/Nimble/Matchers/SatisfyAnyOf.swift; sourceTree = ""; }; + E446EFCAAE611F817204DFD70B47776A /* Callsite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Callsite.swift; path = Sources/Quick/Callsite.swift; sourceTree = ""; }; + E46294DD3B28C2E71094B73581F9C462 /* BeginWithPrefix.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeginWithPrefix.swift; path = Sources/Nimble/Matchers/BeginWithPrefix.swift; sourceTree = ""; }; + E4787C67FB5E67AC58DF19C792484EC6 /* CwlPreconditionTesting-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "CwlPreconditionTesting-prefix.pch"; sourceTree = ""; }; + E519952DFB240624BB93B062F034D560 /* Nimble.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Nimble.modulemap; sourceTree = ""; }; + E5EED09E9911F8688FB72A1FD574D617 /* ThrowError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowError.swift; path = Sources/Nimble/Matchers/ThrowError.swift; sourceTree = ""; }; + E618038AC16CB30F3B5E8F40C9F2749B /* mach_excServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mach_excServer.h; path = Sources/CwlMachBadInstructionHandler/mach_excServer.h; sourceTree = ""; }; + E66F8D3D05B48F66C8BB0A0161CE6B23 /* NimbleEnvironment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleEnvironment.swift; path = Sources/Nimble/Adapters/NimbleEnvironment.swift; sourceTree = ""; }; + E6ADA6A1E7D8BFBDD30C695EAB397C74 /* URL+FileName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URL+FileName.swift"; path = "Sources/Quick/URL+FileName.swift"; sourceTree = ""; }; + E6BD0403A56EB6AA58FE2224C68F73C4 /* Pods-OSPaymentsLib-OSPaymentsLibTests */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-OSPaymentsLib-OSPaymentsLibTests"; path = Pods_OSPaymentsLib_OSPaymentsLibTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E801BCC406D59656CEF188513F018621 /* PollAwait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PollAwait.swift; path = Sources/Nimble/Utils/PollAwait.swift; sourceTree = ""; }; + E8C6D9912D990689EE4492AC88B09392 /* ExampleMetadata.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleMetadata.swift; path = Sources/Quick/Examples/ExampleMetadata.swift; sourceTree = ""; }; + E8E0B39232C5995A8C46830D30017957 /* BeGreaterThanOrEqualTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThanOrEqualTo.swift; path = Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift; sourceTree = ""; }; + E8FFA1A64F61EB44FC28A4BF3EF8248A /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig"; sourceTree = ""; }; + EA20092E8E021F163FDFBD934CA74A12 /* Nimble-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Nimble-Info.plist"; sourceTree = ""; }; + EA7B179133900F7BADE2BF3E46232413 /* ToSucceed.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToSucceed.swift; path = Sources/Nimble/Matchers/ToSucceed.swift; sourceTree = ""; }; + EC2C3FDE19B021EB58A60A72DD2ACBFD /* AssertionRecorder+Async.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "AssertionRecorder+Async.swift"; path = "Sources/Nimble/Adapters/AssertionRecorder+Async.swift"; sourceTree = ""; }; + ED0CD33F95F0FDEFD02E0DBF797B9204 /* CwlCatchExceptionSupport-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "CwlCatchExceptionSupport-dummy.m"; sourceTree = ""; }; + EF020ABF4E2332FCE7BAA228CEA6F5F0 /* ErrorUtility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ErrorUtility.swift; path = Sources/Quick/ErrorUtility.swift; sourceTree = ""; }; + F12ECBFA4CC53AB57E018768F98CD00B /* PostNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PostNotification.swift; path = Sources/Nimble/Matchers/PostNotification.swift; sourceTree = ""; }; + F14600C0E9673E4CC7E4EA806FF0E5F3 /* BeVoid.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeVoid.swift; path = Sources/Nimble/Matchers/BeVoid.swift; sourceTree = ""; }; + F256CD46A9ADC44C9665AED5DCAE51AE /* QuickTestObservation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickTestObservation.swift; path = Sources/Quick/QuickTestObservation.swift; sourceTree = ""; }; + F31E775260D1FD8A55FD7DF970BEDF5C /* BeAnInstanceOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAnInstanceOf.swift; path = Sources/Nimble/Matchers/BeAnInstanceOf.swift; sourceTree = ""; }; + F38617FFBE06F9A4113A1FF4C8F0EB5B /* CwlCatchBadInstructionPosix.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlCatchBadInstructionPosix.swift; path = Sources/CwlPosixPreconditionTesting/CwlCatchBadInstructionPosix.swift; sourceTree = ""; }; + F4C13876A6C1AC39203D6CB258EB04BA /* BeNil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeNil.swift; path = Sources/Nimble/Matchers/BeNil.swift; sourceTree = ""; }; + F81EE8F55A395438492CA563784B65AF /* CwlCatchException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlCatchException.swift; path = Sources/CwlCatchException/CwlCatchException.swift; sourceTree = ""; }; + F8C0117628C789996B8C3ADBE64D0F14 /* NSBundle+CurrentTestBundle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSBundle+CurrentTestBundle.swift"; path = "Sources/Quick/NSBundle+CurrentTestBundle.swift"; sourceTree = ""; }; + F9881E951A68EBF0A090E1E78C38E6A7 /* StopTest.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StopTest.swift; path = Sources/Quick/StopTest.swift; sourceTree = ""; }; + FABC44C2BD2F8559216A7708ADA1DBDE /* BeCloseTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeCloseTo.swift; path = Sources/Nimble/Matchers/BeCloseTo.swift; sourceTree = ""; }; + FBE175B9962D91CD880D0B7F93C35D89 /* NMBStringify.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBStringify.m; path = Sources/NimbleObjectiveC/NMBStringify.m; sourceTree = ""; }; + FC758B9BC4F50D82ED882BB08DC817AC /* World.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = World.swift; path = Sources/Quick/World.swift; sourceTree = ""; }; + FFF3C577D7D9C6CC62FAC9221ACC9BF6 /* AsyncDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncDSL.swift; path = Sources/Quick/DSL/AsyncDSL.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 00757244B0C2072D3CF379717EAA1D46 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 49471D499F667B43EE5EB46A43D39EB5 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 055F5D9893DB522EDD2C99178F8D3DF7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E1A63FD6FBFFA3F07C2AED6C1125BC1E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 06AB854D397AC4F5BD7AFCCCEF728C82 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 781AF529033437C39A1E1D5CDF9D266D /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 494F3A6D18BE72FCBAE9B38C1D8E0858 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 771F212CFBA566E4C01AF9ACFB254A05 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F45D4EFE46A0C5F60578B86D23B8BFF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 05BE0BCB8F600E9095F0949E246AE63F /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 596BC85A4D2B3ED26171A14D3169F031 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 58345F4B6D877E7B7C0F5E62BD617F3B /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 64E0ACB63EA9EAFDF0043C6358BFA99F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 608FC9113349A392FAF68461DEE56450 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A509C1F85B00AF9A9F66030AC855ABE6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C2E5477E32519DF248EE41B1E6182E1A /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B16A71154469AD3EB337051952CE0FC6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 48F8927D667FF87502CD4DD8C200FECB /* Foundation.framework in Frameworks */, + 9842709E4F626F7563E9709D28324787 /* XCTest.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 11F598FBD83EE3D4BBF94518CBC8EBCA /* Quick */ = { + isa = PBXGroup; + children = ( + 73F2F55231738EB7D67BD0E2FCA99B10 /* AsyncBehavior.swift */, + FFF3C577D7D9C6CC62FAC9221ACC9BF6 /* AsyncDSL.swift */, + A0A97EB9203D4825B685982429EE22D7 /* AsyncExample.swift */, + 28881D40AD493F4CB4F35D16F9BC30E7 /* AsyncExampleGroup.swift */, + 620C2570C5DD2595C455386F70D838EA /* AsyncExampleHooks.swift */, + 4479584A655CE3F1DD7D8A74ACFCFD16 /* AsyncSpec.swift */, + 0B9A8B11FC7C1531FCA4B6B2BC51630F /* AsyncSpec+testMethodSelectors.m */, + BFCDFEFC7D9A0BC6495AC66BBFE46BAA /* AsyncWorld.swift */, + 1CA8E4AA787A7D1C62C1A02CE7815436 /* AsyncWorld+DSL.swift */, + 428AA7F17E16C956AA8B0D86D3A6DC25 /* Behavior.swift */, + E446EFCAAE611F817204DFD70B47776A /* Callsite.swift */, + 906140C81634F7F2BBA3F01EFDE88849 /* Closures.swift */, + 3666C5127185639B35619163DE5164E9 /* CurrentSpec.swift */, + 0C319EEB2331278DFC6A67C94D00908B /* DSL.swift */, + EF020ABF4E2332FCE7BAA228CEA6F5F0 /* ErrorUtility.swift */, + 3A99AE93C9F6B8E96883ABD0C5E6730C /* Example.swift */, + 368654B1226C940259AA0FA7B72CEF03 /* ExampleGroup.swift */, + A83EEBB4AB25331652969E7E9CB405FC /* ExampleHooks.swift */, + E8C6D9912D990689EE4492AC88B09392 /* ExampleMetadata.swift */, + 246CA8E9B8172FE91C2D047224A9E94C /* Filter.swift */, + 6D3CDF327328618001FE959FDD269008 /* HooksPhase.swift */, + F8C0117628C789996B8C3ADBE64D0F14 /* NSBundle+CurrentTestBundle.swift */, + 84A5E6BAD81672C178803F3279DF3F2A /* QCKConfiguration.swift */, + 86DC8A84C96ED2ABE0EFC4802822CF77 /* QCKDSL.h */, + B4BC423F6F6DA19672E4D0DDBFF15B30 /* QCKDSL.m */, + 60D6820E01BCA61C82E683E13A9A5FAB /* Quick.h */, + 503AB4E90BA02160208142DFCEAD3A05 /* QuickConfiguration.h */, + 6BA3CB1DF6F496D0D192C2CE67B32E2A /* QuickConfiguration.m */, + 305246987AF80E372148798DC39EC054 /* QuickConfiguration.swift */, + 6BE7250A5BCFFCD70959A4527E1E5525 /* QuickObjCRuntime.h */, + 7DDD16B3AFA84E81570BD160CB3C2A7E /* QuickSelectedTestSuiteBuilder.swift */, + 5BC4FE4A3A2381093059EF05B1395B9A /* QuickSpec.h */, + 7F3B1C888E10C2600437AB3BEC1FA572 /* QuickSpec.m */, + AD35251EED24E7D573ADCE99E37EBF6D /* QuickSpecBase.h */, + E25520DDA95FBAE29B03465454EADD45 /* QuickSpecBase.m */, + F256CD46A9ADC44C9665AED5DCAE51AE /* QuickTestObservation.swift */, + 35F24F73875586851CFD5D87FB6A1EBD /* QuickTestSuite.swift */, + F9881E951A68EBF0A090E1E78C38E6A7 /* StopTest.swift */, + 5B228EA0DD8BC8FAFF20CFE730CDC996 /* String+C99ExtendedIdentifier.swift */, + B5E5C2543DA8D4B9393A5FB9ECF49F8D /* SubclassDetection.swift */, + 02C9CECA6F1C8F71F9B94D93137EF0EA /* SuiteHooks.swift */, + 427FDF816893162B86CD95A8B6ECA6F3 /* TestSelectorNameProvider.swift */, + 84952211AB6C6062704AE0C091B569BB /* TestState.swift */, + E6ADA6A1E7D8BFBDD30C695EAB397C74 /* URL+FileName.swift */, + FC758B9BC4F50D82ED882BB08DC817AC /* World.swift */, + 85BA9500FBD3B1098283277F9F751E2F /* World+DSL.swift */, + 4D42904EF72A0426F7895677B65F22D5 /* XCTestSuite+QuickTestSuiteBuilder.m */, + 76F1A731D21E1E648AE021BFEB46A54C /* Support Files */, + ); + name = Quick; + path = Quick; + sourceTree = ""; + }; + 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 974814B39C0012DECD183BBB91B32103 /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + 2F82A5CDACBB136FE6BFF76416B7B240 /* Support Files */ = { + isa = PBXGroup; + children = ( + CD42A80B2554994C5EAD08D03004B093 /* CwlPosixPreconditionTesting.modulemap */, + A06152D2BDE64E2A5494483F26A48791 /* CwlPosixPreconditionTesting-dummy.m */, + 2AF7D9F65D40A8677C2734EE27783405 /* CwlPosixPreconditionTesting-Info.plist */, + 8C06596BBCA5557642E7E09A51858B4B /* CwlPosixPreconditionTesting-prefix.pch */, + 431556E94698D895BBE3D506D2D06048 /* CwlPosixPreconditionTesting-umbrella.h */, + DDA26739F6B5A6C3427A79B507B90119 /* CwlPosixPreconditionTesting.debug.xcconfig */, + 56EBDC39EB609F54DFA2CDBCE20B63A7 /* CwlPosixPreconditionTesting.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/CwlPosixPreconditionTesting"; + sourceTree = ""; + }; + 46BB300026DAEDD896A8373BC7650756 /* Pods */ = { + isa = PBXGroup; + children = ( + E30B15A48E136E6BA9936A9AAE8CBEC6 /* CwlCatchException */, + 926F3AC5930A50CB14D9C7ACD3083F22 /* CwlCatchExceptionSupport */, + C31B7B756668C971537F77F667AA66A6 /* CwlMachBadInstructionHandler */, + FD6E2C2132E1687F77671AFD0994FB9A /* CwlPosixPreconditionTesting */, + 929486BB9CB62376AA3EBAB0F79C1949 /* CwlPreconditionTesting */, + 8BFDF819C64EE274CBD3DA3757DC9969 /* Nimble */, + 11F598FBD83EE3D4BBF94518CBC8EBCA /* Quick */, + ); + name = Pods; + sourceTree = ""; + }; + 46F0087507A0AAD50FB158AA72B6BD9A /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + E0CF605A153CEE673050F1700727599C /* Pods-OSPaymentsLib */, + AAE5607300A4E45071C10DF6B35A33C1 /* Pods-OSPaymentsLib-OSPaymentsLibTests */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 4BBD1D1395315A60891479192D08E5F2 /* Support Files */ = { + isa = PBXGroup; + children = ( + E519952DFB240624BB93B062F034D560 /* Nimble.modulemap */, + 2B0E6009957030250D61B6963C55C947 /* Nimble-dummy.m */, + EA20092E8E021F163FDFBD934CA74A12 /* Nimble-Info.plist */, + 4B6E333D4666FC2F1DBFF0A1BC569ECA /* Nimble-prefix.pch */, + B1B115D5D9F328D12E904FB04B999415 /* Nimble-umbrella.h */, + 9609CBE74715F4BDFAC30EDDF6960A47 /* Nimble.debug.xcconfig */, + 0A2CA0650F7537ACE178096CD0C6BA4C /* Nimble.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/Nimble"; + sourceTree = ""; + }; + 76F1A731D21E1E648AE021BFEB46A54C /* Support Files */ = { + isa = PBXGroup; + children = ( + 732C335BAE36E8A4C58FB1DAA85E612E /* Quick.modulemap */, + C45D995FC0579F56843554DAED0AB29F /* Quick-dummy.m */, + AA4B854E598EEEDE26BB0916ECBA21B3 /* Quick-Info.plist */, + 45F65E1C399788463EB3B81F94BBBD0A /* Quick-prefix.pch */, + 8F8AD33D990DFB47A310ABB106FFCC44 /* Quick-umbrella.h */, + 922E79F3DE744919AE43C09528485E0E /* Quick.debug.xcconfig */, + B69D8666D871F2F21C4849FB9DC16BDE /* Quick.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/Quick"; + sourceTree = ""; + }; + 8BFDF819C64EE274CBD3DA3757DC9969 /* Nimble */ = { + isa = PBXGroup; + children = ( + 07F6C19E6B79D6A62A98047137C186E4 /* AdapterProtocols.swift */, + 0B9DC5C7E87A938A767BE98EBCC3AC34 /* AllPass.swift */, + A3960D0AAF8FB8850DFA65C1A58F33EB /* AssertionDispatcher.swift */, + D2EBB799FB9B932A1E46754C4F5A0944 /* AssertionRecorder.swift */, + EC2C3FDE19B021EB58A60A72DD2ACBFD /* AssertionRecorder+Async.swift */, + 61C7DDA29CAFB3DB6CA497855D433E8B /* AsyncAllPass.swift */, + 99BC84518076E755101DF735D5CB217F /* AsyncAwait.swift */, + 2B4A6523F00DDE83CE65B121647FD8E2 /* AsyncExpression.swift */, + 8D99B7A054EF9EC2955269411275F6E9 /* AsyncMatcher.swift */, + 6650BB42E1D839AEF9C12E5D6D334420 /* AsyncTimerSequence.swift */, + 34AD4F01F38CB60FFB422A7A72C065FA /* BeAKindOf.swift */, + F31E775260D1FD8A55FD7DF970BEDF5C /* BeAnInstanceOf.swift */, + FABC44C2BD2F8559216A7708ADA1DBDE /* BeCloseTo.swift */, + 754297B4F9BC227D7D84B1CB651EF8B4 /* BeEmpty.swift */, + 1878738073B88CF961FE08390412EABE /* BeginWith.swift */, + E46294DD3B28C2E71094B73581F9C462 /* BeginWithPrefix.swift */, + D5F716D0A883C3817ABCC3DFCD093A12 /* BeGreaterThan.swift */, + E8E0B39232C5995A8C46830D30017957 /* BeGreaterThanOrEqualTo.swift */, + 4C3FCFB435FCD32941C03A1563D1FA50 /* BeIdenticalTo.swift */, + 6FE954440EDA2E7E87A363CA332ABB6D /* BeLessThan.swift */, + D779B4E1CDC07AF68A9253611560A36D /* BeLessThanOrEqual.swift */, + 60BA7DA88753D1953169A962D2A1F11A /* BeLogical.swift */, + F4C13876A6C1AC39203D6CB258EB04BA /* BeNil.swift */, + 83443A3D70BB725B1D7AB14A9C15E021 /* BeResult.swift */, + F14600C0E9673E4CC7E4EA806FF0E5F3 /* BeVoid.swift */, + 33A340E461ABFD5B557BFAEA10B6484A /* BeWithin.swift */, + 0C4DF9A0EBA04AE1D0BAFA86ABD22EFF /* Contain.swift */, + D56E6D71C0EE2A714724EBF17F983257 /* ContainElementSatisfying.swift */, + 7B2D42ECB3E82916486FEC9384FA249D /* DSL.h */, + 3696664980112689674627D9EE8CF099 /* DSL.m */, + 6A6E2F0AEDBA03FE3630124BBE5E4C4A /* DSL.swift */, + 9BE289D761E2E1918931D1B4E6C6C5D1 /* DSL+AsyncAwait.swift */, + 3ED99CD2818C890CE81D07A9699309F9 /* DSL+Require.swift */, + 0021D8C637CD17D0FA0721864E91ADBE /* DSL+Wait.swift */, + CFA1EFABF9C0EE69A3A3FFCFC97C309A /* ElementsEqual.swift */, + CD7AFBB5B4125D85D39A72E20725E5FA /* EndWith.swift */, + 7AFB2D30DA0F7B20CFFC21F790F4203A /* Equal.swift */, + E1FB77A5A37F5E0F1A113F62AA792B4E /* Equal+Tuple.swift */, + 837E401928ED3F08917C35F9DE2F1D67 /* Equal+TupleArray.swift */, + 8B98088616FD55D1953AAC7DD9D0DCE1 /* Errors.swift */, + 0DC37FD66556F5AFA0F6C8ED8DFEDDC6 /* Expectation.swift */, + 22C8372C0C245DC0B51C4009E88E5C8D /* ExpectationMessage.swift */, + 66F1174270109F74C66D01348D1F514E /* Expression.swift */, + 1CBDD353F57D9D94EF81C3AD956CF141 /* FailureMessage.swift */, + 6BB44237D2357864CBA63BAD83C5E21F /* HaveCount.swift */, + 0D7454A7A71134BA53000CEA4197CF29 /* Map.swift */, + 8186012C6C9DB52500D35A7B89FC6684 /* Match.swift */, + 05198D9443349CC308FC2B63E492C461 /* Matcher.swift */, + 4975483BFE3CD106070E2F8DD0286676 /* MatcherProtocols.swift */, + 0A827F3B8A11664638D6829EE312B7C0 /* MatchError.swift */, + CC9F06E5FEEF43271BABE69FE5CD6DA8 /* Nimble.h */, + E66F8D3D05B48F66C8BB0A0161CE6B23 /* NimbleEnvironment.swift */, + 957DED59E916A59823E7DAAFE69CEC7F /* NimbleTimeInterval.swift */, + 981572B1BC0940E3ACB3E4865F13A926 /* NimbleXCTestHandler.swift */, + 42C914EA4F30C3E61E293FEFA6D1F328 /* NMBExceptionCapture.h */, + 72B58393042028545F4ACE967F4B5A2C /* NMBExceptionCapture.m */, + CB6F1225A0F71F797015B4DCE1998BE4 /* NMBExpectation.swift */, + 49E4331AAF01CB7B1A5791AC2F317893 /* NMBStringify.h */, + FBE175B9962D91CD880D0B7F93C35D89 /* NMBStringify.m */, + E801BCC406D59656CEF188513F018621 /* PollAwait.swift */, + 818508BB86C7028A61F1668B8F393B52 /* Polling.swift */, + C7993940D6DB64D4951F356CEFDC450D /* Polling+AsyncAwait.swift */, + B8BA4C9986D8F59C1F8DD66594BA5270 /* Polling+Require.swift */, + F12ECBFA4CC53AB57E018768F98CD00B /* PostNotification.swift */, + 3CF100BA1D20D429B60743ABBB177B17 /* RaisesException.swift */, + 060983B9072CE76B5C27D0C6F7A26FCE /* Requirement.swift */, + 11F7DAF34099D8324849BE1BA1898A94 /* SatisfyAllOf.swift */, + E2C37A766EADAD32057A6A484EEADEC6 /* SatisfyAnyOf.swift */, + 7644AFBF58E73F3D0F2AA2474A8268D7 /* SourceLocation.swift */, + 8B188395FBCB9792D62AC9A1BF5BD82A /* Stringers.swift */, + 4E78EA237A79CA2DE923F31EC39C90FF /* ThrowAssertion.swift */, + E5EED09E9911F8688FB72A1FD574D617 /* ThrowError.swift */, + EA7B179133900F7BADE2BF3E46232413 /* ToSucceed.swift */, + 20C1FD548A2F133D7F0735173B4FEF82 /* utils.swift */, + 314A4C0D938EE986C2A37A6D8BAB1152 /* XCTestObservationCenter+Register.m */, + 4BBD1D1395315A60891479192D08E5F2 /* Support Files */, + ); + name = Nimble; + path = Nimble; + sourceTree = ""; + }; + 8FE4B53D6F758AB3141EBDB226457CAF /* Support Files */ = { + isa = PBXGroup; + children = ( + A1EB030E8B779E04BF98E7491DF8E4CD /* CwlCatchExceptionSupport.modulemap */, + ED0CD33F95F0FDEFD02E0DBF797B9204 /* CwlCatchExceptionSupport-dummy.m */, + A20DC11E3C92801B14EFF334B281E8CA /* CwlCatchExceptionSupport-Info.plist */, + 20E1B798DBEB86AC4A92335528B04354 /* CwlCatchExceptionSupport-prefix.pch */, + 70C225AA58E38C105D07EA6123151291 /* CwlCatchExceptionSupport-umbrella.h */, + 64921B170418D2F8EF1C54FBA90FDE02 /* CwlCatchExceptionSupport.debug.xcconfig */, + 07B837DB1F58318777C1630726AEA23A /* CwlCatchExceptionSupport.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/CwlCatchExceptionSupport"; + sourceTree = ""; + }; + 926F3AC5930A50CB14D9C7ACD3083F22 /* CwlCatchExceptionSupport */ = { + isa = PBXGroup; + children = ( + 81E069ED072343385C014B7B48C416CD /* CwlCatchException.h */, + 2703D5CC047D4B818556425E18C03970 /* CwlCatchException.m */, + 8FE4B53D6F758AB3141EBDB226457CAF /* Support Files */, + ); + name = CwlCatchExceptionSupport; + path = CwlCatchExceptionSupport; + sourceTree = ""; + }; + 929486BB9CB62376AA3EBAB0F79C1949 /* CwlPreconditionTesting */ = { + isa = PBXGroup; + children = ( + 6EF6C7606EB9BAEACB549B0DC7521A3A /* CwlBadInstructionException.swift */, + 3D2F7CDABDEF157CC25E87A3FF94D228 /* CwlCatchBadInstruction.swift */, + 010573E4A5C4F5A5C6D0AFDFB7978306 /* CwlDarwinDefinitions.swift */, + EFB59DDF320C3C29DE2D0C303E7D7CF6 /* Support Files */, + ); + name = CwlPreconditionTesting; + path = CwlPreconditionTesting; + sourceTree = ""; + }; + 974814B39C0012DECD183BBB91B32103 /* iOS */ = { + isa = PBXGroup; + children = ( + CA8B94E9D3B433157168D1EECCEC11CD /* Foundation.framework */, + 5EBC8F300895E39EA0DF6D6B2B5E6BCD /* XCTest.framework */, + ); + name = iOS; + sourceTree = ""; + }; + AAE5607300A4E45071C10DF6B35A33C1 /* Pods-OSPaymentsLib-OSPaymentsLibTests */ = { + isa = PBXGroup; + children = ( + 0D904E98038DAE649AA050DAE20B884A /* Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap */, + 8691A5A49862A69A0E7B43FCF632BD81 /* Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown */, + D51FDA1819AB5AE370C57A418BF75B10 /* Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist */, + D3A8BF3C48BD1892DD33A7126753E72F /* Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m */, + 898D3821CD6035CCA30F112BAE11DE10 /* Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh */, + 72650BCF9E15BA7772C201F04B20DF8A /* Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist */, + B1D21BE1B5A742AA9C8EEE801D57559C /* Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h */, + E8FFA1A64F61EB44FC28A4BF3EF8248A /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */, + BEB97334DF3B76513D34EB7C70369D82 /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */, + ); + name = "Pods-OSPaymentsLib-OSPaymentsLibTests"; + path = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests"; + sourceTree = ""; + }; + BF0AF404D2650AA579B25455EFC11293 /* Support Files */ = { + isa = PBXGroup; + children = ( + C132D6453AE83D32563F487897825298 /* CwlCatchException.modulemap */, + CE17CB6ADBF606BD40F18E3CFCB080E4 /* CwlCatchException-dummy.m */, + AD5DF8CDEC89D9FBE179229C33AA9EC3 /* CwlCatchException-Info.plist */, + CC82CA60A225BC73F809E0F8661CC4A0 /* CwlCatchException-prefix.pch */, + 3BE3413E1EEA3C3E1DE19AE5BE8440E2 /* CwlCatchException-umbrella.h */, + 7FAF6F207E838D5D5C9B10D229774CCD /* CwlCatchException.debug.xcconfig */, + 07D0FF898AFEF00EF5DD10347811C347 /* CwlCatchException.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/CwlCatchException"; + sourceTree = ""; + }; + C31B7B756668C971537F77F667AA66A6 /* CwlMachBadInstructionHandler */ = { + isa = PBXGroup; + children = ( + 3DA9BA00CFF48AA3C0D2FC7CA0EA6011 /* CwlMachBadInstructionHandler.h */, + 02BA9A6B3D35D0E8DBCCF45B2AAA2800 /* CwlMachBadInstructionHandler.m */, + BC47A61A4228C402DFCE82B29F85BC26 /* mach_excServer.c */, + E618038AC16CB30F3B5E8F40C9F2749B /* mach_excServer.h */, + C8FFA132FB5C6E413998055C39489863 /* Support Files */, + ); + name = CwlMachBadInstructionHandler; + path = CwlMachBadInstructionHandler; + sourceTree = ""; + }; + C8FFA132FB5C6E413998055C39489863 /* Support Files */ = { + isa = PBXGroup; + children = ( + AFFBFF09BF4043371F58A7807B75F35A /* CwlMachBadInstructionHandler.modulemap */, + AF635B7E6F47677E46BD2F572AF69D29 /* CwlMachBadInstructionHandler-dummy.m */, + DB635A9A4445AB464609BF97A3ED19F4 /* CwlMachBadInstructionHandler-Info.plist */, + 560BCAF8AFBA708862FAB6417AB4175D /* CwlMachBadInstructionHandler-prefix.pch */, + 22860578BE441530DE0EF805F57485CA /* CwlMachBadInstructionHandler-umbrella.h */, + 3188B641B9C20E4D45A0883C087E57FF /* CwlMachBadInstructionHandler.debug.xcconfig */, + 40163553F5FC158BA38AC8108AC7F62B /* CwlMachBadInstructionHandler.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/CwlMachBadInstructionHandler"; + sourceTree = ""; + }; + CF1408CF629C7361332E53B88F7BD30C = { + isa = PBXGroup; + children = ( + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, + 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */, + 46BB300026DAEDD896A8373BC7650756 /* Pods */, + D36E011A466B185884474A745A7D054F /* Products */, + 46F0087507A0AAD50FB158AA72B6BD9A /* Targets Support Files */, + ); + sourceTree = ""; + }; + D36E011A466B185884474A745A7D054F /* Products */ = { + isa = PBXGroup; + children = ( + E0BC8BB0FE4725CF87EB0A9F5D400FD6 /* CwlCatchException */, + 220D1365CED5CB83C4C0CE1E3DABD3B0 /* CwlCatchExceptionSupport */, + E1176A8E7C8F4162FFCA404BE6EEBB1C /* CwlMachBadInstructionHandler */, + D2AD834000B280096FEB80FBEBD9A414 /* CwlPosixPreconditionTesting */, + CC56497384E780278F916D6C57EA4951 /* CwlPreconditionTesting */, + BAE263041362D074978BB3B577DF0A05 /* Nimble */, + C914B482E199C7EDA35291B58CEC2E5E /* Pods-OSPaymentsLib */, + E6BD0403A56EB6AA58FE2224C68F73C4 /* Pods-OSPaymentsLib-OSPaymentsLibTests */, + 0D631E9908483F9525A6B3F36F16CC61 /* Quick */, + ); + name = Products; + sourceTree = ""; + }; + E0CF605A153CEE673050F1700727599C /* Pods-OSPaymentsLib */ = { + isa = PBXGroup; + children = ( + D433C194A6EED6E5DC527AA72FCCF1A4 /* Pods-OSPaymentsLib.modulemap */, + 183EA06E783DC15564B47398DA299505 /* Pods-OSPaymentsLib-acknowledgements.markdown */, + 107B1F29BE07EF1662B3B4BF2A9E0BE9 /* Pods-OSPaymentsLib-acknowledgements.plist */, + 8FAE50E0E3AD48853025A2E73597E47B /* Pods-OSPaymentsLib-dummy.m */, + B22103AE676FAE45408C0FFCD20688FE /* Pods-OSPaymentsLib-Info.plist */, + 02F5AF25FD35DDCE251A9006737617A5 /* Pods-OSPaymentsLib-umbrella.h */, + 4C157CC35B7ABF301C81384661B151DC /* Pods-OSPaymentsLib.debug.xcconfig */, + 5AAA74622C8B0B2167156F4EBE359608 /* Pods-OSPaymentsLib.release.xcconfig */, + ); + name = "Pods-OSPaymentsLib"; + path = "Target Support Files/Pods-OSPaymentsLib"; + sourceTree = ""; + }; + E30B15A48E136E6BA9936A9AAE8CBEC6 /* CwlCatchException */ = { + isa = PBXGroup; + children = ( + F81EE8F55A395438492CA563784B65AF /* CwlCatchException.swift */, + BF0AF404D2650AA579B25455EFC11293 /* Support Files */, + ); + name = CwlCatchException; + path = CwlCatchException; + sourceTree = ""; + }; + EFB59DDF320C3C29DE2D0C303E7D7CF6 /* Support Files */ = { + isa = PBXGroup; + children = ( + D90157D5CDC0BB15EADC2A1E8149F99C /* CwlPreconditionTesting.modulemap */, + 64FAD5D5D8489BD37FC62F154800B9F3 /* CwlPreconditionTesting-dummy.m */, + BDF6CC5EE6ACB29381E0A7B825E936BC /* CwlPreconditionTesting-Info.plist */, + E4787C67FB5E67AC58DF19C792484EC6 /* CwlPreconditionTesting-prefix.pch */, + 7AB13D18C8050C2E09BB64993CFB979A /* CwlPreconditionTesting-umbrella.h */, + 12E8A18E971F2D6544B8344097DFB058 /* CwlPreconditionTesting.debug.xcconfig */, + DB4B81CB588224154E8C15DA7196F9E8 /* CwlPreconditionTesting.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/CwlPreconditionTesting"; + sourceTree = ""; + }; + FD6E2C2132E1687F77671AFD0994FB9A /* CwlPosixPreconditionTesting */ = { + isa = PBXGroup; + children = ( + F38617FFBE06F9A4113A1FF4C8F0EB5B /* CwlCatchBadInstructionPosix.swift */, + 2F82A5CDACBB136FE6BFF76416B7B240 /* Support Files */, + ); + name = CwlPosixPreconditionTesting; + path = CwlPosixPreconditionTesting; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 53651E4EB3F8CC46B1B0FF04366908FF /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + DDC7CA0733F6D405C6E0C56785297B2C /* CwlPreconditionTesting-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5724ABB843906339B7DA2FCE9B5C692D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C632E96DC0025A2C0036B7CC037A407 /* CwlMachBadInstructionHandler.h in Headers */, + 73B0052F6EF7783BA3C1A532D75EB1D8 /* CwlMachBadInstructionHandler-umbrella.h in Headers */, + B299AB0AE55C25E6B62F0E6EADBAC7CF /* mach_excServer.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 58E1902B7634A3F18A4073C6E5ED2842 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + CE845A999012F17514A2F3B857300186 /* Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5B8DB64BB9D2A177E8BAAFEE10E3F31C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ED602BA6C6EE6083E36E982C1C9E8457 /* QCKDSL.h in Headers */, + 7FD700715732587DA0D9587E45209ECB /* Quick.h in Headers */, + B01FBBF046DB33409BCAD0CC418B1915 /* Quick-umbrella.h in Headers */, + 2A05C7950CB354EA6FEF8649F3B82067 /* QuickConfiguration.h in Headers */, + 95E0B03539ADBAFEE8E4F645278FF85A /* QuickObjCRuntime.h in Headers */, + FD9D9565069953A0F3298E34848E8730 /* QuickSpec.h in Headers */, + 2D6226020DF075BC08C179CE9D1E57C4 /* QuickSpecBase.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7A1CD14BA2C35029E11919CEA0292D2E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + AF8A390A34E0C9260BFC20B123D5330A /* CwlCatchException.h in Headers */, + F2C4FCB88A23C8CD9798ABD09DEDBBB7 /* CwlCatchExceptionSupport-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0983DF8D45DD32BBE3D12F0B870CFF0 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 21601609288258F44177C9A71A1A5012 /* Pods-OSPaymentsLib-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A5C71D3D6A9100C45B0F049BDB996C22 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 4FFFE078561455276BD8D7DBBD4B82B7 /* DSL.h in Headers */, + 19CB73099257045327239879DB6CFCD5 /* Nimble.h in Headers */, + 086E1CE4E10D430F1E947C0EB6EE585D /* Nimble-umbrella.h in Headers */, + 12D53B67A082D15ED18B4B51CD4C9ABA /* NMBExceptionCapture.h in Headers */, + 53A2DF915F7360AC657F9F7118E2C127 /* NMBStringify.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D8E5AA88F860CD2CE849CCBD4875BDC8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 9B230DE2E00CC2CA78561DD3DF028339 /* CwlCatchException-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F7ECBCD811330822CF2CF8B3A09C1BCB /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 8982BD9FA66C8988A24C5B03517931A2 /* CwlPosixPreconditionTesting-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 04AB15DB33DBB70D7B25012DBAB06F1A /* Pods-OSPaymentsLib-OSPaymentsLibTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5533DBFB87FB69A0B48E4B16BDF17721 /* Build configuration list for PBXNativeTarget "Pods-OSPaymentsLib-OSPaymentsLibTests" */; + buildPhases = ( + 58E1902B7634A3F18A4073C6E5ED2842 /* Headers */, + 5E5F58446B6BB384C21151984BD15EAC /* Sources */, + 494F3A6D18BE72FCBAE9B38C1D8E0858 /* Frameworks */, + B84160B808EE297A8F95F357B5E57900 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 23D91AEC5E843AF93CBC858F071D68E4 /* PBXTargetDependency */, + 175A48428BE8BD12F8C7D872E946E8D9 /* PBXTargetDependency */, + F82C29A500BE75FEB54DFE09EB0A643F /* PBXTargetDependency */, + C39A7CDBC30A8BC906B084B424A3B92B /* PBXTargetDependency */, + 1207A805C1AB998DCB5A86249DD94A29 /* PBXTargetDependency */, + 154D26F063684B9A17EB669FCF288908 /* PBXTargetDependency */, + 3C75D747123C55C1953451CBE31A3853 /* PBXTargetDependency */, + ); + name = "Pods-OSPaymentsLib-OSPaymentsLibTests"; + productName = Pods_OSPaymentsLib_OSPaymentsLibTests; + productReference = E6BD0403A56EB6AA58FE2224C68F73C4 /* Pods-OSPaymentsLib-OSPaymentsLibTests */; + productType = "com.apple.product-type.framework"; + }; + 308B5C440C446909122081D367A27A8F /* CwlCatchException */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0B24FD4C46092DD465F3CEBD6FADA0B5 /* Build configuration list for PBXNativeTarget "CwlCatchException" */; + buildPhases = ( + D8E5AA88F860CD2CE849CCBD4875BDC8 /* Headers */, + 965BE037A59B9DAE341CD3A0A852BD34 /* Sources */, + A509C1F85B00AF9A9F66030AC855ABE6 /* Frameworks */, + F4C0F2A685097AE92FEE3DC9D340656E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ADDBFB367EB6BAAD288A49AF641A2E43 /* PBXTargetDependency */, + ); + name = CwlCatchException; + productName = CwlCatchException; + productReference = E0BC8BB0FE4725CF87EB0A9F5D400FD6 /* CwlCatchException */; + productType = "com.apple.product-type.framework"; + }; + 3BBD87E27EAD36B90D168213ED6DC32C /* CwlMachBadInstructionHandler */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9F679600745075134FBDCA8EB0FACB15 /* Build configuration list for PBXNativeTarget "CwlMachBadInstructionHandler" */; + buildPhases = ( + 5724ABB843906339B7DA2FCE9B5C692D /* Headers */, + B4881A76BF4D9FDFE30B0F3E471743C2 /* Sources */, + 64E0ACB63EA9EAFDF0043C6358BFA99F /* Frameworks */, + E89B8427F7D5396605DA55D3897F06B4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CwlMachBadInstructionHandler; + productName = CwlMachBadInstructionHandler; + productReference = E1176A8E7C8F4162FFCA404BE6EEBB1C /* CwlMachBadInstructionHandler */; + productType = "com.apple.product-type.framework"; + }; + 4BB08E2983BD09E8DAED9FA5412B115D /* Pods-OSPaymentsLib */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2EC9DC26A2B2F522D07CE5FE7D1EF6F5 /* Build configuration list for PBXNativeTarget "Pods-OSPaymentsLib" */; + buildPhases = ( + A0983DF8D45DD32BBE3D12F0B870CFF0 /* Headers */, + 14593B72CC5AB1953F9390743FA4967E /* Sources */, + 06AB854D397AC4F5BD7AFCCCEF728C82 /* Frameworks */, + 2BF7505BB62858FF37CE35550D4F3B5A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-OSPaymentsLib"; + productName = Pods_OSPaymentsLib; + productReference = C914B482E199C7EDA35291B58CEC2E5E /* Pods-OSPaymentsLib */; + productType = "com.apple.product-type.framework"; + }; + 6F13695E06195A78EA8A95F8C7ED0D2F /* Nimble */ = { + isa = PBXNativeTarget; + buildConfigurationList = B8921DB3FB146EFAE5814E112153F87C /* Build configuration list for PBXNativeTarget "Nimble" */; + buildPhases = ( + A5C71D3D6A9100C45B0F049BDB996C22 /* Headers */, + 10EF102237D379D954F11586E4C26E74 /* Sources */, + 596BC85A4D2B3ED26171A14D3169F031 /* Frameworks */, + A5DC210E99894CE656AA48D340E9D24C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 53815EC913CDF6F58B52ABF1F13D9522 /* PBXTargetDependency */, + ); + name = Nimble; + productName = Nimble; + productReference = BAE263041362D074978BB3B577DF0A05 /* Nimble */; + productType = "com.apple.product-type.framework"; + }; + C82891EAB7293DBEE916B21F57E8474D /* Quick */ = { + isa = PBXNativeTarget; + buildConfigurationList = DAD01693EC221F6D6CD576D139164CDD /* Build configuration list for PBXNativeTarget "Quick" */; + buildPhases = ( + 5B8DB64BB9D2A177E8BAAFEE10E3F31C /* Headers */, + C2C85E430F73C50F4C46CFD6C177DC82 /* Sources */, + B16A71154469AD3EB337051952CE0FC6 /* Frameworks */, + 8B55C70BA02D1E1E06FD91A60FA29721 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Quick; + productName = Quick; + productReference = 0D631E9908483F9525A6B3F36F16CC61 /* Quick */; + productType = "com.apple.product-type.framework"; + }; + CA3D99499260B4C146BBB22670C1D8AD /* CwlCatchExceptionSupport */ = { + isa = PBXNativeTarget; + buildConfigurationList = 626E614C7AB779319725A927E8061F7D /* Build configuration list for PBXNativeTarget "CwlCatchExceptionSupport" */; + buildPhases = ( + 7A1CD14BA2C35029E11919CEA0292D2E /* Headers */, + 80BBB390668C21FFCF14D9C64FB46314 /* Sources */, + 00757244B0C2072D3CF379717EAA1D46 /* Frameworks */, + FC68A227966E5BF56F3DB0118F290689 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CwlCatchExceptionSupport; + productName = CwlCatchExceptionSupport; + productReference = 220D1365CED5CB83C4C0CE1E3DABD3B0 /* CwlCatchExceptionSupport */; + productType = "com.apple.product-type.framework"; + }; + E4D853F6FBAB5A9BDBE843E4EFB22EB7 /* CwlPreconditionTesting */ = { + isa = PBXNativeTarget; + buildConfigurationList = BBA2CF64B702765C105515A5F22180CF /* Build configuration list for PBXNativeTarget "CwlPreconditionTesting" */; + buildPhases = ( + 53651E4EB3F8CC46B1B0FF04366908FF /* Headers */, + 821C75B2AC5F67F724BE057C17A046BB /* Sources */, + 055F5D9893DB522EDD2C99178F8D3DF7 /* Frameworks */, + 8463DDF462CDDCA9A7552517F4F60CB1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 623DAEB0CDAA927C50E8EFD26BCFF8C9 /* PBXTargetDependency */, + 5DBD1E8D697CC3AAA19FFCAFDA2F7C5C /* PBXTargetDependency */, + 4F7EC3A2460323E00131B6122BF060F4 /* PBXTargetDependency */, + ); + name = CwlPreconditionTesting; + productName = CwlPreconditionTesting; + productReference = CC56497384E780278F916D6C57EA4951 /* CwlPreconditionTesting */; + productType = "com.apple.product-type.framework"; + }; + EB8B23AD889CF5BE4A85CD0D8EF2DF99 /* CwlPosixPreconditionTesting */ = { + isa = PBXNativeTarget; + buildConfigurationList = 42B2059A767BF03B41073C49BC67735A /* Build configuration list for PBXNativeTarget "CwlPosixPreconditionTesting" */; + buildPhases = ( + F7ECBCD811330822CF2CF8B3A09C1BCB /* Headers */, + 117C3FD66999C297C75A904EC6305A71 /* Sources */, + 4F45D4EFE46A0C5F60578B86D23B8BFF /* Frameworks */, + 96867D34F91470BF3050416C1EB59E76 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CwlPosixPreconditionTesting; + productName = CwlPosixPreconditionTesting; + productReference = D2AD834000B280096FEB80FBEBD9A414 /* CwlPosixPreconditionTesting */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BFDFE7DC352907FC980B868725387E98 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + }; + buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = CF1408CF629C7361332E53B88F7BD30C; + productRefGroup = D36E011A466B185884474A745A7D054F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 308B5C440C446909122081D367A27A8F /* CwlCatchException */, + CA3D99499260B4C146BBB22670C1D8AD /* CwlCatchExceptionSupport */, + 3BBD87E27EAD36B90D168213ED6DC32C /* CwlMachBadInstructionHandler */, + EB8B23AD889CF5BE4A85CD0D8EF2DF99 /* CwlPosixPreconditionTesting */, + E4D853F6FBAB5A9BDBE843E4EFB22EB7 /* CwlPreconditionTesting */, + 6F13695E06195A78EA8A95F8C7ED0D2F /* Nimble */, + 4BB08E2983BD09E8DAED9FA5412B115D /* Pods-OSPaymentsLib */, + 04AB15DB33DBB70D7B25012DBAB06F1A /* Pods-OSPaymentsLib-OSPaymentsLibTests */, + C82891EAB7293DBEE916B21F57E8474D /* Quick */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2BF7505BB62858FF37CE35550D4F3B5A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8463DDF462CDDCA9A7552517F4F60CB1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8B55C70BA02D1E1E06FD91A60FA29721 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 96867D34F91470BF3050416C1EB59E76 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A5DC210E99894CE656AA48D340E9D24C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B84160B808EE297A8F95F357B5E57900 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E89B8427F7D5396605DA55D3897F06B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F4C0F2A685097AE92FEE3DC9D340656E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FC68A227966E5BF56F3DB0118F290689 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 10EF102237D379D954F11586E4C26E74 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F4300F4985C00C7E50879D5DA25069D /* AdapterProtocols.swift in Sources */, + 28C50DB2279706C3C47A38C9D7DEF9A6 /* AllPass.swift in Sources */, + BE5CB274210C6D83CBF6F2D222FF0C20 /* AssertionDispatcher.swift in Sources */, + 30C5D12AB6B5B930EFCFADA8ABCBF63B /* AssertionRecorder.swift in Sources */, + DD136D9F0BA4405B4AF7E888FBBC03D0 /* AssertionRecorder+Async.swift in Sources */, + 4235C79508CB73F9F3960AEFBEE95287 /* AsyncAllPass.swift in Sources */, + 8A085B7C40368D8F5DFB06CFE8541809 /* AsyncAwait.swift in Sources */, + D6B4AA83CDA43927DB46E614FC3EDF09 /* AsyncExpression.swift in Sources */, + F14C6A7A9EC794B7F60E244D5227E1DE /* AsyncMatcher.swift in Sources */, + 54C73470DE4EFE7038D8BCC96394CB7A /* AsyncTimerSequence.swift in Sources */, + 386035701616A55133490CC5B7D599A1 /* BeAKindOf.swift in Sources */, + 210E28965A04075F4DC3960D269F3BFE /* BeAnInstanceOf.swift in Sources */, + ECB25D327813D791F8B04BFDC5C22A56 /* BeCloseTo.swift in Sources */, + AF73B574BAEA6A4890092B7BB4C5E1EF /* BeEmpty.swift in Sources */, + EAE05B70AA9690C0DA3AD1DC0BC975CD /* BeginWith.swift in Sources */, + C7C0E737E36967917577A44E01367CE1 /* BeginWithPrefix.swift in Sources */, + 02862925CA6AC122C7D7FAFA6EAFE9B4 /* BeGreaterThan.swift in Sources */, + 98BF01027C0ED277FA44A5976CCAC48B /* BeGreaterThanOrEqualTo.swift in Sources */, + C2DB1B3BA2AC1ADA9572527A408E2133 /* BeIdenticalTo.swift in Sources */, + 27E52183EDFE2F83356620EC190632CC /* BeLessThan.swift in Sources */, + 3CE63C7B763466F2B1E5A50BF4A1C55C /* BeLessThanOrEqual.swift in Sources */, + 717F4536032D9AD18B34543BB16B5785 /* BeLogical.swift in Sources */, + B84C161C8D6F6D45B54F4A0540EC46BA /* BeNil.swift in Sources */, + D6DBC83664E74D070050CD81DA0E064C /* BeResult.swift in Sources */, + 23CE269175242B42A00AC562C0446EBC /* BeVoid.swift in Sources */, + 934BAB9A75561F779175AA12A1BEF3E6 /* BeWithin.swift in Sources */, + EEBE9B46D49C94CC305245EB3B45A237 /* Contain.swift in Sources */, + B9DF33D4019BC27D9DFC286EA4889458 /* ContainElementSatisfying.swift in Sources */, + A17F986159251EAB78F7A14D9CE751CD /* DSL.m in Sources */, + C5166B8B226EA61D351F98AFC5EF05B7 /* DSL.swift in Sources */, + EE219A1D6B7901E2841AF289B9C2D2C4 /* DSL+AsyncAwait.swift in Sources */, + 43C46479311D1489DAE6A0581448BE0C /* DSL+Require.swift in Sources */, + 1876CE44E8440A4737CF40117A68F309 /* DSL+Wait.swift in Sources */, + 5053A17F2081784AB080F30B0F5865F4 /* ElementsEqual.swift in Sources */, + 64705DF3A1868C524870711259043F58 /* EndWith.swift in Sources */, + 1368326833020E1381CC35FE204C0543 /* Equal.swift in Sources */, + DEAD70130BED26DFF01DB8335048AE6E /* Equal+Tuple.swift in Sources */, + 5034FA01DC379A5479D202CC1C2FBE4A /* Equal+TupleArray.swift in Sources */, + 79DBE9693E2198943A783ABFD29AD8E0 /* Errors.swift in Sources */, + 9FEC431B72D606CE1F9A7519ED52F067 /* Expectation.swift in Sources */, + 2CAA65A58918F5EC6815F86DFF0C9145 /* ExpectationMessage.swift in Sources */, + 14FD1319FDF44431950DBE146939F966 /* Expression.swift in Sources */, + B39DA59A1B61AAF40791929F4CCFDC04 /* FailureMessage.swift in Sources */, + D52A6CF8DE6EB018BDC007090B811610 /* HaveCount.swift in Sources */, + 273C2200A3CCD17914F16621CA8918F1 /* Map.swift in Sources */, + D218D06508938E7E60BA9CA24BCB2D7F /* Match.swift in Sources */, + 7847936EDCDA1B01C677C31B0D3D4E6C /* Matcher.swift in Sources */, + D3BD1F7254F7AF70D812D4C965EF54F9 /* MatcherProtocols.swift in Sources */, + 92D38CFA30428553FA8C7B607F77188B /* MatchError.swift in Sources */, + 170B8362049B9E7C134C392EF01C1B11 /* Nimble-dummy.m in Sources */, + B1F8913FCD67F4863C2F89120395AEFB /* NimbleEnvironment.swift in Sources */, + EE87C0C5AA90643DAD9359F5B942EFCA /* NimbleTimeInterval.swift in Sources */, + 8BA9506936BAF58874A11686DE9209FC /* NimbleXCTestHandler.swift in Sources */, + 97A4451BFC7BBB956541232190ED804E /* NMBExceptionCapture.m in Sources */, + 89FC9CA354F1BE3BA4947368D6EDA77D /* NMBExpectation.swift in Sources */, + 0A411DB578B132909FECBE652B271BEF /* NMBStringify.m in Sources */, + E20BF25CC9FE502D37CED510E7ADFEAC /* PollAwait.swift in Sources */, + A00B5714E574282285C79934F3931973 /* Polling.swift in Sources */, + 883E3CE7566CDAED097D74819DF969A4 /* Polling+AsyncAwait.swift in Sources */, + 534B183FDA625BCEF7D1D3B3AAD90FB8 /* Polling+Require.swift in Sources */, + 84EA7731D14E937368671377E4CAD56F /* PostNotification.swift in Sources */, + EA5E8E6F1D3AA73B3C99473F39C4FF4D /* RaisesException.swift in Sources */, + 3A8AD07A6240BCF821FF670ED4AEA227 /* Requirement.swift in Sources */, + 5031354613E1B45DD616C9428C168A9A /* SatisfyAllOf.swift in Sources */, + E61B94D072E329A90151493C2CBA4FBB /* SatisfyAnyOf.swift in Sources */, + 2DAF34A5F2861544A6F247268044EA97 /* SourceLocation.swift in Sources */, + 0BED3C790949A2E29BB3C56B0C7D0912 /* Stringers.swift in Sources */, + 7531CA08B8E24EDD00485B42BB7DA8FD /* ThrowAssertion.swift in Sources */, + 2708C3D34AD6410DB563CBCA5205D89F /* ThrowError.swift in Sources */, + 1DAF13110AC3B5A462DD10202848DC38 /* ToSucceed.swift in Sources */, + 61FBDD8958A28F726EE3A66795A628AB /* utils.swift in Sources */, + EB498AC2278DE4F7153349E5EDC46FD7 /* XCTestObservationCenter+Register.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 117C3FD66999C297C75A904EC6305A71 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D788AE341F323351D1ADEE5E65F68F2 /* CwlCatchBadInstructionPosix.swift in Sources */, + 02A19A4480813B8CD5BD418095D21B2B /* CwlPosixPreconditionTesting-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 14593B72CC5AB1953F9390743FA4967E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0C0D56E489977C4C3AAC657267CBE490 /* Pods-OSPaymentsLib-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5E5F58446B6BB384C21151984BD15EAC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4C9212B5D4D4ABC7C9245E1260987D5A /* Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 80BBB390668C21FFCF14D9C64FB46314 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7DC09E8ED20036275FF7D0A27143F596 /* CwlCatchException.m in Sources */, + EC69AC1DF6EA3752AF91F6FE44840D73 /* CwlCatchExceptionSupport-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 821C75B2AC5F67F724BE057C17A046BB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 58B391FC2D923A51FADDFE09E01D4324 /* CwlBadInstructionException.swift in Sources */, + 5A28B94D6EE4BE9349685EECB112D7A6 /* CwlCatchBadInstruction.swift in Sources */, + 168E76699C1ADF9D9B8214FD4BB48F44 /* CwlDarwinDefinitions.swift in Sources */, + 50A1759496E2BFBEBD4E4D947BF3EF49 /* CwlPreconditionTesting-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 965BE037A59B9DAE341CD3A0A852BD34 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D8867B60C823F8B93753E9AAB63CEE9C /* CwlCatchException.swift in Sources */, + 9F65F1675C50F3AEA034A1C7AE105438 /* CwlCatchException-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B4881A76BF4D9FDFE30B0F3E471743C2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9DD804A47165A7BE0A7ABF60B8A198AE /* CwlMachBadInstructionHandler.m in Sources */, + F3177C284538D6D35D50B39CEFEA3C74 /* CwlMachBadInstructionHandler-dummy.m in Sources */, + 4FF46429ED8253B45C2DBCCA6E85D146 /* mach_excServer.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C2C85E430F73C50F4C46CFD6C177DC82 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A8743EE43AD09651A91D1C0535590218 /* AsyncBehavior.swift in Sources */, + 30AA415F142E3E5F6E15497D254550E4 /* AsyncDSL.swift in Sources */, + 3E245FE6735FC9C037D4DD30C2EA9C20 /* AsyncExample.swift in Sources */, + 7AE7F1A36F091AC368D7C86B207FFB0E /* AsyncExampleGroup.swift in Sources */, + C5FC81492CFF91B1BAD3417ADF80FC06 /* AsyncExampleHooks.swift in Sources */, + BAC5FAF0CDF05730BEE178C94C61DF24 /* AsyncSpec.swift in Sources */, + A8E7FA7DB26F2CE5AB231F60C8211956 /* AsyncSpec+testMethodSelectors.m in Sources */, + F02BFF95B68F481A59DBBA6B85919333 /* AsyncWorld.swift in Sources */, + FF312523DB23087460148A6AEC0E23B9 /* AsyncWorld+DSL.swift in Sources */, + 3C0E7EFA4D5514BD647146F181F02F32 /* Behavior.swift in Sources */, + FA3851317E698A50769EE23A523A4D28 /* Callsite.swift in Sources */, + 63640E2BAE8AFCD81A8F952297171486 /* Closures.swift in Sources */, + 8370BD520FB666EC353C8F721C3675DB /* CurrentSpec.swift in Sources */, + 6C3DB5E93A27526C2717382FFCFEA7C7 /* DSL.swift in Sources */, + 072CBEE458E411A7386FEA40EDB74F78 /* ErrorUtility.swift in Sources */, + C152028DCCBF496E39ADA0306CE2102E /* Example.swift in Sources */, + ECAD05FDCA266B54D2890FD130312FFE /* ExampleGroup.swift in Sources */, + F773D7DF42F0698A40A005C797FAF3FD /* ExampleHooks.swift in Sources */, + FC7DA1DAD8367E9D82A2E8BA7D96BFBD /* ExampleMetadata.swift in Sources */, + 83464DA07AA59C01E4C5A5D5B736C32E /* Filter.swift in Sources */, + 39FA1995EBCBC081DF2B2353C50ACC4A /* HooksPhase.swift in Sources */, + B77FF9D43361BBF2AA444C2635415459 /* NSBundle+CurrentTestBundle.swift in Sources */, + A4A2FACD0FBF3480F60A4F6CD7248C36 /* QCKConfiguration.swift in Sources */, + 2481095DCDF1162F5FA5AF4E9BDB7463 /* QCKDSL.m in Sources */, + 462F0CA8B3C9AF1257FE0E07BD271087 /* Quick-dummy.m in Sources */, + A5C6D97101B799F260827304A7A0FEB1 /* QuickConfiguration.m in Sources */, + 1CC7BC97342645FD4DFCC8C7A445A364 /* QuickConfiguration.swift in Sources */, + 104E39CF62CF4D1A95389513C6732A3F /* QuickSelectedTestSuiteBuilder.swift in Sources */, + 8082D3FBF990D28DC8051FD6A2C44650 /* QuickSpec.m in Sources */, + 65D65FA4541FC9393C3A50D04583E0B5 /* QuickSpecBase.m in Sources */, + A06102F3D994B4F3EE5F7EF68FEBBD22 /* QuickTestObservation.swift in Sources */, + EB66279A6CD609B89BEC8BCAE4B304A4 /* QuickTestSuite.swift in Sources */, + 2F0EA3496EE6BA0E3A41CC09AE663B97 /* StopTest.swift in Sources */, + E3A03088B7A2305F0C89C83ADB7CA2C1 /* String+C99ExtendedIdentifier.swift in Sources */, + E7559E209C22EEC9084F6C26CE4B5ED1 /* SubclassDetection.swift in Sources */, + 6B5F43788CF310B9DAD46A09B8DCACD2 /* SuiteHooks.swift in Sources */, + 0197623979A778492C933778D80DD791 /* TestSelectorNameProvider.swift in Sources */, + 8153776DC743A3F708498232C91024EB /* TestState.swift in Sources */, + 4C1C46B7FF57E43C3D7037D860510A05 /* URL+FileName.swift in Sources */, + C70974CDB744D70499372A6AD39711E9 /* World.swift in Sources */, + F80622B10127233EA9F85B364DAFE74C /* World+DSL.swift in Sources */, + B0024D71B366915E7FF1A526649F2A4C /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1207A805C1AB998DCB5A86249DD94A29 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlPreconditionTesting; + target = E4D853F6FBAB5A9BDBE843E4EFB22EB7 /* CwlPreconditionTesting */; + targetProxy = DEE7A76326A3AC448377CDEA4CDAAE68 /* PBXContainerItemProxy */; + }; + 154D26F063684B9A17EB669FCF288908 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Nimble; + target = 6F13695E06195A78EA8A95F8C7ED0D2F /* Nimble */; + targetProxy = EE2996B22F196FAF55CA8539865BFF97 /* PBXContainerItemProxy */; + }; + 175A48428BE8BD12F8C7D872E946E8D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlCatchExceptionSupport; + target = CA3D99499260B4C146BBB22670C1D8AD /* CwlCatchExceptionSupport */; + targetProxy = 680A774DAB6760B2C93AF74888246677 /* PBXContainerItemProxy */; + }; + 23D91AEC5E843AF93CBC858F071D68E4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlCatchException; + target = 308B5C440C446909122081D367A27A8F /* CwlCatchException */; + targetProxy = BDB1986F32302AFBDB2F58B81F2A213D /* PBXContainerItemProxy */; + }; + 3C75D747123C55C1953451CBE31A3853 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Quick; + target = C82891EAB7293DBEE916B21F57E8474D /* Quick */; + targetProxy = D37643C36FA2B89036A7873AD2BFA57B /* PBXContainerItemProxy */; + }; + 4F7EC3A2460323E00131B6122BF060F4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlPosixPreconditionTesting; + target = EB8B23AD889CF5BE4A85CD0D8EF2DF99 /* CwlPosixPreconditionTesting */; + targetProxy = F703D2EE1DF327ED02A370536DED54AB /* PBXContainerItemProxy */; + }; + 53815EC913CDF6F58B52ABF1F13D9522 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlPreconditionTesting; + target = E4D853F6FBAB5A9BDBE843E4EFB22EB7 /* CwlPreconditionTesting */; + targetProxy = B92147CAF60149351DBCDE8A51220C55 /* PBXContainerItemProxy */; + }; + 5DBD1E8D697CC3AAA19FFCAFDA2F7C5C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlMachBadInstructionHandler; + target = 3BBD87E27EAD36B90D168213ED6DC32C /* CwlMachBadInstructionHandler */; + targetProxy = D802A6F826E2597180B239E1AECD0EC0 /* PBXContainerItemProxy */; + }; + 623DAEB0CDAA927C50E8EFD26BCFF8C9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlCatchException; + target = 308B5C440C446909122081D367A27A8F /* CwlCatchException */; + targetProxy = A2EA725195BF4DEA0BDF10073FB148C7 /* PBXContainerItemProxy */; + }; + ADDBFB367EB6BAAD288A49AF641A2E43 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlCatchExceptionSupport; + target = CA3D99499260B4C146BBB22670C1D8AD /* CwlCatchExceptionSupport */; + targetProxy = 6DF229CD1960DF7A69CE57688797DB9D /* PBXContainerItemProxy */; + }; + C39A7CDBC30A8BC906B084B424A3B92B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlPosixPreconditionTesting; + target = EB8B23AD889CF5BE4A85CD0D8EF2DF99 /* CwlPosixPreconditionTesting */; + targetProxy = 98EA497D27303619F8B18ECC1E663EE7 /* PBXContainerItemProxy */; + }; + F82C29A500BE75FEB54DFE09EB0A643F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CwlMachBadInstructionHandler; + target = 3BBD87E27EAD36B90D168213ED6DC32C /* CwlMachBadInstructionHandler */; + targetProxy = FE9936BE72A2D9CA0E3D38732DC3AC80 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 0351339B5E77E6CDF4EC7475ED081F94 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 56EBDC39EB609F54DFA2CDBCE20B63A7 /* CwlPosixPreconditionTesting.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.modulemap"; + PRODUCT_MODULE_NAME = CwlPosixPreconditionTesting; + PRODUCT_NAME = CwlPosixPreconditionTesting; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 0691F12D5BEF3F36107FD2A1DFDEDCE8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 64921B170418D2F8EF1C54FBA90FDE02 /* CwlCatchExceptionSupport.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.modulemap"; + PRODUCT_MODULE_NAME = CwlCatchExceptionSupport; + PRODUCT_NAME = CwlCatchExceptionSupport; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 082B7CDF68A00F5C0C3407E83F6F2AB0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 07B837DB1F58318777C1630726AEA23A /* CwlCatchExceptionSupport.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.modulemap"; + PRODUCT_MODULE_NAME = CwlCatchExceptionSupport; + PRODUCT_NAME = CwlCatchExceptionSupport; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 2058DC873B458090E1A8F1FFAF0E3078 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B69D8666D871F2F21C4849FB9DC16BDE /* Quick.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + PRODUCT_MODULE_NAME = Quick; + PRODUCT_NAME = Quick; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 37499306350BFA24B850883D8203694F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3188B641B9C20E4D45A0883C087E57FF /* CwlMachBadInstructionHandler.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.modulemap"; + PRODUCT_MODULE_NAME = CwlMachBadInstructionHandler; + PRODUCT_NAME = CwlMachBadInstructionHandler; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 37C7B0A916CBAA5FB43BAED43B5B794B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5AAA74622C8B0B2167156F4EBE359608 /* Pods-OSPaymentsLib.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 4BC7450F9457737EE3E637BA155B56F7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + 4CDD9D0B97E856E52BBAB0E1AE902FA1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E8FFA1A64F61EB44FC28A4BF3EF8248A /* Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 4D776A255D68F25F23C2AE214512D1EF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = DDA26739F6B5A6C3427A79B507B90119 /* CwlPosixPreconditionTesting.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.modulemap"; + PRODUCT_MODULE_NAME = CwlPosixPreconditionTesting; + PRODUCT_NAME = CwlPosixPreconditionTesting; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 4DB56D12BF987A8C42B082B877226600 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BEB97334DF3B76513D34EB7C70369D82 /* Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 51E603515B3F34E72073BB44FB20A466 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 07D0FF898AFEF00EF5DD10347811C347 /* CwlCatchException.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlCatchException/CwlCatchException-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlCatchException/CwlCatchException-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlCatchException/CwlCatchException.modulemap"; + PRODUCT_MODULE_NAME = CwlCatchException; + PRODUCT_NAME = CwlCatchException; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 54A311AC1F9C768DFFE69F26F3C49C28 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0A2CA0650F7537ACE178096CD0C6BA4C /* Nimble.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Nimble/Nimble-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; + PRODUCT_MODULE_NAME = Nimble; + PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 747942B5FF697469F064235FBBB1C4BB /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 922E79F3DE744919AE43C09528485E0E /* Quick.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Quick-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + PRODUCT_MODULE_NAME = Quick; + PRODUCT_NAME = Quick; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 7FC9243B2E60FF32C9FD7791F525D208 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = DB4B81CB588224154E8C15DA7196F9E8 /* CwlPreconditionTesting.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.modulemap"; + PRODUCT_MODULE_NAME = CwlPreconditionTesting; + PRODUCT_NAME = CwlPreconditionTesting; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 8B5A46FF8D3C1289CDEE3BAFACABCD2A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Release; + }; + 8F99684721AD9684BD82E37C927568E4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 12E8A18E971F2D6544B8344097DFB058 /* CwlPreconditionTesting.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.modulemap"; + PRODUCT_MODULE_NAME = CwlPreconditionTesting; + PRODUCT_NAME = CwlPreconditionTesting; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + A5D3D1A457C9E59A085F9F267E2EDCD0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9609CBE74715F4BDFAC30EDDF6960A47 /* Nimble.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Nimble/Nimble-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; + PRODUCT_MODULE_NAME = Nimble; + PRODUCT_NAME = Nimble; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B9FA3C9F2C2EF8117A899F82B7D06E44 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7FAF6F207E838D5D5C9B10D229774CCD /* CwlCatchException.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlCatchException/CwlCatchException-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlCatchException/CwlCatchException-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlCatchException/CwlCatchException.modulemap"; + PRODUCT_MODULE_NAME = CwlCatchException; + PRODUCT_NAME = CwlCatchException; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + BF989A342387266177AA99C98AD84D95 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 40163553F5FC158BA38AC8108AC7F62B /* CwlMachBadInstructionHandler.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.modulemap"; + PRODUCT_MODULE_NAME = CwlMachBadInstructionHandler; + PRODUCT_NAME = CwlMachBadInstructionHandler; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + D631A53F962A080D5EBF24F1E29C0DE4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C157CC35B7ABF301C81384661B151DC /* Pods-OSPaymentsLib.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0B24FD4C46092DD465F3CEBD6FADA0B5 /* Build configuration list for PBXNativeTarget "CwlCatchException" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B9FA3C9F2C2EF8117A899F82B7D06E44 /* Debug */, + 51E603515B3F34E72073BB44FB20A466 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2EC9DC26A2B2F522D07CE5FE7D1EF6F5 /* Build configuration list for PBXNativeTarget "Pods-OSPaymentsLib" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D631A53F962A080D5EBF24F1E29C0DE4 /* Debug */, + 37C7B0A916CBAA5FB43BAED43B5B794B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 42B2059A767BF03B41073C49BC67735A /* Build configuration list for PBXNativeTarget "CwlPosixPreconditionTesting" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4D776A255D68F25F23C2AE214512D1EF /* Debug */, + 0351339B5E77E6CDF4EC7475ED081F94 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BC7450F9457737EE3E637BA155B56F7 /* Debug */, + 8B5A46FF8D3C1289CDEE3BAFACABCD2A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5533DBFB87FB69A0B48E4B16BDF17721 /* Build configuration list for PBXNativeTarget "Pods-OSPaymentsLib-OSPaymentsLibTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4CDD9D0B97E856E52BBAB0E1AE902FA1 /* Debug */, + 4DB56D12BF987A8C42B082B877226600 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 626E614C7AB779319725A927E8061F7D /* Build configuration list for PBXNativeTarget "CwlCatchExceptionSupport" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0691F12D5BEF3F36107FD2A1DFDEDCE8 /* Debug */, + 082B7CDF68A00F5C0C3407E83F6F2AB0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9F679600745075134FBDCA8EB0FACB15 /* Build configuration list for PBXNativeTarget "CwlMachBadInstructionHandler" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37499306350BFA24B850883D8203694F /* Debug */, + BF989A342387266177AA99C98AD84D95 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B8921DB3FB146EFAE5814E112153F87C /* Build configuration list for PBXNativeTarget "Nimble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A5D3D1A457C9E59A085F9F267E2EDCD0 /* Debug */, + 54A311AC1F9C768DFFE69F26F3C49C28 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BBA2CF64B702765C105515A5F22180CF /* Build configuration list for PBXNativeTarget "CwlPreconditionTesting" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8F99684721AD9684BD82E37C927568E4 /* Debug */, + 7FC9243B2E60FF32C9FD7791F525D208 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DAD01693EC221F6D6CD576D139164CDD /* Build configuration list for PBXNativeTarget "Quick" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 747942B5FF697469F064235FBBB1C4BB /* Debug */, + 2058DC873B458090E1A8F1FFAF0E3078 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; +} diff --git a/Pods/Quick/LICENSE b/Pods/Quick/LICENSE new file mode 100644 index 0000000..e900165 --- /dev/null +++ b/Pods/Quick/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Pods/Quick/README.md b/Pods/Quick/README.md new file mode 100644 index 0000000..af35f20 --- /dev/null +++ b/Pods/Quick/README.md @@ -0,0 +1,103 @@ +![](http://f.cl.ly/items/0r1E192C1R0b2g2Q3h2w/QuickLogo_Color.png) + +[![Build Status](https://github.com/Quick/Quick/actions/workflows/ci-xcode.yml/badge.svg)](https://github.com/Quick/Quick/actions/workflows/ci-xcode.yml) +[![CocoaPods](https://img.shields.io/cocoapods/v/Quick.svg)](https://cocoapods.org/pods/Quick) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platforms](https://img.shields.io/cocoapods/p/Quick.svg)](https://cocoapods.org/pods/Quick) + +Quick is a behavior-driven development framework for Swift and Objective-C. +Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). + +![](https://raw.githubusercontent.com/Quick/Assets/master/Screenshots/QuickSpec%20screenshot.png) + +```swift +// Swift + +import Quick +import Nimble + +class TableOfContentsSpec: QuickSpec { + override class func spec() { + describe("the 'Documentation' directory") { + it("has everything you need to get started") { + let sections = Directory("Documentation").sections + expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups")) + expect(sections).to(contain("Installing Quick")) + } + + context("if it doesn't have what you're looking for") { + it("needs to be updated") { + let you = You(awesome: true) + expect{you.submittedAnIssue}.toEventually(beTruthy()) + } + } + } + } +} +``` +#### Nimble +Quick comes together with [Nimble](https://github.com/Quick/Nimble) — a matcher framework for your tests. You can learn why `XCTAssert()` statements make your expectations unclear and how to fix that using Nimble assertions [here](./Documentation/en-us/NimbleAssertions.md). + +## Swift Version + +Certain versions of Quick and Nimble only support certain versions of Swift. Depending on which version of Swift your project uses, you should use specific versions of Quick and Nimble. Use the table below to determine which versions of Quick and Nimble are compatible with your project. + +|Swift version |Quick version |Nimble version | +|:--------------------|:---------------|:--------------| +|Swift 5.2 |v3.0.0 or later |v9.0.0 or later| +|Swift 4.2 / Swift 5 |v1.3.2 or later |v7.3.2 or later| +|Swift 3 / Swift 4 |v1.0.0 or later |v5.0.0 or later| +|Swift 2.2 / Swift 2.3|v0.9.3 |v4.1.0 | + +## Documentation + +All documentation can be found in the [Documentation folder](./Documentation), including [detailed installation instructions](./Documentation/en-us/InstallingQuick.md) for CocoaPods, Carthage, Git submodules, Swift Package Manager, and more. For example, you can install Quick and [Nimble](https://github.com/Quick/Nimble) using CocoaPods by adding the following to your `Podfile`: + +```rb +# Podfile + +use_frameworks! + +target "MyApp" do + # Normal libraries + + target 'MyApp_Tests' do + inherit! :search_paths + + pod 'Quick' + pod 'Nimble' + end +end +``` + +You can also install Quick and Nimble using Swift Package Manager by adding the following to the dependencies section your `Package.swift`: + +```swift +dependencies: [ + .package(url: "https://github.com/Quick/Quick.git", from: "7.0.0"), + .package(url: "https://github.com/Quick/Nimble.git", from: "12.0.0"), +], +``` + +## Projects using Quick + +Over ten-thousand apps use either Quick and Nimble however, as they are not included in the app binary, neither appear in “Top Used Libraries” blog posts. Therefore, it would be greatly appreciated to remind contributors that their efforts are valued by compiling a list of organizations and projects that use them. + +Does your organization or project use Quick and Nimble? If yes, [please add your project to the list](https://github.com/Quick/Quick/wiki/Projects-using-Quick). + +## Who uses Quick + +Similar to projects using Quick, it would be nice to hear why people use Quick and Nimble. Are there features you love? Are there features that are just okay? Are there some features we have that no one uses? + +Have something positive to say about Quick (or Nimble)? If yes, [provide a testimonial here](https://github.com/Quick/Quick/wiki/Who-uses-Quick). + +## Privacy Statement + +Quick is a library that is only used for testing and should never be included in the binary submitted to App Store Connect. +Your app will be rejected if you do include Quick in the submitted binary because Quick uses private APIs to better integrate with Xcode. + +Despite not being shipped to Apple, Quick does not and will never collect any kind of analytics or tracking. + +## License + +Apache 2.0 license. See the [`LICENSE`](LICENSE) file for details. diff --git a/Pods/Quick/Sources/Quick/Async/AsyncBehavior.swift b/Pods/Quick/Sources/Quick/Async/AsyncBehavior.swift new file mode 100644 index 0000000..6b72945 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Async/AsyncBehavior.swift @@ -0,0 +1,19 @@ +/// A `Behavior` encapsulates a set of examples that can be re-used in several locations using the `itBehavesLike` +/// function with a context instance of the generic type. +open class AsyncBehavior { + + /** + Override this variable if you want to provide custom name for this example group. + */ + open class var name: String { return String(describing: self) } + + /** + Override this method in your behavior to define a set of reusable examples. + + This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + + - parameter aContext: A closure that, when evaluated, returns a `Context` instance that provide the information on the subject. + */ + open class func spec(_ aContext: @escaping () -> Context) {} +} diff --git a/Pods/Quick/Sources/Quick/Async/AsyncExampleGroup.swift b/Pods/Quick/Sources/Quick/Async/AsyncExampleGroup.swift new file mode 100644 index 0000000..122c05b --- /dev/null +++ b/Pods/Quick/Sources/Quick/Async/AsyncExampleGroup.swift @@ -0,0 +1,112 @@ +import Foundation + +private enum ExampleUnit { + case example(AsyncExample) + case group(AsyncExampleGroup) +} + +/** + Example groups are logical groupings of examples, defined with + the `describe` and `context` functions. Example groups can share + setup and teardown code. +*/ +final public class AsyncExampleGroup: CustomStringConvertible { + weak internal var parent: AsyncExampleGroup? + internal let hooks = AsyncExampleHooks() + + internal var phase: HooksPhase = .nothingExecuted + + private let internalDescription: String + private let flags: FilterFlags + private let isInternalRootExampleGroup: Bool + private var childUnits = [ExampleUnit]() + + internal init(description: String, flags: FilterFlags, isInternalRootExampleGroup: Bool = false) { + self.internalDescription = description + self.flags = flags + self.isInternalRootExampleGroup = isInternalRootExampleGroup + } + + public var description: String { + return internalDescription + } + + /** + Returns a list of examples that belong to this example group, + or to any of its descendant example groups. + */ + public var examples: [AsyncExample] { + childUnits.flatMap { unit in + switch unit { + case .example(let example): + return [example] + case .group(let exampleGroup): + return exampleGroup.examples + } + } + } + + internal var name: String? { + guard let parent = parent else { + return isInternalRootExampleGroup ? nil : description + } + + guard let name = parent.name else { return description } + return "\(name), \(description)" + } + + internal var filterFlags: FilterFlags { + var aggregateFlags = flags + walkUp { group in + for (key, value) in group.flags { + aggregateFlags[key] = value + } + } + return aggregateFlags + } + + internal var justBeforeEachStatements: [AroundExampleWithMetadataAsyncClosure] { + var closures = Array(hooks.justBeforeEachStatements.reversed()) + walkUp { group in + closures.append(contentsOf: group.hooks.justBeforeEachStatements.reversed()) + } + return closures + } + + internal var wrappers: [AroundExampleWithMetadataAsyncClosure] { + var closures = Array(hooks.wrappers.reversed()) + walkUp { group in + closures.append(contentsOf: group.hooks.wrappers.reversed()) + } + return closures + } + + internal func walkDownExamples(_ callback: (_ example: AsyncExample) -> Void) { + for unit in childUnits { + switch unit { + case .example(let example): + callback(example) + case .group(let exampleGroup): + exampleGroup.walkDownExamples(callback) + } + } + } + + internal func appendExampleGroup(_ group: AsyncExampleGroup) { + group.parent = self + childUnits.append(.group(group)) + } + + internal func appendExample(_ example: AsyncExample) { + example.group = self + childUnits.append(.example(example)) + } + + private func walkUp(_ callback: (_ group: AsyncExampleGroup) -> Void) { + var group = self + while let parent = group.parent { + callback(parent) + group = parent + } + } +} diff --git a/Pods/Quick/Sources/Quick/Async/AsyncSpec.swift b/Pods/Quick/Sources/Quick/Async/AsyncSpec.swift new file mode 100644 index 0000000..1f61399 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Async/AsyncSpec.swift @@ -0,0 +1,152 @@ +import XCTest + +#if canImport(QuickObjCRuntime) +import QuickObjCRuntime + +public typealias AsyncSpecBase = _QuickSpecBase +#else +public typealias AsyncSpecBase = XCTestCase +#endif + +open class AsyncSpec: AsyncSpecBase { + /// Returns the currently executing spec. Use in specs that require XCTestCase + /// methods, e.g. expectation(description:). + /// + /// If you're using `beforeSuite`/`afterSuite`, you should consider the ``currentSpec()`` helper. + public private(set) static var current: AsyncSpec! + + private var example: AsyncExample? { + didSet { + AsyncSpec.current = self + } + } + + open class func spec() {} + +#if canImport(Darwin) + /// This method is used as a hook for the following two purposes + /// + /// 1. Performing all configurations + /// 2. Gathering examples for each spec classes + /// + /// On Linux, those are done in `LinuxMain.swift` and `Quick.QCKMain`. But + /// SwiftPM on macOS does not have the mechanism (test cases are automatically + /// discovered powered by Objective-C runtime), so we needed the alternative + /// way. + override open class var defaultTestSuite: XCTestSuite { + QuickConfiguration.configureSubclassesIfNeeded(world: World.sharedWorld) + + // Let's gather examples for each spec classes. This has the same effect + // as listing spec classes in `LinuxMain.swift` on Linux. + gatherExamplesIfNeeded() + + return super.defaultTestSuite + } + + @objc + class func buildExamplesIfNeeded() { + gatherExamplesIfNeeded() + } + + /// This method is used as a hook for injecting test methods into the + /// Objective-C runtime on individual test runs. + /// + /// When `xctest` runs a test on a single method, it does not call + /// `defaultTestSuite` on the test class but rather calls + /// `instancesRespondToSelector:` to build its own suite. + /// + /// In normal conditions, Quick uses the implicit call to `defaultTestSuite` + /// to both generate examples and inject them as methods by way of + /// `testInvocations`. Under single test conditions, there's no implicit + /// call to `defaultTestSuite` so we make it explicitly here. + open override class func instancesRespond(to aSelector: Selector!) -> Bool { + _ = self.defaultTestSuite + return super.instancesRespond(to: aSelector) + } + +#if SWIFT_PACKAGE + open override class func _qck_testMethodSelectors() -> [String]! { + darwinXCTestMethodSelectors() + } +#endif // SWIFT_PACKAGE + + @objc + internal class func darwinXCTestMethodSelectors() -> [String]! { + let examples = AsyncWorld.sharedWorld.examples(forSpecClass: self) + + var selectorNames = Set() + return examples.map { test in + let selector = addInstanceMethod(for: test.example, runFullTest: test.runFullTest, classSelectorNames: &selectorNames) + return NSStringFromSelector(selector) + } + } + + private static func addInstanceMethod(for example: AsyncExample, runFullTest: Bool, classSelectorNames selectorNames: inout Set) -> Selector { + let block: @convention(block) (AsyncSpec, @escaping () -> Void) -> Void = { spec, completionHandler in + Task { + spec.example = example + if runFullTest { + await example.run() + } else { + await example.runSkippedTest() + } + AsyncSpec.current = nil + completionHandler() + } + } + let implementation = imp_implementationWithBlock(block as Any) + + let selectorName = TestSelectorNameProvider.testSelectorName(forAsync: example, classSelectorNames: selectorNames) + + selectorNames.insert(selectorName) + + let selector = NSSelectorFromString(selectorName) + class_addMethod(self, selector, implementation, "v@:@?") + + return selector + } +#endif // canImport(Darwin) + +#if !canImport(Darwin) + public required init() { + super.init(name: "", testClosure: { _ in }) + } + + public required init(name: String, testClosure: @escaping (XCTestCase) throws -> Swift.Void) { + super.init(name: name, testClosure: testClosure) + } + + public class var allTests: [(String, (AsyncSpec) -> () throws -> Void)] { + gatherExamplesIfNeeded() + + let tests = AsyncWorld.sharedWorld.examples(forSpecClass: self) + + let result = tests.map { (example, runFullTest) -> (String, (AsyncSpec) -> () throws -> Void) in + return (example.name, asyncTest { spec in + return { + spec.example = example + if runFullTest { + await example.run() + } else { + await example.runSkippedTest() + } + AsyncSpec.current = nil + } + }) + } + return result + } +#endif // !canImport(Darwin) + + internal static func gatherExamplesIfNeeded() { + let world = AsyncWorld.sharedWorld + let rootExampleGroup = world.rootExampleGroup(forSpecClass: self) + guard rootExampleGroup.examples.isEmpty else { + return + } + + world.performWithCurrentExampleGroup(rootExampleGroup) { + self.spec() + } + } +} diff --git a/Pods/Quick/Sources/Quick/Async/AsyncWorld.swift b/Pods/Quick/Sources/Quick/Async/AsyncWorld.swift new file mode 100644 index 0000000..b3ba644 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Async/AsyncWorld.swift @@ -0,0 +1,233 @@ +import Foundation + +/** + A collection of state Quick builds up in order to work its magic. + + AsyncWorld is primarily responsible for maintaining a mapping of AsyncSpec + classes to root example groups for those classes. + + AsyncWorld is the equivalent of World for AsyncSpec. + + It also maintains a mapping of shared example names to shared + example closures. + + You may configure how Quick behaves by calling the `AsyncWorld.configure(_:)` + method from within an overridden `class QuickConfiguration.configure(_:)` method. +*/ +final internal class AsyncWorld: _WorldBase { + /** + The example group that is currently being run. + The DSL requires that this group is correctly set in order to build a + correct hierarchy of example groups and their examples. + */ + internal var currentExampleGroup: AsyncExampleGroup! + + /** + The example metadata of the test that is currently being run. + This is useful for using the Quick test metadata (like its name) at + runtime. + */ + + internal var currentExampleMetadata: AsyncExampleMetadata? + + internal var numberOfAsyncExamplesRun = 0 + + /** + A flag that indicates whether additional test suites are being run + within this test suite. This is only true within the context of Quick + functional tests. + */ + internal var isRunningAdditionalSuites = false + + private var specs: [String: AsyncExampleGroup] = [:] + private let configuration = QCKConfiguration() + + internal private(set) var isConfigurationFinalized = false + + internal var exampleHooks: AsyncExampleHooks { return World.sharedWorld.asyncExampleHooks } + internal var suiteHooks: SuiteHooks { return World.sharedWorld.suiteHooks } + + // MARK: Singleton Constructor + + private override init() {} + + static private(set) var sharedWorld = AsyncWorld() + + internal static func anotherWorld(block: (AsyncWorld) -> T) -> T { + let previous = sharedWorld + defer { sharedWorld = previous } + return World.anotherWorld { _ in + let newWorld = AsyncWorld() + sharedWorld = newWorld + return block(newWorld) + } + } + + // MARK: Public Interface + + /** + Exposes the World's QCKConfiguration object within the scope of the closure + so that it may be configured. This method must not be called outside of + an overridden `class QuickConfiguration.configure(_:)` method. + + - parameter closure: A closure that takes a Configuration object that can + be mutated to change Quick's behavior. + */ + internal func configure(_ closure: QuickConfigurer) { + assert( + !isConfigurationFinalized, + // swiftlint:disable:next line_length + "Quick cannot be configured outside of a `class QuickConfiguration.configure(_:)` method. You should not call `AsyncWorld.configure(_:)` directly. Instead, subclass QuickConfiguration and override the `class QuickConfiguration.configure(_:)` method." + ) + closure(configuration) + } + + /** + Finalizes the World's configuration. + Any subsequent calls to World.configure() will raise. + */ + internal func finalizeConfiguration() { + isConfigurationFinalized = true + } + + /** + Returns `true` if the root example group for the given spec class has been already initialized. + + - parameter specClass: The QuickSpec class for which is checked for the existing root example group. + - returns: Whether the root example group for the given spec class has been already initialized or not. + */ + internal func isRootExampleGroupInitialized(forSpecClass specClass: AsyncSpec.Type) -> Bool { + let name = String(describing: specClass) + return specs.keys.contains(name) + } + + /** + Returns an internally constructed root example group for the given + AsyncSpec class. + + A root example group with the description "root example group" is lazily + initialized for each AsyncSpec class. This root example group wraps the + top level of a `class AsyncSpec.spec()` method--it's thanks to this group that + users can define beforeEach and it closures at the top level, like so: + + override class func spec() { + // These belong to the root example group + beforeEach {} + it("is at the top level") {} + } + + - parameter specClass: The AsyncSpec class for which to retrieve the root example group. + - returns: The root example group for the class. + */ + internal func rootExampleGroup(forSpecClass specClass: AsyncSpec.Type) -> AsyncExampleGroup { + let name = String(describing: specClass) + + if let group = specs[name] { + return group + } else { + let group = AsyncExampleGroup( + description: "root example group", + flags: [:], + isInternalRootExampleGroup: true + ) + specs[name] = group + return group + } + } + + /** + Returns all examples that should be run for a given spec class. + There are two filtering passes that occur when determining which examples should be run. + That is, these examples are the ones that are included by inclusion filters, and are + not excluded by exclusion filters. + + - parameter specClass: The AsyncSpec subclass for which examples are to be returned. + - returns: A list of examples to be run as test invocations. + */ + internal func examples(forSpecClass specClass: AsyncSpec.Type) -> [(example: AsyncExample, runFullTest: Bool)] { + // 1. Grab all included examples. + let included = includedExamples() + // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. + let spec = rootExampleGroup(forSpecClass: specClass).examples.map { example in + return ( + example: example, + runFullTest: included.first(where: { $0.example == example})?.runFullTest ?? true + ) + } + // 3. Remove all excluded examples. + return spec.map { test in + return ( + test.example, + test.runFullTest && !self.configuration.exclusionFilters.contains { $0(test.example) } + ) + } + } + + // MARK: Internal + + internal var includedExampleCount: Int { + return includedExamples().count + } + + internal lazy var cachedIncludedExampleCount: Int = self.includedExampleCount + + internal var beforesCurrentlyExecuting: Bool { + let suiteBeforesExecuting = suiteHooks.phase == .beforesExecuting + let exampleBeforesExecuting = exampleHooks.phase == .beforesExecuting + var groupBeforesExecuting = false + if let runningExampleGroup = currentExampleMetadata?.group { + groupBeforesExecuting = runningExampleGroup.phase == .beforesExecuting + } + + return suiteBeforesExecuting || exampleBeforesExecuting || groupBeforesExecuting + } + + internal var aftersCurrentlyExecuting: Bool { + let suiteAftersExecuting = suiteHooks.phase == .aftersExecuting + let exampleAftersExecuting = exampleHooks.phase == .aftersExecuting + var groupAftersExecuting = false + if let runningExampleGroup = currentExampleMetadata?.group { + groupAftersExecuting = runningExampleGroup.phase == .aftersExecuting + } + + return suiteAftersExecuting || exampleAftersExecuting || groupAftersExecuting + } + + internal func performWithCurrentExampleGroup(_ group: AsyncExampleGroup, closure: () -> Void) { + let previousExampleGroup = currentExampleGroup + currentExampleGroup = group + + closure() + + currentExampleGroup = previousExampleGroup + } + + private func allExamples() -> [AsyncExample] { + var all: [AsyncExample] = [] + for (_, group) in specs { + group.walkDownExamples { all.append($0) } + } + return all + } + + internal func hasFocusedExamples() -> Bool { + return allExamples().contains { example in + return self.configuration.inclusionFilters.contains { $0(example) } + } + } + + private func includedExamples() -> [(example: AsyncExample, runFullTest: Bool)] { + let all = allExamples() + let hasFocusedExamples = self.hasFocusedExamples() || World.sharedWorld.hasFocusedExamples() + + if !hasFocusedExamples && configuration.runAllWhenEverythingFiltered { + return all.map { example in + return (example, !self.configuration.exclusionFilters.contains { $0(example) }) + } + } else { + return all.map { example in + return (example, self.configuration.inclusionFilters.contains { $0(example) }) + } + } + } +} diff --git a/Pods/Quick/Sources/Quick/Behavior.swift b/Pods/Quick/Sources/Quick/Behavior.swift new file mode 100644 index 0000000..7a25a36 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Behavior.swift @@ -0,0 +1,19 @@ +/// A `Behavior` encapsulates a set of examples that can be re-used in several locations using the `itBehavesLike` +/// function with a context instance of the generic type. +open class Behavior { + + /** + Override this variable if you want to provide custom name for this example group. + */ + open class var name: String { return String(describing: self) } + + /** + Override this method in your behavior to define a set of reusable examples. + + This behaves just like an example group defines using `describe` or `context`--it may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + + - parameter aContext: A closure that, when evaluated, returns a `Context` instance that provide the information on the subject. + */ + open class func spec(_ aContext: @escaping () -> Context) {} +} diff --git a/Pods/Quick/Sources/Quick/Callsite.swift b/Pods/Quick/Sources/Quick/Callsite.swift new file mode 100644 index 0000000..502a9d5 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Callsite.swift @@ -0,0 +1,52 @@ +import Foundation + +#if canImport(Darwin) +// swiftlint:disable type_name +@objcMembers +public class _CallsiteBase: NSObject {} +#else +public class _CallsiteBase: NSObject {} +// swiftlint:enable type_name +#endif + +// Ideally we would always use `StaticString` as the type for tracking the file name +// in which an example is defined, for consistency with `assert` etc. from the +// stdlib, and because recent versions of the XCTest overlay require `StaticString` +// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on macOS), we +// have to use `String` instead because StaticString can't be generated from Objective-C +#if !canImport(Darwin) +public typealias FileString = StaticString +#else +public typealias FileString = String +#endif + +/** + An object encapsulating the file and line number at which + a particular example is defined. +*/ +final public class Callsite: _CallsiteBase { + /** + The absolute path of the file in which an example is defined. + */ + public let file: FileString + + /** + The line number on which an example is defined. + */ + public let line: UInt + + internal init(file: FileString, line: UInt) { + self.file = file + self.line = line + } +} + +extension Callsite { + /** + Returns a boolean indicating whether two Callsite objects are equal. + If two callsites are in the same file and on the same line, they must be equal. + */ + @nonobjc public static func == (lhs: Callsite, rhs: Callsite) -> Bool { + return String(describing: lhs.file) == String(describing: rhs.file) && lhs.line == rhs.line + } +} diff --git a/Pods/Quick/Sources/Quick/Configuration/QCKConfiguration.swift b/Pods/Quick/Sources/Quick/Configuration/QCKConfiguration.swift new file mode 100644 index 0000000..01de905 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Configuration/QCKConfiguration.swift @@ -0,0 +1,298 @@ +import Foundation + +/** + A closure that temporarily exposes a QCKConfiguration object within + the scope of the closure. +*/ +public typealias QuickConfigurer = (_ configuration: QCKConfiguration) -> Void + +/** + A closure that, given metadata about an example, returns a boolean value + indicating whether that example should be run. +*/ +public typealias ExampleFilter = (_ example: ExampleBase) -> Bool + +/** + A configuration encapsulates various options you can use + to configure Quick's behavior. +*/ +final public class QCKConfiguration: NSObject { + internal let exampleHooks = ExampleHooks() + internal let asyncExampleHooks = AsyncExampleHooks() + internal let suiteHooks = SuiteHooks() + internal var exclusionFilters: [ExampleFilter] = [ + { example in // swiftlint:disable:this opening_brace + if let pending = example.filterFlags[Filter.pending] { + return pending + } else { + return false + } + }, + ] + internal var inclusionFilters: [ExampleFilter] = [ + { example in // swiftlint:disable:this opening_brace + if let focused = example.filterFlags[Filter.focused] { + return focused + } else { + return false + } + }, + ] + + /** + Run all examples if none match the configured filters. True by default. + */ + public var runAllWhenEverythingFiltered = true + + /** + Registers an inclusion filter. + + All examples are filtered using all inclusion filters. + The remaining examples are run. If no examples remain, all examples are run. + + - parameter filter: A filter that, given an example, returns a value indicating + whether that example should be included in the examples + that are run. + */ + public func include(_ filter: @escaping ExampleFilter) { + inclusionFilters.append(filter) + } + + /** + Registers an exclusion filter. + + All examples that remain after being filtered by the inclusion filters are + then filtered via all exclusion filters. + + - parameter filter: A filter that, given an example, returns a value indicating + whether that example should be excluded from the examples + that are run. + */ + public func exclude(_ filter: @escaping ExampleFilter) { + exclusionFilters.append(filter) + } + + /** + Identical to Quick.QCKConfiguration.beforeEach, except the closure is + provided with metadata on the example that the closure is being run + prior to. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ +#if canImport(Darwin) + @objc(beforeEachWithMetadata:) + public func objc_beforeEach(_ closure: @escaping BeforeExampleWithMetadataNonThrowingClosure) { + exampleHooks.appendBefore(closure) + asyncExampleHooks.appendBefore { exampleMetadata in + await MainActor.run { + closure(exampleMetadata) + } + } + } + + @nonobjc + public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { + exampleHooks.appendBefore(closure) + asyncExampleHooks.appendBefore { exampleMetadata in + try await MainActor.run { + try closure(exampleMetadata) + } + } + } +#else + public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { + exampleHooks.appendBefore(closure) + asyncExampleHooks.appendBefore { exampleMetadata in + try await MainActor.run { + try closure(exampleMetadata) + } + } + } +#endif + + /** + Like Quick.DSL.beforeEach, this configures Quick to execute the + given closure before each example that is run. The closure + passed to this method is executed before each example Quick runs, + globally across the test suite. You may call this method multiple + times across multiple +[QuickConfigure configure:] methods in order + to define several closures to run before each example. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which beforeEach closures are evaluated + either. Multiple beforeEach defined on a single configuration, however, + will be executed in the order they're defined. + + - parameter closure: The closure to be executed before each example + in the test suite. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ + public func beforeEach(_ closure: @escaping BeforeExampleClosure) { + exampleHooks.appendBefore(closure) + asyncExampleHooks.appendBefore { @MainActor in + try closure() + } + } + + /** + Identical to Quick.QCKConfiguration.afterEach, except the closure + is provided with metadata on the example that the closure is being + run after. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ +#if canImport(Darwin) + @objc(afterEachWithMetadata:) + public func objc_afterEach(_ closure: @escaping AfterExampleWithMetadataNonThrowingClosure) { + exampleHooks.appendAfter(closure) + asyncExampleHooks.appendAfter { exampleMetadata in + await MainActor.run { + closure(exampleMetadata) + } + } + } + + @nonobjc + public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { + exampleHooks.appendAfter(closure) + asyncExampleHooks.appendAfter { exampleMetadata in + try await MainActor.run { + try closure(exampleMetadata) + } + } + } +#else + public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { + exampleHooks.appendAfter(closure) + asyncExampleHooks.appendAfter { exampleMetadata in + try await MainActor.run { + try closure(exampleMetadata) + } + } + } +#endif + + /** + Like Quick.DSL.afterEach, this configures Quick to execute the + given closure after each example that is run. The closure + passed to this method is executed after each example Quick runs, + globally across the test suite. You may call this method multiple + times across multiple +[QuickConfigure configure:] methods in order + to define several closures to run after each example. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which afterEach closures are evaluated + either. Multiple afterEach defined on a single configuration, however, + will be executed in the order they're defined. + + - parameter closure: The closure to be executed before each example + in the test suite. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ + public func afterEach(_ closure: @escaping AfterExampleClosure) { + exampleHooks.appendAfter(closure) + asyncExampleHooks.appendAfter { @MainActor in + try closure() + } + } + + /** + Like Quick.DSL.aroundEach, this configures Quick to wrap each example + with the given closure. The closure passed to this method will wrap + all examples globally across the test suite. You may call this method + multiple times across multiple +[QuickConfigure configure:] methods in + order to define several closures to wrap all examples. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which aroundEach closures are evaluated. + However, aroundEach does always guarantee proper nesting of operations: + cleanup within aroundEach closures will always happen in the reverse order + of setup. + + - parameter closure: The closure to be executed before each example + in the test suite. + + - warning: Unlike ``beforeEach`` and ``afterEach``, aroundEach does not automatically bridge between async and sync expectations. + + - SeeAlso: ``aroundEach(_:)-6ptvt`` for the async version. + */ + public func aroundEach(_ closure: @escaping AroundExampleClosure) { + exampleHooks.appendAround(closure) + } + + /** + Like Quick.DSL.aroundEach, this configures Quick to wrap each example + with the given closure. The closure passed to this method will wrap + all examples globally across the test suite. You may call this method + multiple times across multiple +[QuickConfigure configure:] methods in + order to define several closures to wrap all examples. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which aroundEach closures are evaluated. + However, aroundEach does always guarantee proper nesting of operations: + cleanup within aroundEach closures will always happen in the reverse order + of setup. + + - parameter closure: The closure to be executed before each example + in the test suite. + + - warning: Unlike ``beforeEach`` and ``afterEach``, aroundEach does not automatically bridge between async and sync expectations. + + - SeeAlso: ``aroundEach(_:)-5z8vj`` for the sync version. + */ + public func aroundEach(_ closure: @escaping AroundExampleAsyncClosure) { + asyncExampleHooks.appendAround(closure) + } + + /** + Identical to ``aroundEach(_:)-5z8vj``, except the closure receives + metadata about the example that the closure wraps. + + - warning: Unlike ``beforeEach`` and ``afterEach``, aroundEach does not automatically bridge between async and sync expectations. + + - SeeAlso: ``aroundEach(_:)-2xmgx`` for the async version. + */ + public func aroundEach(_ closure: @escaping AroundExampleWithMetadataClosure) { + exampleHooks.appendAround(closure) + } + + /** + Identical to ``aroundEach(_:)-6ptvt``, except the closure receives + metadata about the example that the closure wraps. + + - warning: Unlike ``beforeEach`` and ``afterEach``, aroundEach does not automatically bridge between async and sync expectations. + + - SeeAlso: ``aroundEach(_:)-2xmgx`` for the sync version. + */ + public func aroundEach(_ closure: @escaping AroundExampleWithMetadataAsyncClosure) { + asyncExampleHooks.appendAround(closure) + } + + /** + Like Quick.DSL.beforeSuite, this configures Quick to execute + the given closure prior to any and all examples that are run. + The two methods are functionally equivalent. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ + public func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { + suiteHooks.appendBefore(closure) + } + + /** + Like Quick.DSL.afterSuite, this configures Quick to execute + the given closure after all examples have been run. + The two methods are functionally equivalent. + + - Important: This automatically bridges between async and sync specs. When running on AsyncSpecs, this closure will run on the main actor. + */ + public func afterSuite(_ closure: @escaping AfterSuiteClosure) { + suiteHooks.appendAfter(closure) + } +} diff --git a/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift new file mode 100644 index 0000000..a1e879e --- /dev/null +++ b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.swift @@ -0,0 +1,64 @@ +import Foundation +import XCTest + +#if SWIFT_PACKAGE + +/** + Subclass QuickConfiguration and override the `configure(_:)` class + method in order to configure how Quick behaves when running specs, or to define + shared examples that are used across spec files. + */ +open class QuickConfiguration: NSObject { + /** + This method is executed on each subclass of this class before Quick runs + any examples. You may override this method on as many subclasses as you like, but + there is no guarantee as to the order in which these methods are executed. + + You can override this method in order to: + + 1. Configure how Quick behaves, by modifying properties on the Configuration object. + Setting the same properties in several methods has undefined behavior. + + 2. Define shared examples using `sharedExamples`. + + - Parameter configuration: A mutable object that is used to configure how Quick behaves on + a framework level. For details on all the options, see the + documentation in QCKConfiguration.swift. + */ + open class func configure(_ configuration: QCKConfiguration) {} +} + +#endif + +extension QuickConfiguration { + private static var configurationSubclasses: [QuickConfiguration.Type] = [] + + #if canImport(Darwin) + @objc + static func configureSubclassesIfNeeded(world: World) { + _configureSubclassesIfNeeded(world: world) + } + #else + static func configureSubclassesIfNeeded(_ configurationSubclasses: [QuickConfiguration.Type]? = nil, world: World) { + // Storing subclasses for later use (will be used when running additional test suites) + if let configurationSubclasses = configurationSubclasses { + self.configurationSubclasses = configurationSubclasses + } + + _configureSubclassesIfNeeded(world: world) + } + #endif + + private static func _configureSubclassesIfNeeded(world: World) { + if world.isConfigurationFinalized { return } + + // Perform all configurations (ensures that shared examples have been discovered) + world.configure { configuration in + (allSubclasses(ofType: QuickConfiguration.self) + configurationSubclasses) + .forEach { (configurationClass: QuickConfiguration.Type) in + configurationClass.configure(configuration) + } + } + world.finalizeConfiguration() + } +} diff --git a/Pods/Quick/Sources/Quick/CurrentSpec.swift b/Pods/Quick/Sources/Quick/CurrentSpec.swift new file mode 100644 index 0000000..7292028 --- /dev/null +++ b/Pods/Quick/Sources/Quick/CurrentSpec.swift @@ -0,0 +1,11 @@ +import XCTest + +/// A way to get either the current QuickSpec or AsyncSpec, whichever is relevant to the given context +/// This is intended to be used inside of `beforeSuite` or `afterSuite` closures, in order to access +/// `XCTestCase` APIs (e.g. `expectation(description:)` or `waitForExpectations()`) +/// +/// This does not work with standard XCTest APIs - this does not provide the currently executing +/// `XCTestCase` instance for tests defined using `XCTest`. +public func currentSpec() -> XCTestCase? { + QuickSpec.current ?? AsyncSpec.current +} diff --git a/Pods/Quick/Sources/Quick/DSL/AsyncDSL.swift b/Pods/Quick/Sources/Quick/DSL/AsyncDSL.swift new file mode 100644 index 0000000..6f18fa5 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/AsyncDSL.swift @@ -0,0 +1,271 @@ +// swiftlint:disable line_length + +/// A protocol for defining the synchronous DSL usable from Quick synchronous specs. +public protocol AsyncDSLUser {} + +extension AsyncSpec: AsyncDSLUser {} +extension AsyncBehavior: AsyncDSLUser {} + +extension AsyncDSLUser { + // MARK: - beforeSuite + /** + Defines a closure to be run prior to any examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before the first example is run, this closure + will not be executed. + + beforeSuite intentionally does not allow async methods to be called. This is to ensure that in a mixed synchronous & asynchronous environment, beforeSuite hooks are truly called before any tests in the the suite run. + + - parameter closure: The closure to be run prior to any examples in the test suite. + */ + public static func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { + World.sharedWorld.beforeSuite(closure) + } + + // MARK: - afterSuite + /** + Defines a closure to be run after all of the examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before all examples are run, this closure + will not be executed. + + afterSuite intentionally does not allow async methods to be called. This is to ensure that in a mixed synchronous & asynchronous environment, beforeSuite hooks are truly called after all tests in the the suite have run. + + - parameter closure: The closure to be run after all of the examples in the test suite. + */ + public static func afterSuite(_ closure: @escaping AfterSuiteClosure) { + World.sharedWorld.afterSuite(closure) + } + + // MARK: - Example groups + /** + Defines an example group. Example groups are logical groupings of examples. + Example groups can share setup and teardown code. + + - parameter description: An arbitrary string describing the example group. + - parameter closure: A closure that can contain other examples. + */ + public static func describe(_ description: String, closure: () -> Void) { + AsyncWorld.sharedWorld.describe(description, closure: closure) + } + + /** + Defines an example group. Equivalent to `describe`. + */ + public static func context(_ description: String, closure: () -> Void) { + AsyncWorld.sharedWorld.context(description, closure: closure) + } + + // MARK: - beforeEach + /** + Defines a closure to be run prior to each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of beforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run prior to each example. + */ + public static func beforeEach(_ closure: @escaping BeforeExampleAsyncClosure) { + AsyncWorld.sharedWorld.beforeEach(closure) + } + + /** + Identical to Quick.DSL.beforeEach, except the closure is provided with + metadata on the example that the closure is being run prior to. + */ + public static func beforeEach(_ closure: @escaping BeforeExampleWithMetadataAsyncClosure) { + AsyncWorld.sharedWorld.beforeEach(closure: closure) + } + + // MARK: - AfterEach + /** + Defines a closure to be run after each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of afterEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run after each example. + */ + public static func afterEach(_ closure: @escaping AfterExampleAsyncClosure) { + AsyncWorld.sharedWorld.afterEach(closure) + } + + /** + Identical to Quick.DSL.afterEach, except the closure is provided with + metadata on the example that the closure is being run after. + */ + public static func afterEach(_ closure: @escaping AfterExampleWithMetadataAsyncClosure) { + AsyncWorld.sharedWorld.afterEach(closure: closure) + } + + // MARK: - aroundEach + /** + Defines a closure to that wraps each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + + The closure you pass to aroundEach receives a callback as its argument, which + it MUST call exactly one for the example to run properly: + + aroundEach { runExample in + doSomeSetup() + runExample() + doSomeCleanup() + } + + This callback is particularly useful for test decartions that can’t split + into a separate beforeEach and afterEach. For example, running each example + in its own autorelease pool (provided by Task) requires aroundEach: + + aroundEach { runExample in + autoreleasepool { + runExample() + } + checkObjectsNoLongerRetained() + } + + You can also use aroundEach to guarantee proper nesting of setup and cleanup + operations in situations where their relative order matters. + + An example group may contain an unlimited number of aroundEach callbacks. + They will nest inside each other, with the first declared in the group + nested at the outermost level. + + - parameter closure: The closure that wraps around each example. + */ + public static func aroundEach(_ closure: @escaping AroundExampleAsyncClosure) { + AsyncWorld.sharedWorld.aroundEach(closure) + } + + /** + Identical to Quick.DSL.aroundEach, except the closure receives metadata + about the example that the closure wraps. + */ + public static func aroundEach(_ closure: @escaping AroundExampleWithMetadataAsyncClosure) { + AsyncWorld.sharedWorld.aroundEach(closure) + } + + // MARK: - Examples + /** + Defines a closure to be run prior to each example but after any beforeEach blocks. + This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of justBeforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run prior to each example and after any beforeEach blocks + */ + + public static func justBeforeEach(_ closure: @escaping BeforeExampleAsyncClosure) { + AsyncWorld.sharedWorld.justBeforeEach(closure) + } + + /** + Defines an example. Examples use assertions to demonstrate how code should + behave. These are like "tests" in XCTest. + + - parameter description: An arbitrary string describing what the example is meant to specify. + - parameter closure: A closure that can contain assertions. + - parameter file: The absolute path to the file containing the example. A sensible default is provided. + - parameter line: The line containing the example. A sensible default is provided. + */ + public static func it(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () async throws -> Void) { + AsyncWorld.sharedWorld.it(description, file: file, line: line, closure: closure) + } + + // MARK: - Shared Examples + /** + Inserts the examples defined using a ``AsyncBehavior`` into the current example group. + The shared examples are executed at this location, as if they were written out manually. + This function also passes a strongly-typed context that can be evaluated to give the shared examples extra information on the subject of the example. + + - parameter behavior: The type of ``AsyncBehavior`` class defining the example group to be executed. + - parameter context: A closure that, when evaluated, returns an instance of `Behavior`'s context type to provide its example group with extra information on the subject of the example. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. + */ + public static func itBehavesLike(_ behavior: AsyncBehavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + AsyncWorld.sharedWorld.itBehavesLike(behavior, context: context, file: file, line: line) + } + + // MARK: - Pending + /** + Defines an example or example group that should not be executed. Use `pending` to temporarily disable + examples or groups that should not be run yet. + + - parameter description: An arbitrary string describing the example or example group. + - parameter closure: A closure that will not be evaluated. + */ + public static func pending(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () async throws -> Void) { + AsyncWorld.sharedWorld.pending(description, file: file, line: line, closure: closure) + } + + // MARK: - Defocused + /** + Use this to quickly mark a `describe` closure as pending. + This disables all examples within the closure. + */ + public static func xdescribe(_ description: String, closure: () -> Void) { + AsyncWorld.sharedWorld.xdescribe(description, closure: closure) + } + + /** + Use this to quickly mark a `context` closure as pending. + This disables all examples within the closure. + */ + public static func xcontext(_ description: String, closure: () -> Void) { + xdescribe(description, closure: closure) + } + + /** + Use this to quickly mark an `it` closure as pending. + This disables the example and ensures the code within the closure is never run. + */ + public static func xit(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () async throws -> Void) { + AsyncWorld.sharedWorld.xit(description, file: file, line: line, closure: closure) + } + + /** + Use this to quickly mark an `itBehavesLike` closure as pending. + This disables the example group defined by this behavior and ensures the code within is never run. + */ + public static func xitBehavesLike(_ behavior: AsyncBehavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + AsyncWorld.sharedWorld.xitBehavesLike(behavior, context: context, file: file, line: line) + } + + // MARK: - Focused + /** + Use this to quickly focus a `describe` closure, focusing the examples in the closure. + If any examples in the test suite are focused, only those examples are executed. + This trumps any explicitly focused or unfocused examples within the closure--they are all treated as focused. + */ + public static func fdescribe(_ description: String, closure: () -> Void) { + AsyncWorld.sharedWorld.fdescribe(description, closure: closure) + } + + /** + Use this to quickly focus a `context` closure. Equivalent to `fdescribe`. + */ + public static func fcontext(_ description: String, closure: () -> Void) { + fdescribe(description, closure: closure) + } + + /** + Use this to quickly focus an `it` closure, focusing the example. + If any examples in the test suite are focused, only those examples are executed. + */ + public static func fit(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () async throws -> Void) { + AsyncWorld.sharedWorld.fit(description, file: file, line: line, closure: closure) + } + + /** + Use this to quickly focus on `itBehavesLike` closure. + */ + public static func fitBehavesLike(_ behavior: AsyncBehavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + AsyncWorld.sharedWorld.fitBehavesLike(behavior, context: context, file: file, line: line) + } +} + +// swiftlint:enable line_length diff --git a/Pods/Quick/Sources/Quick/DSL/AsyncWorld+DSL.swift b/Pods/Quick/Sources/Quick/DSL/AsyncWorld+DSL.swift new file mode 100644 index 0000000..d365eb6 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/AsyncWorld+DSL.swift @@ -0,0 +1,163 @@ +import Foundation + +/** + Adds methods to World to support top-level DSL functions. These functions map directly to the DSL that test + writers use in their specs. +*/ +extension AsyncWorld { + // MARK: - Example groups. + @nonobjc + internal func describe(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { + guard currentExampleMetadata == nil else { + raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'.") + } + guard currentExampleGroup != nil else { + // swiftlint:disable:next line_length + raiseError("Error: example group was not created by its parent QuickSpec spec. Check that describe() or context() was used in QuickSpec.spec() and not a more general context (i.e. an XCTestCase test)") + } + let group = AsyncExampleGroup(description: description, flags: flags) + currentExampleGroup.appendExampleGroup(group) + performWithCurrentExampleGroup(group, closure: closure) + } + + @nonobjc + internal func context(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { + guard currentExampleMetadata == nil else { + raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'.") + } + self.describe(description, flags: flags, closure: closure) + } + + @nonobjc + internal func fdescribe(_ description: String, closure: () -> Void) { + self.describe(description, flags: [Filter.focused: true], closure: closure) + } + + @nonobjc + internal func xdescribe(_ description: String, closure: () -> Void) { + self.describe(description, flags: [Filter.pending: true], closure: closure) + } + + // MARK: - Just Before Each + internal func justBeforeEach(_ closure: @escaping BeforeExampleAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'justBeforeEach' cannot be used inside '\(currentPhase)', 'justBeforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendJustBeforeEach(closure) + } + + // MARK: - Before Each + internal func beforeEach(closure: @escaping BeforeExampleWithMetadataAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } + + internal func beforeEach(_ closure: @escaping BeforeExampleAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } + + // MARK: - After Each + internal func afterEach(closure: @escaping AfterExampleWithMetadataAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } + + internal func afterEach(_ closure: @escaping AfterExampleAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } + + // MARK: - Around Each + internal func aroundEach(_ closure: @escaping AroundExampleAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + + internal func aroundEach(_ closure: @escaping AroundExampleWithMetadataAsyncClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + + // MARK: - Examples (Swift) + @nonobjc + internal func it(_ description: String, flags: FilterFlags = [:], file: FileString, line: UInt, closure: @escaping () async throws -> Void) { + if beforesCurrentlyExecuting { + raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'.") + } + if aftersCurrentlyExecuting { + raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'.") + } + guard currentExampleMetadata == nil else { + raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let example = AsyncExample(description: description, callsite: callsite, flags: flags, closure: closure) + currentExampleGroup.appendExample(example) + } + + @nonobjc + internal func fit(_ description: String, file: FileString, line: UInt, closure: @escaping () async throws -> Void) { + self.it(description, flags: [Filter.focused: true], file: file, line: line, closure: closure) + } + + @nonobjc + internal func xit(_ description: String, file: FileString, line: UInt, closure: @escaping () async throws -> Void) { + self.it(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } + + // MARK: - Shared Behavior + internal func itBehavesLike(_ behavior: AsyncBehavior.Type, context: @escaping () -> C, flags: FilterFlags = [:], file: FileString, line: UInt) { + guard currentExampleMetadata == nil else { + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let closure = behavior.spec + let group = AsyncExampleGroup(description: behavior.name, flags: flags) + currentExampleGroup.appendExampleGroup(group) + performWithCurrentExampleGroup(group) { + closure(context) + } + + group.walkDownExamples { (example: AsyncExample) in + example.isSharedExample = true + example.callsite = callsite + } + } + + internal func fitBehavesLike(_ behavior: AsyncBehavior.Type, context: @escaping () -> C, file: FileString, line: UInt) { + self.itBehavesLike(behavior, context: context, flags: [Filter.focused: true], file: file, line: line) + } + + internal func xitBehavesLike(_ behavior: AsyncBehavior.Type, context: @escaping () -> C, file: FileString, line: UInt) { + self.itBehavesLike(behavior, context: context, flags: [Filter.pending: true], file: file, line: line) + } + + // MARK: - Pending + @nonobjc + internal func pending(_ description: String, file: FileString, line: UInt, closure: @escaping () async throws -> Void) { + self.it(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } + + private var currentPhase: String { + if beforesCurrentlyExecuting { + return "beforeEach" + } else if aftersCurrentlyExecuting { + return "afterEach" + } + + return "it" + } +} diff --git a/Pods/Quick/Sources/Quick/DSL/DSL.swift b/Pods/Quick/Sources/Quick/DSL/DSL.swift new file mode 100644 index 0000000..d222971 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/DSL.swift @@ -0,0 +1,363 @@ +// swiftlint:disable line_length + +/// A protocol for defining the synchronous DSL usable from Quick synchronous specs. +public protocol SyncDSLUser {} + +extension QuickSpec: SyncDSLUser {} +extension Behavior: SyncDSLUser {} +extension QuickConfiguration: SyncDSLUser {} + +extension SyncDSLUser { + + // MARK: - beforeSuite + /** + Defines a closure to be run prior to any examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before the first example is run, this closure + will not be executed. + + - parameter closure: The closure to be run prior to any examples in the test suite. + */ + public static func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { + World.sharedWorld.beforeSuite(closure) + } + + // MARK: - afterSuite + /** + Defines a closure to be run after all of the examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before all examples are run, this closure + will not be executed. + + - parameter closure: The closure to be run after all of the examples in the test suite. + */ + public static func afterSuite(_ closure: @escaping AfterSuiteClosure) { + World.sharedWorld.afterSuite(closure) + } + + // MARK: - sharedExamples + /** + Defines a group of shared examples. These examples can be re-used in several locations + by using the `itBehavesLike` function. + + - parameter name: The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + - parameter closure: A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + */ + public static func sharedExamples(_ name: String, closure: @escaping () -> Void) { + World.sharedWorld.sharedExamples(name) { _ in closure() } + } + + /** + Defines a group of shared examples. These examples can be re-used in several locations + by using the `itBehavesLike` function. + + - parameter name: The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + - parameter closure: A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + + The closure takes a SharedExampleContext as an argument. This context is a function + that can be executed to retrieve parameters passed in via an `itBehavesLike` function. + */ + public static func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) { + World.sharedWorld.sharedExamples(name, closure: closure) + } + + // MARK: - Example groups + /** + Defines an example group. Example groups are logical groupings of examples. + Example groups can share setup and teardown code. + + - parameter description: An arbitrary string describing the example group. + - parameter closure: A closure that can contain other examples. + */ + public static func describe(_ description: String, closure: () -> Void) { + World.sharedWorld.describe(description, closure: closure) + } + + /** + Defines an example group. Equivalent to `describe`. + */ + public static func context(_ description: String, closure: () -> Void) { + World.sharedWorld.context(description, closure: closure) + } + + // MARK: - beforeEach + /** + Defines a closure to be run prior to each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of beforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run prior to each example. + */ + public static func beforeEach(_ closure: @escaping BeforeExampleClosure) { + World.sharedWorld.beforeEach(closure) + } + + /** + Identical to Quick.DSL.beforeEach, except the closure is provided with + metadata on the example that the closure is being run prior to. + */ + public static func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { + World.sharedWorld.beforeEach(closure: closure) + } + + // MARK: - AfterEach + /** + Defines a closure to be run after each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of afterEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run after each example. + */ + public static func afterEach(_ closure: @escaping AfterExampleClosure) { + World.sharedWorld.afterEach(closure) + } + + /** + Identical to Quick.DSL.afterEach, except the closure is provided with + metadata on the example that the closure is being run after. + */ + public static func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { + World.sharedWorld.afterEach(closure: closure) + } + + // MARK: - aroundEach + /** + Defines a closure to that wraps each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + + The closure you pass to aroundEach receives a callback as its argument, which + it MUST call exactly one for the example to run properly: + + aroundEach { runExample in + doSomeSetup() + runExample() + doSomeCleanup() + } + + This callback is particularly useful for test decartions that can’t split + into a separate beforeEach and afterEach. For example, running each example + in its own autorelease pool (provided by Task) requires aroundEach: + + aroundEach { runExample in + autoreleasepool { + runExample() + } + checkObjectsNoLongerRetained() + } + + You can also use aroundEach to guarantee proper nesting of setup and cleanup + operations in situations where their relative order matters. + + An example group may contain an unlimited number of aroundEach callbacks. + They will nest inside each other, with the first declared in the group + nested at the outermost level. + + - parameter closure: The closure that wraps around each example. + */ + public static func aroundEach(_ closure: @escaping AroundExampleClosure) { + World.sharedWorld.aroundEach(closure) + } + + /** + Identical to Quick.DSL.aroundEach, except the closure receives metadata + about the example that the closure wraps. + */ + public static func aroundEach(_ closure: @escaping AroundExampleWithMetadataClosure) { + World.sharedWorld.aroundEach(closure) + } + + // MARK: - Examples + /** + Defines a closure to be run prior to each example but after any beforeEach blocks. + This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of justBeforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run prior to each example and after any beforeEach blocks + */ + + public static func justBeforeEach(_ closure: @escaping BeforeExampleClosure) { + World.sharedWorld.justBeforeEach(closure) + } + + /** + Defines an example. Examples use assertions to demonstrate how code should + behave. These are like "tests" in XCTest. + + - parameter description: An arbitrary string describing what the example is meant to specify. + - parameter closure: A closure that can contain assertions. + - parameter file: The absolute path to the file containing the example. A sensible default is provided. + - parameter line: The line containing the example. A sensible default is provided. + */ + public static func it(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { + World.sharedWorld.it(description, file: file, line: line, closure: closure) + } + + // MARK: - Shared Examples + /** + Inserts the examples defined using a `sharedExamples` function into the current example group. + The shared examples are executed at this location, as if they were written out manually. + + - parameter name: The name of the shared examples group to be executed. This must be identical to the + name of a shared examples group defined using `sharedExamples`. If there are no shared + examples that match the name given, an exception is thrown and the test suite will crash. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. + */ + public static func itBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line) { + itBehavesLike(name, file: file, line: line, sharedExampleContext: { return [:] }) + } + + /** + Inserts the examples defined using a `sharedExamples` function into the current example group. + The shared examples are executed at this location, as if they were written out manually. + This function also passes those shared examples a context that can be evaluated to give the shared + examples extra information on the subject of the example. + + - parameter name: The name of the shared examples group to be executed. This must be identical to the + name of a shared examples group defined using `sharedExamples`. If there are no shared + examples that match the name given, an exception is thrown and the test suite will crash. + - parameter sharedExampleContext: A closure that, when evaluated, returns key-value pairs that provide the + shared examples with extra information on the subject of the example. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. + */ + public static func itBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { + World.sharedWorld.itBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + /** + Inserts the examples defined using a `Behavior` into the current example group. + The shared examples are executed at this location, as if they were written out manually. + This function also passes a strongly-typed context that can be evaluated to give the shared examples extra information on the subject of the example. + + - parameter behavior: The type of `Behavior` class defining the example group to be executed. + - parameter context: A closure that, when evaluated, returns an instance of `Behavior`'s context type to provide its example group with extra information on the subject of the example. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. + */ + public static func itBehavesLike(_ behavior: Behavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + World.sharedWorld.itBehavesLike(behavior, context: context, file: file, line: line) + } + + // MARK: - Pending + /** + Defines an example or example group that should not be executed. Use `pending` to temporarily disable + examples or groups that should not be run yet. + + - parameter description: An arbitrary string describing the example or example group. + - parameter closure: A closure that will not be evaluated. + */ + public static func pending(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { + World.sharedWorld.pending(description, file: file, line: line, closure: closure) + } + + // MARK: - Defocused + /** + Use this to quickly mark a `describe` closure as pending. + This disables all examples within the closure. + */ + public static func xdescribe(_ description: String, closure: () -> Void) { + World.sharedWorld.xdescribe(description, closure: closure) + } + + /** + Use this to quickly mark a `context` closure as pending. + This disables all examples within the closure. + */ + public static func xcontext(_ description: String, closure: () -> Void) { + xdescribe(description, closure: closure) + } + + /** + Use this to quickly mark an `it` closure as pending. + This disables the example and ensures the code within the closure is never run. + */ + public static func xit(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { + World.sharedWorld.xit(description, file: file, line: line, closure: closure) + } + + /** + Use this to quickly mark an `itBehavesLike` closure as pending. + This disables the example group defined by this behavior and ensures the code within is never run. + */ + public static func xitBehavesLike(_ behavior: Behavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + World.sharedWorld.xitBehavesLike(behavior, context: context, file: file, line: line) + } + + /** + Use this to quickly mark an `itBehavesLike` closure as pending. + This disables the example group defined by this behavior and ensures the code within is never run. + */ + public static func xitBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line) { + xitBehavesLike(name, file: file, line: line, sharedExampleContext: { return [:] }) + } + + /** + Use this to quickly mark an `itBehavesLike` closure as pending. + This disables the example group defined by this behavior and ensures the code within is never run. + */ + public static func xitBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { + World.sharedWorld.xitBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + // MARK: - Focused + /** + Use this to quickly focus a `describe` closure, focusing the examples in the closure. + If any examples in the test suite are focused, only those examples are executed. + This trumps any explicitly focused or unfocused examples within the closure--they are all treated as focused. + */ + public static func fdescribe(_ description: String, closure: () -> Void) { + World.sharedWorld.fdescribe(description, closure: closure) + } + + /** + Use this to quickly focus a `context` closure. Equivalent to `fdescribe`. + */ + public static func fcontext(_ description: String, closure: () -> Void) { + fdescribe(description, closure: closure) + } + + /** + Use this to quickly focus an `it` closure, focusing the example. + If any examples in the test suite are focused, only those examples are executed. + */ + public static func fit(_ description: String, file: FileString = #file, line: UInt = #line, closure: @escaping () throws -> Void) { + World.sharedWorld.fit(description, file: file, line: line, closure: closure) + } + + /** + Use this to quickly focus an `itBehavesLike` closure. + */ + public static func fitBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line) { + fitBehavesLike(name, file: file, line: line, sharedExampleContext: { return [:] }) + } + + /** + Use this to quickly focus an `itBehavesLike` closure. + */ + public static func fitBehavesLike(_ name: String, file: FileString = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { + World.sharedWorld.fitBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + /** + Use this to quickly focus on `itBehavesLike` closure. + */ + public static func fitBehavesLike(_ behavior: Behavior.Type, file: FileString = #file, line: UInt = #line, context: @escaping () -> C) { + World.sharedWorld.fitBehavesLike(behavior, context: context, file: file, line: line) + } +} + +// swiftlint:enable line_length diff --git a/Pods/Quick/Sources/Quick/DSL/World+DSL.swift b/Pods/Quick/Sources/Quick/DSL/World+DSL.swift new file mode 100644 index 0000000..d6eb719 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/World+DSL.swift @@ -0,0 +1,346 @@ +import Foundation + +/** + Adds methods to World to support top-level DSL functions (Swift) and + macros (Objective-C). These functions map directly to the DSL that test + writers use in their specs. +*/ +extension World { + // MARK: - Before Suite +#if canImport(Darwin) + @objc(beforeSuite:) + internal func objc_beforeSuite(_ closure: @escaping BeforeSuiteNonThrowingClosure) { + suiteHooks.appendBefore(closure) + } +#endif + + @nonobjc + internal func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { + suiteHooks.appendBefore(closure) + } + + // MARK: - After Suite +#if canImport(Darwin) + @objc(afterSuite:) + internal func objc_afterSuite(_ closure: @escaping AfterSuiteNonThrowingClosure) { + suiteHooks.appendAfter(closure) + } +#endif + + @nonobjc + internal func afterSuite(_ closure: @escaping AfterSuiteClosure) { + suiteHooks.appendAfter(closure) + } + + // MARK: - Specifying shared examples + internal func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) { + registerSharedExample(name, closure: closure) + } + + // MARK: - Example groups. + internal func describe(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { + guard currentExampleMetadata == nil else { + raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'.") + } + guard currentExampleGroup != nil else { + // swiftlint:disable:next line_length + raiseError("Error: example group was not created by its parent QuickSpec spec. Check that describe() or context() was used in QuickSpec.spec() and not a more general context (i.e. an XCTestCase test)") + } + let group = ExampleGroup(description: description, flags: flags) + currentExampleGroup.appendExampleGroup(group) + performWithCurrentExampleGroup(group, closure: closure) + } + + internal func context(_ description: String, flags: FilterFlags = [:], closure: () -> Void) { + guard currentExampleMetadata == nil else { + raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'.") + } + self.describe(description, flags: flags, closure: closure) + } + + internal func fdescribe(_ description: String, closure: () -> Void) { + self.describe(description, flags: [Filter.focused: true], closure: closure) + } + + internal func xdescribe(_ description: String, closure: () -> Void) { + self.describe(description, flags: [Filter.pending: true], closure: closure) + } + + // MARK: - Just Before Each +#if canImport(Darwin) + @objc(justBeforeEach:) + internal func objc_justBeforeEach(_ closure: @escaping BeforeExampleNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'justBeforeEach' cannot be used inside '\(currentPhase)', 'justBeforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendJustBeforeEach(closure) + } +#endif + + @nonobjc + internal func justBeforeEach(_ closure: @escaping BeforeExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'justBeforeEach' cannot be used inside '\(currentPhase)', 'justBeforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendJustBeforeEach(closure) + } + + // MARK: - Before Each +#if canImport(Darwin) + @objc(beforeEachWithMetadata:) + internal func objc_beforeEach(closure: @escaping BeforeExampleWithMetadataNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } + + @objc(beforeEach:) + internal func objc_beforeEach(closure: @escaping BeforeExampleNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } +#endif + + @nonobjc + internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } + + @nonobjc + internal func beforeEach(_ closure: @escaping BeforeExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendBefore(closure) + } + + // MARK: - After Each +#if canImport(Darwin) + @objc(afterEachWithMetadata:) + internal func objc_afterEach(closure: @escaping AfterExampleWithMetadataNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } + + @objc(afterEach:) + internal func objc_afterEach(_ closure: @escaping AfterExampleNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } +#endif + + @nonobjc + internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } + + @nonobjc + internal func afterEach(_ closure: @escaping AfterExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'.") + } + currentExampleGroup.hooks.appendAfter(closure) + } + + // MARK: - Around Each + #if canImport(Darwin) + @objc(aroundEach:) + internal func objc_aroundEach(_ closure: @escaping AroundExampleNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + + @objc(aroundEachWithMetadata:) + internal func objc_aroundEach(_ closure: @escaping AroundExampleWithMetadataNonThrowingClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + #endif + + @nonobjc + internal func aroundEach(_ closure: @escaping AroundExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + + @nonobjc + internal func aroundEach(_ closure: @escaping AroundExampleWithMetadataClosure) { + guard currentExampleMetadata == nil else { + raiseError("'aroundEach' cannot be used inside '\(currentPhase)', 'aroundEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAround(closure) + } + + // MARK: - Examples (Swift) + @nonobjc + internal func it(_ description: String, flags: FilterFlags = [:], file: FileString, line: UInt, closure: @escaping () throws -> Void) { + if beforesCurrentlyExecuting { + raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'.") + } + if aftersCurrentlyExecuting { + raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'.") + } + guard currentExampleMetadata == nil else { + raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let example = Example(description: description, callsite: callsite, flags: flags, closure: closure) + currentExampleGroup.appendExample(example) + } + + @nonobjc + internal func fit(_ description: String, file: FileString, line: UInt, closure: @escaping () throws -> Void) { + self.it(description, flags: [Filter.focused: true], file: file, line: line, closure: closure) + } + + @nonobjc + internal func xit(_ description: String, file: FileString, line: UInt, closure: @escaping () throws -> Void) { + self.it(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } + + // MARK: - Shared Behavior + @nonobjc + internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags = [:], file: FileString, line: UInt) { + guard currentExampleMetadata == nil else { + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let closure = World.sharedWorld.sharedExample(name) + + let group = ExampleGroup(description: name, flags: flags) + currentExampleGroup.appendExampleGroup(group) + performWithCurrentExampleGroup(group) { + closure(sharedExampleContext) + } + + group.walkDownExamples { (example: Example) in + example.isSharedExample = true + example.callsite = callsite + } + } + + @nonobjc + internal func fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, file: FileString, line: UInt) { + self.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: [Filter.focused: true], file: file, line: line) + } + + @nonobjc + internal func xitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, file: FileString, line: UInt) { + self.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: [Filter.pending: true], file: file, line: line) + } + + internal func itBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, flags: FilterFlags = [:], file: FileString, line: UInt) { + guard currentExampleMetadata == nil else { + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let closure = behavior.spec + let group = ExampleGroup(description: behavior.name, flags: flags) + currentExampleGroup.appendExampleGroup(group) + performWithCurrentExampleGroup(group) { + closure(context) + } + + group.walkDownExamples { (example: Example) in + example.isSharedExample = true + example.callsite = callsite + } + } + + internal func fitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, file: FileString, line: UInt) { + self.itBehavesLike(behavior, context: context, flags: [Filter.focused: true], file: file, line: line) + } + + internal func xitBehavesLike(_ behavior: Behavior.Type, context: @escaping () -> C, file: FileString, line: UInt) { + self.itBehavesLike(behavior, context: context, flags: [Filter.pending: true], file: file, line: line) + } + + // MARK: Examples & Shared behavior (objc) +#if canImport(Darwin) && !SWIFT_PACKAGE + @nonobjc + internal func syncIt(_ description: String, flags: FilterFlags = [:], file: FileString, line: UInt, closure: @escaping () throws -> Void) { + if beforesCurrentlyExecuting { + raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'.") + } + if aftersCurrentlyExecuting { + raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'.") + } + guard currentExampleMetadata == nil else { + raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'.") + } + let callsite = Callsite(file: file, line: line) + let example = Example(description: description, callsite: callsite, flags: flags, closure: closure) + currentExampleGroup.appendExample(example) + } + + @objc(itWithDescription:file:line:closure:) + internal func objc_it(_ description: String, file: FileString, line: UInt, closure: @escaping () -> Void) { + syncIt(description, file: file, line: line, closure: closure) + } + + @objc(fitWithDescription:file:line:closure:) + internal func objc_fit(_ description: String, file: FileString, line: UInt, closure: @escaping () -> Void) { + syncIt(description, flags: [Filter.focused: true], file: file, line: line, closure: closure) + } + + @objc(xitWithDescription:file:line:closure:) + internal func objc_xit(_ description: String, file: FileString, line: UInt, closure: @escaping () -> Void) { + syncIt(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } + + @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:file:line:) + internal func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, file: FileString, line: UInt) { + itBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + @objc(fitBehavesLikeSharedExampleNamed:sharedExampleContext:file:line:) + internal func objc_fitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, file: FileString, line: UInt) { + fitBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + @objc(xitBehavesLikeSharedExampleNamed:sharedExampleContext:file:line:) + internal func objc_xitBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, file: FileString, line: UInt) { + xitBehavesLike(name, sharedExampleContext: sharedExampleContext, file: file, line: line) + } + + @objc(pendingWithDescription:file:line:closure:) + internal func objc_pending(_ description: String, file: FileString, line: UInt, closure: @escaping () -> Void) { + self.it(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } +#endif + + // MARK: - Pending + @nonobjc + internal func pending(_ description: String, file: FileString, line: UInt, closure: @escaping () throws -> Void) { + self.it(description, flags: [Filter.pending: true], file: file, line: line, closure: closure) + } + + private var currentPhase: String { + if beforesCurrentlyExecuting { + return "beforeEach" + } else if aftersCurrentlyExecuting { + return "afterEach" + } + + return "it" + } +} diff --git a/Pods/Quick/Sources/Quick/ErrorUtility.swift b/Pods/Quick/Sources/Quick/ErrorUtility.swift new file mode 100644 index 0000000..f13f43a --- /dev/null +++ b/Pods/Quick/Sources/Quick/ErrorUtility.swift @@ -0,0 +1,10 @@ +import Foundation + +internal func raiseError(_ message: String) -> Never { +#if canImport(Darwin) + NSException(name: .internalInconsistencyException, reason: message, userInfo: nil).raise() +#endif + + // This won't be reached when ObjC is available and the exception above is raisd + fatalError(message) +} diff --git a/Pods/Quick/Sources/Quick/ExampleGroup.swift b/Pods/Quick/Sources/Quick/ExampleGroup.swift new file mode 100644 index 0000000..bb6f867 --- /dev/null +++ b/Pods/Quick/Sources/Quick/ExampleGroup.swift @@ -0,0 +1,127 @@ +import Foundation + +internal protocol Filterable { + var filterFlags: FilterFlags { get } +} + +private enum ExampleUnit { + case example(Example) + case group(ExampleGroup) +} + +/** + Example groups are logical groupings of examples, defined with + the `describe` and `context` functions. Example groups can share + setup and teardown code. +*/ +final public class ExampleGroup: NSObject, Filterable { + weak internal var parent: ExampleGroup? + internal let hooks = ExampleHooks() + + internal var phase: HooksPhase = .nothingExecuted + + private let internalDescription: String + private let flags: FilterFlags + private let isInternalRootExampleGroup: Bool + private var childUnits = [ExampleUnit]() + + internal init(description: String, flags: FilterFlags, isInternalRootExampleGroup: Bool = false) { + self.internalDescription = description + self.flags = flags + self.isInternalRootExampleGroup = isInternalRootExampleGroup + } + + public override var description: String { + return internalDescription + } + + /** + Returns a list of examples that belong to this example group, + or to any of its descendant example groups. + */ + #if canImport(Darwin) + @objc + public var examples: [Example] { + _examples + } + #else + public var examples: [Example] { + _examples + } + #endif + + private var _examples: [Example] { + childUnits.flatMap { unit in + switch unit { + case .example(let example): + return [example] + case .group(let exampleGroup): + return exampleGroup.examples + } + } + } + + internal var name: String? { + guard let parent = parent else { + return isInternalRootExampleGroup ? nil : description + } + + guard let name = parent.name else { return description } + return "\(name), \(description)" + } + + internal var filterFlags: FilterFlags { + var aggregateFlags = flags + walkUp { group in + for (key, value) in group.flags { + aggregateFlags[key] = value + } + } + return aggregateFlags + } + + internal var justBeforeEachStatements: [AroundExampleWithMetadataClosure] { + var closures = Array(hooks.justBeforeEachStatements.reversed()) + walkUp { group in + closures.append(contentsOf: group.hooks.justBeforeEachStatements.reversed()) + } + return closures + } + + internal var wrappers: [AroundExampleWithMetadataClosure] { + var closures = Array(hooks.wrappers.reversed()) + walkUp { group in + closures.append(contentsOf: group.hooks.wrappers.reversed()) + } + return closures + } + + internal func walkDownExamples(_ callback: (_ example: Example) -> Void) { + for unit in childUnits { + switch unit { + case .example(let example): + callback(example) + case .group(let exampleGroup): + exampleGroup.walkDownExamples(callback) + } + } + } + + internal func appendExampleGroup(_ group: ExampleGroup) { + group.parent = self + childUnits.append(.group(group)) + } + + internal func appendExample(_ example: Example) { + example.group = self + childUnits.append(.example(example)) + } + + private func walkUp(_ callback: (_ group: ExampleGroup) -> Void) { + var group = self + while let parent = group.parent { + callback(parent) + group = parent + } + } +} diff --git a/Pods/Quick/Sources/Quick/Examples/AsyncExample.swift b/Pods/Quick/Sources/Quick/Examples/AsyncExample.swift new file mode 100644 index 0000000..5da96ac --- /dev/null +++ b/Pods/Quick/Sources/Quick/Examples/AsyncExample.swift @@ -0,0 +1,279 @@ +import Foundation +import XCTest + +public class AsyncExample: ExampleBase { + weak internal var group: AsyncExampleGroup? + + private let internalDescription: String + private let closure: () async throws -> Void + + internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () async throws -> Void) { + self.internalDescription = description + self.closure = closure + super.init(callsite: callsite, flags: flags) + } + + public override var description: String { + return internalDescription + } + + /** + The example name. A name is a concatenation of the name of + the example group the example belongs to, followed by the + description of the example itself. + + The example name is used to generate a test method selector + to be displayed in Xcode's test navigator. + */ + public override var name: String { + guard let groupName = group?.name else { return description } + return "\(groupName), \(description)" + } + + public func run() async { + let asyncWorld = AsyncWorld.sharedWorld + let world = World.sharedWorld + + if world.numberOfExamplesRun == 0 { + await MainActor.run { + world.suiteHooks.executeBefores() + } + } + + let exampleMetadata = AsyncExampleMetadata(group: group!, example: self, exampleIndex: asyncWorld.numberOfAsyncExamplesRun) + asyncWorld.currentExampleMetadata = exampleMetadata + defer { + asyncWorld.currentExampleMetadata = nil + } + + group!.phase = .beforesExecuting + + let runExample: () async -> Void = { [closure, name, callsite] in + self.group!.phase = .beforesFinished + + do { + try await closure() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + } + + self.group!.phase = .aftersExecuting + } + + var cancelTests = false + + let handleThrowingClosure: (@escaping () async throws -> Void) -> () async -> Void = { [name, callsite] (closure: @escaping () async throws -> Void) in + { + if cancelTests { return } + do { + try await closure() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + cancelTests = true + } + } + } + + let allJustBeforeEachStatements = group!.justBeforeEachStatements + asyncWorld.exampleHooks.justBeforeEachStatements + let justBeforeEachExample = allJustBeforeEachStatements.reduce(runExample as () async throws -> Void) { closure, wrapper in + return { try await wrapper(exampleMetadata, handleThrowingClosure(closure)) } + } + + let allWrappers = group!.wrappers + asyncWorld.exampleHooks.wrappers + let wrappedExample = allWrappers.reduce(justBeforeEachExample) { closure, wrapper in + return { try await wrapper(exampleMetadata, handleThrowingClosure(closure)) } + } + do { + try await wrappedExample() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + } + + + group!.phase = .aftersFinished + + asyncWorld.numberOfAsyncExamplesRun += 1 + + if !asyncWorld.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { + await MainActor.run { + world.suiteHooks.executeAfters() + } + } + } + + public func runSkippedTest() async { + let asyncWorld = AsyncWorld.sharedWorld + let world = World.sharedWorld + + if world.numberOfExamplesRun == 0 { + await MainActor.run { + world.suiteHooks.executeBefores() + } + } + + reportSkippedTest(XCTSkip("Test was filtered out."), name: name, callsite: callsite) + + asyncWorld.numberOfAsyncExamplesRun += 1 + + if !asyncWorld.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { + await MainActor.run { + world.suiteHooks.executeAfters() + } + } + } + + /** + Evaluates the filter flags set on this example and on the example groups + this example belongs to. Flags set on the example are trumped by flags on + the example group it belongs to. Flags on inner example groups are trumped + by flags on outer example groups. + */ + internal override var filterFlags: FilterFlags { + var aggregateFlags = flags + for (key, value) in group!.filterFlags { + aggregateFlags[key] = value + } + return aggregateFlags + } + + #if canImport(Darwin) + static internal let recordSkipSelector = NSSelectorFromString("recordSkipWithDescription:sourceCodeContext:") + #endif + + internal func handleErrorInTest(_ error: Error, name: String, callsite: Callsite) { + if let stopTestError = error as? StopTest { + self.reportStoppedTest(stopTestError) + } else if let testSkippedError = error as? XCTSkip { + self.reportSkippedTest(testSkippedError, name: name, callsite: callsite) + } else { + self.reportFailedTest(error, name: name, callsite: callsite) + } + } + + internal func reportSkippedTest(_ testSkippedError: XCTSkip, name: String, callsite: Callsite) { + #if !canImport(Darwin) + return // This functionality is only supported by Apple's proprietary XCTest, not by swift-corelibs-xctest + #else // `NSSelectorFromString` requires the Objective-C runtime, which is not available on Linux. + + let messageSuffix = """ + \n + If nobody else has done so yet, please submit an issue to https://github.com/Quick/Quick/issues + + For now, we'll just benignly ignore skipped tests. + """ + + guard let testRun = AsyncSpec.current?.testRun else { + print(""" + [Quick Warning]: `AsyncSpec.current?.testRun` was unexpectededly `nil`. + """ + messageSuffix) + return + } + + guard let skippedTestContextAny = testSkippedError.errorUserInfo["XCTestErrorUserInfoKeySkippedTestContext"] else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected the `errorUserInfo` dictionary of the XCTSKip error to contain a value for the key + "XCTestErrorUserInfoKeySkippedTestContext", but it didn't. + """ + messageSuffix) + return + } + + // Uses an internal type "XCTSkippedTestContext", but "NSObject" will be sufficient for `perform(_:with:_with:)`. + guard let skippedTestContext = skippedTestContextAny as? NSObject else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `skippedTestContextAny` to have type `NSObject`, + but we got an object of type \(type(of: skippedTestContextAny)) + """ + messageSuffix) + return + } + + guard let sourceCodeContextAny = skippedTestContext.value(forKey: "sourceCodeContext") else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `XCTSkippedTestContext` to have a `sourceCodeContext` property, but it did not. + """ + messageSuffix) + return + } + + guard let sourceCodeContext = sourceCodeContextAny as? XCTSourceCodeContext else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `XCTSkippedTestContext.sourceCodeContext` to have type `XCTSourceCodeContext`, + but we got an object of type \(type(of: sourceCodeContextAny)). + """ + messageSuffix) + return + } + + guard testRun.responds(to: Self.recordSkipSelector) else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed, as it no longer responds to + the -[XCTSkip \(NSStringFromSelector(Self.recordSkipSelector))] message necessary to report skipped tests to Xcode. + """ + messageSuffix) + return + } + + testRun.perform(Self.recordSkipSelector, with: testSkippedError.message, with: sourceCodeContext) + #endif + } + + internal func reportFailedTest(_ error: Error, name: String, callsite: Callsite) { + let description = "Test \(name) threw unexpected error: \(error.localizedDescription)" + + #if canImport(Darwin) + let file = callsite.file + let location = XCTSourceCodeLocation(filePath: file, lineNumber: Int(callsite.line)) + let sourceCodeContext = XCTSourceCodeContext(location: location) + let issue = XCTIssue( + type: .thrownError, + compactDescription: description, + sourceCodeContext: sourceCodeContext + ) + AsyncSpec.current?.record(issue) + #else + let file = callsite.file.description + AsyncSpec.current?.recordFailure( + withDescription: description, + inFile: file, + atLine: Int(callsite.line), + expected: false + ) + #endif + } + + internal func reportStoppedTest(_ stopTestError: StopTest) { + guard stopTestError.reportError else { return } + + let callsite = stopTestError.callsite + + #if canImport(Darwin) + let file = callsite.file + let location = XCTSourceCodeLocation(filePath: file, lineNumber: Int(callsite.line)) + let sourceCodeContext = XCTSourceCodeContext(location: location) + let issue = XCTIssue( + type: .assertionFailure, + compactDescription: stopTestError.failureDescription, + sourceCodeContext: sourceCodeContext + ) + AsyncSpec.current?.record(issue) + #else + let file = callsite.file.description + AsyncSpec.current?.recordFailure( + withDescription: stopTestError.failureDescription, + inFile: file, + atLine: Int(callsite.line), + expected: true + ) + #endif + } +} + +extension AsyncExample { + /** + Returns a boolean indicating whether two Example objects are equal. + If two examples are defined at the exact same callsite, they must be equal. + */ + @nonobjc public static func == (lhs: AsyncExample, rhs: AsyncExample) -> Bool { + return lhs.callsite == rhs.callsite + } +} diff --git a/Pods/Quick/Sources/Quick/Examples/Example.swift b/Pods/Quick/Sources/Quick/Examples/Example.swift new file mode 100644 index 0000000..e89fef4 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Examples/Example.swift @@ -0,0 +1,324 @@ +import Foundation +import XCTest + +#if canImport(Darwin) +// swiftlint:disable type_name +@objcMembers +public class _ExampleBase: NSObject {} +#else +public class _ExampleBase: NSObject {} +// swiftlint:enable type_name +#endif + +/** + The common superclass of both Example and AsyncExample. This is mostly used for + determining filtering (focusing or pending) and other cases where we want to apply + something to any kind of example. + */ +public class ExampleBase: _ExampleBase { + /** + A boolean indicating whether the example is a shared example; + i.e.: whether it is an example defined with `itBehavesLike`. + */ + public var isSharedExample = false + + /** + The site at which the example is defined. + This must be set correctly in order for Xcode to highlight + the correct line in red when reporting a failure. + */ + public var callsite: Callsite + + internal let flags: FilterFlags + + init(callsite: Callsite, flags: FilterFlags) { + self.callsite = callsite + self.flags = flags + } + + /** + Evaluates the filter flags set on this example and on the example groups + this example belongs to. Flags set on the example are trumped by flags on + the example group it belongs to. Flags on inner example groups are trumped + by flags on outer example groups. + */ + internal var filterFlags: FilterFlags { + [:] + } + + /** + The example name. A name is a concatenation of the name of + the example group the example belongs to, followed by the + description of the example itself. + + The example name is used to generate a test method selector + to be displayed in Xcode's test navigator. + */ + public var name: String { "" } +} + +public class Example: ExampleBase { + weak internal var group: ExampleGroup? + + private let internalDescription: String + private let closure: () throws -> Void + + internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () throws -> Void) { + self.internalDescription = description + self.closure = closure + super.init(callsite: callsite, flags: flags) + } + + public override var description: String { + return internalDescription + } + + /** + The example name. A name is a concatenation of the name of + the example group the example belongs to, followed by the + description of the example itself. + + The example name is used to generate a test method selector + to be displayed in Xcode's test navigator. + */ + public override var name: String { + guard let groupName = group?.name else { return description } + return "\(groupName), \(description)" + } + + public func run() { + let world = World.sharedWorld + + if world.numberOfExamplesRun == 0 { + world.suiteHooks.executeBefores() + } + + let exampleMetadata = SyncExampleMetadata(group: group!, example: self, exampleIndex: world.numberOfExamplesRun) + world.currentExampleMetadata = exampleMetadata + defer { + world.currentExampleMetadata = nil + } + + group!.phase = .beforesExecuting + + let runExample: () -> Void = { [closure, name, callsite] in + self.group!.phase = .beforesFinished + + do { + try closure() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + } + + self.group!.phase = .aftersExecuting + } + + var cancelTests = false + + let handleThrowingClosure: (@escaping () throws -> Void) -> () -> Void = { [name, callsite] (closure: @escaping () throws -> Void) in + { + if cancelTests { return } + do { + try closure() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + cancelTests = true + } + } + } + + let allJustBeforeEachStatements = group!.justBeforeEachStatements + world.exampleHooks.justBeforeEachStatements + let justBeforeEachExample = allJustBeforeEachStatements.reduce(runExample as () throws -> Void) { closure, wrapper in + return { try wrapper(exampleMetadata, handleThrowingClosure(closure)) } + } + + let allWrappers = group!.wrappers + world.exampleHooks.wrappers + let wrappedExample = allWrappers.reduce(justBeforeEachExample) { closure, wrapper in + return { try wrapper(exampleMetadata, handleThrowingClosure(closure)) } + } + do { + try wrappedExample() + } catch { + self.handleErrorInTest(error, name: name, callsite: callsite) + } + + group!.phase = .aftersFinished + + world.numberOfSyncExamplesRun += 1 + + if !world.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { + world.suiteHooks.executeAfters() + } + } + + public func runSkippedTest() { + let world = World.sharedWorld + + if world.numberOfExamplesRun == 0 { + world.suiteHooks.executeBefores() + } + + reportSkippedTest(XCTSkip("Test was filtered out."), name: name, callsite: callsite) + + world.numberOfSyncExamplesRun += 1 + + if !world.isRunningAdditionalSuites && world.numberOfExamplesRun >= world.cachedIncludedExampleCount { + world.suiteHooks.executeAfters() + } + } + + /** + Evaluates the filter flags set on this example and on the example groups + this example belongs to. Flags set on the example are trumped by flags on + the example group it belongs to. Flags on inner example groups are trumped + by flags on outer example groups. + */ + internal override var filterFlags: FilterFlags { + var aggregateFlags = flags + for (key, value) in group!.filterFlags { + aggregateFlags[key] = value + } + return aggregateFlags + } + + #if canImport(Darwin) + static internal let recordSkipSelector = NSSelectorFromString("recordSkipWithDescription:sourceCodeContext:") + #endif + + internal func handleErrorInTest(_ error: Error, name: String, callsite: Callsite) { + if let stopTestError = error as? StopTest { + self.reportStoppedTest(stopTestError) + } else if let testSkippedError = error as? XCTSkip { + self.reportSkippedTest(testSkippedError, name: name, callsite: callsite) + } else { + self.reportFailedTest(error, name: name, callsite: callsite) + } + } + + internal func reportSkippedTest(_ testSkippedError: XCTSkip, name: String, callsite: Callsite) { + #if !canImport(Darwin) + return // This functionality is only supported by Apple's proprietary XCTest, not by swift-corelibs-xctest + #else // `NSSelectorFromString` requires the Objective-C runtime, which is not available on Linux. + + let messageSuffix = """ + \n + If nobody else has done so yet, please submit an issue to https://github.com/Quick/Quick/issues + + For now, we'll just benignly ignore skipped tests. + """ + + guard let testRun = QuickSpec.current.testRun else { + print(""" + [Quick Warning]: `QuickSpec.current.testRun` was unexpectededly `nil`. + """ + messageSuffix) + return + } + + guard let skippedTestContextAny = testSkippedError.errorUserInfo["XCTestErrorUserInfoKeySkippedTestContext"] else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected the `errorUserInfo` dictionary of the XCTSKip error to contain a value for the key + "XCTestErrorUserInfoKeySkippedTestContext", but it didn't. + """ + messageSuffix) + return + } + + // Uses an internal type "XCTSkippedTestContext", but "NSObject" will be sufficient for `perform(_:with:_with:)`. + guard let skippedTestContext = skippedTestContextAny as? NSObject else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `skippedTestContextAny` to have type `NSObject`, + but we got an object of type \(type(of: skippedTestContextAny)) + """ + messageSuffix) + return + } + + guard let sourceCodeContextAny = skippedTestContext.value(forKey: "sourceCodeContext") else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `XCTSkippedTestContext` to have a `sourceCodeContext` property, but it did not. + """ + messageSuffix) + return + } + + guard let sourceCodeContext = sourceCodeContextAny as? XCTSourceCodeContext else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed. + We expected `XCTSkippedTestContext.sourceCodeContext` to have type `XCTSourceCodeContext`, + but we got an object of type \(type(of: sourceCodeContextAny)). + """ + messageSuffix) + return + } + + guard testRun.responds(to: Self.recordSkipSelector) else { + print(""" + [Quick Warning]: The internals of Apple's XCTestCaseRun have changed, as it no longer responds to + the -[XCTSkip \(NSStringFromSelector(Self.recordSkipSelector))] message necessary to report skipped tests to Xcode. + """ + messageSuffix) + return + } + + testRun.perform(Self.recordSkipSelector, with: testSkippedError.message, with: sourceCodeContext) + #endif + } + + internal func reportFailedTest(_ error: Error, name: String, callsite: Callsite) { + let description = "Test \(name) threw unexpected error: \(error.localizedDescription)" + + #if canImport(Darwin) + let file = callsite.file + let location = XCTSourceCodeLocation(filePath: file, lineNumber: Int(callsite.line)) + let sourceCodeContext = XCTSourceCodeContext(location: location) + let issue = XCTIssue( + type: .thrownError, + compactDescription: description, + sourceCodeContext: sourceCodeContext + ) + QuickSpec.current.record(issue) + #else + let file = callsite.file.description + QuickSpec.current.recordFailure( + withDescription: description, + inFile: file, + atLine: Int(callsite.line), + expected: false + ) + #endif + } + + internal func reportStoppedTest(_ stopTestError: StopTest) { + guard stopTestError.reportError else { return } + + let callsite = stopTestError.callsite + + #if canImport(Darwin) + let file = callsite.file + let location = XCTSourceCodeLocation(filePath: file, lineNumber: Int(callsite.line)) + let sourceCodeContext = XCTSourceCodeContext(location: location) + let issue = XCTIssue( + type: .assertionFailure, + compactDescription: stopTestError.failureDescription, + sourceCodeContext: sourceCodeContext + ) + QuickSpec.current.record(issue) + #else + let file = callsite.file.description + QuickSpec.current.recordFailure( + withDescription: stopTestError.failureDescription, + inFile: file, + atLine: Int(callsite.line), + expected: true + ) + #endif + } +} + +extension Example { + /** + Returns a boolean indicating whether two Example objects are equal. + If two examples are defined at the exact same callsite, they must be equal. + */ + @nonobjc public static func == (lhs: Example, rhs: Example) -> Bool { + return lhs.callsite == rhs.callsite + } +} diff --git a/Pods/Quick/Sources/Quick/Examples/ExampleMetadata.swift b/Pods/Quick/Sources/Quick/Examples/ExampleMetadata.swift new file mode 100644 index 0000000..484ccf1 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Examples/ExampleMetadata.swift @@ -0,0 +1,51 @@ +import Foundation + +#if canImport(Darwin) +// swiftlint:disable type_name +@objcMembers +public class _ExampleMetadataBase: NSObject {} +#else +public class _ExampleMetadataBase: NSObject {} +// swiftlint:enable type_name +#endif + +/** + A class that encapsulates information about an example, + including the index at which the example was executed, as + well as the example itself. +*/ +public class ExampleMetadata: _ExampleMetadataBase { + /** + The example for which this metadata was collected. + */ + public let example: ExampleBase + + /** + The index at which this example was executed in the + test suite. + */ + public let exampleIndex: Int + + fileprivate init(example: ExampleBase, exampleIndex: Int) { + self.example = example + self.exampleIndex = exampleIndex + } +} + +final class SyncExampleMetadata: ExampleMetadata { + let group: ExampleGroup + + init(group: ExampleGroup, example: ExampleBase, exampleIndex: Int) { + self.group = group + super.init(example: example, exampleIndex: exampleIndex) + } +} + +final class AsyncExampleMetadata: ExampleMetadata { + let group: AsyncExampleGroup + + init(group: AsyncExampleGroup, example: ExampleBase, exampleIndex: Int) { + self.group = group + super.init(example: example, exampleIndex: exampleIndex) + } +} diff --git a/Pods/Quick/Sources/Quick/Filter.swift b/Pods/Quick/Sources/Quick/Filter.swift new file mode 100644 index 0000000..1a14f74 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Filter.swift @@ -0,0 +1,33 @@ +import Foundation + +/** + A mapping of string keys to booleans that can be used to + filter examples or example groups. For example, a "focused" + example would have the flags [Focused: true]. +*/ +internal typealias FilterFlags = [String: Bool] + +/** + A namespace for filter flag keys, defined primarily to make the + keys available in Objective-C. +*/ +final internal class Filter: NSObject { + /** + Example and example groups with [Focused: true] are included in test runs, + excluding all other examples without this flag. Use this to only run one or + two tests that you're currently focusing on. + */ + @nonobjc + internal class var focused: String { + return "focused" + } + + /** + Example and example groups with [Pending: true] are excluded from test runs. + Use this to temporarily suspend examples that you know do not pass yet. + */ + @nonobjc + internal class var pending: String { + return "pending" + } +} diff --git a/Pods/Quick/Sources/Quick/Hooks/AsyncExampleHooks.swift b/Pods/Quick/Sources/Quick/Hooks/AsyncExampleHooks.swift new file mode 100644 index 0000000..055d270 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/AsyncExampleHooks.swift @@ -0,0 +1,53 @@ +import Foundation + +/** + A container for closures to be executed before and after each example. +*/ +final internal class AsyncExampleHooks { + internal var justBeforeEachStatements: [AroundExampleWithMetadataAsyncClosure] = [] + internal var wrappers: [AroundExampleWithMetadataAsyncClosure] = [] + internal var phase: HooksPhase = .nothingExecuted + + internal func appendJustBeforeEach(_ closure: @escaping BeforeExampleAsyncClosure) { + justBeforeEachStatements.append { _, runExample in + try await closure() + await runExample() + } + } + + internal func appendBefore(_ closure: @escaping BeforeExampleWithMetadataAsyncClosure) { + wrappers.append { exampleMetadata, runExample in + try await closure(exampleMetadata) + await runExample() + } + } + + internal func appendBefore(_ closure: @escaping BeforeExampleAsyncClosure) { + wrappers.append { _, runExample in + try await closure() + await runExample() + } + } + + internal func appendAfter(_ closure: @escaping AfterExampleWithMetadataAsyncClosure) { + wrappers.prepend { exampleMetadata, runExample in + await runExample() + try await closure(exampleMetadata) + } + } + + internal func appendAfter(_ closure: @escaping AfterExampleAsyncClosure) { + wrappers.prepend { _, runExample in + await runExample() + try await closure() + } + } + + internal func appendAround(_ closure: @escaping AroundExampleWithMetadataAsyncClosure) { + wrappers.append(closure) + } + + internal func appendAround(_ closure: @escaping AroundExampleAsyncClosure) { + wrappers.append { _, runExample in try await closure(runExample) } + } +} diff --git a/Pods/Quick/Sources/Quick/Hooks/Closures.swift b/Pods/Quick/Sources/Quick/Hooks/Closures.swift new file mode 100644 index 0000000..3f79a35 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/Closures.swift @@ -0,0 +1,141 @@ +// MARK: Example Hooks + +/** + An async throwing closure executed before an example is run. +*/ +public typealias BeforeExampleAsyncClosure = () async throws -> Void + +/** + A throwing closure executed before an example is run. + */ +public typealias BeforeExampleClosure = () throws -> Void + +/** + A closure executed before an example is run. + This is only used by ObjC. + */ +public typealias BeforeExampleNonThrowingClosure = () -> Void + +/** + An async throwing closure executed before an example is run. The closure is given example metadata, + which contains information about the example that is about to be run. +*/ +public typealias BeforeExampleWithMetadataAsyncClosure = (_ exampleMetadata: ExampleMetadata) async throws -> Void + +/** + A throwing closure executed before an example is run. The closure is given example metadata, + which contains information about the example that is about to be run. + */ +public typealias BeforeExampleWithMetadataClosure = (_ exampleMetadata: ExampleMetadata) throws -> Void + +/** + A closure executed before an example is run. The closure is given example metadata, + which contains information about the example that is about to be run. + This is only used by ObjC + */ +public typealias BeforeExampleWithMetadataNonThrowingClosure = (_ exampleMetadata: ExampleMetadata) -> Void + +/** + An async throwing closure executed after an example is run. +*/ +public typealias AfterExampleAsyncClosure = BeforeExampleAsyncClosure + +/** + A throwing closure executed after an example is run. +*/ +public typealias AfterExampleClosure = BeforeExampleClosure + +/** + A closure executed after an example is run. + This is only used by ObjC +*/ +public typealias AfterExampleNonThrowingClosure = BeforeExampleNonThrowingClosure + +/** + An async throwing closure executed after an example is run. The closure is given example metadata, + which contains information about the example that has just finished running. +*/ +public typealias AfterExampleWithMetadataAsyncClosure = BeforeExampleWithMetadataAsyncClosure + +/** + A throwing closure executed after an example is run. The closure is given example metadata, + which contains information about the example that has just finished running. +*/ +public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure + +/** + A closure executed after an example is run. The closure is given example metadata, + which contains information about the example that has just finished running. +*/ +public typealias AfterExampleWithMetadataNonThrowingClosure = BeforeExampleWithMetadataNonThrowingClosure + +/** + A throwing closure which wraps an example. The closure must call runExample() exactly once. +*/ +public typealias AroundExampleClosure = (_ runExample: @escaping () -> Void) throws -> Void + +/** + A closure which wraps an example. The closure must call runExample() exactly once. +*/ +public typealias AroundExampleNonThrowingClosure = (_ runExample: @escaping () -> Void) -> Void + +/** + A throwing closure which wraps an example. The closure is given example metadata, + which contains information about the example that the wrapper will run. + The closure must call runExample() exactly once. +*/ +public typealias AroundExampleWithMetadataClosure = + (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () -> Void) throws -> Void + +/** + A throwing closure which wraps an example. The closure is given example metadata, + which contains information about the example that the wrapper will run. + The closure must call runExample() exactly once. +*/ +public typealias AroundExampleWithMetadataNonThrowingClosure = + (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () -> Void) -> Void + +/** + An async throwing closure which wraps an example. The closure must call runExample() exactly once. +*/ +public typealias AroundExampleAsyncClosure = (_ runExample: @escaping () async -> Void) async throws -> Void + +/** + An async throwing closure which wraps an example. The closure is given example metadata, + which contains information about the example that the wrapper will run. + The closure must call runExample() exactly once. +*/ +public typealias AroundExampleWithMetadataAsyncClosure = + (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () async -> Void) async throws -> Void + +// MARK: Suite Hooks + +/** + An async throwing closure executed before any examples are run. +*/ +public typealias BeforeSuiteAsyncClosure = () async throws -> Void + +/** + A throwing closure executed before any examples are run. +*/ +public typealias BeforeSuiteClosure = () throws -> Void + +/** + A closure executed before any examples are run. +*/ +public typealias BeforeSuiteNonThrowingClosure = () -> Void + +/** + An async throwing closure executed after all examples have finished running. +*/ +public typealias AfterSuiteAsyncClosure = BeforeSuiteAsyncClosure + +/** + A throwing closure executed after all examples have finished running. +*/ +public typealias AfterSuiteClosure = BeforeSuiteClosure + +/** + A closure executed after all examples have finished running. +*/ +public typealias AfterSuiteNonThrowingClosure = BeforeSuiteNonThrowingClosure diff --git a/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift b/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift new file mode 100644 index 0000000..0fc0384 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift @@ -0,0 +1,59 @@ +import Foundation + +/** + A container for closures to be executed before and after each example. +*/ +final internal class ExampleHooks { + internal var justBeforeEachStatements: [AroundExampleWithMetadataClosure] = [] + internal var wrappers: [AroundExampleWithMetadataClosure] = [] + internal var phase: HooksPhase = .nothingExecuted + + internal func appendJustBeforeEach(_ closure: @escaping BeforeExampleClosure) { + justBeforeEachStatements.append { _, runExample in + try closure() + runExample() + } + } + + internal func appendBefore(_ closure: @escaping BeforeExampleWithMetadataClosure) { + wrappers.append { exampleMetadata, runExample in + try closure(exampleMetadata) + runExample() + } + } + + internal func appendBefore(_ closure: @escaping BeforeExampleClosure) { + wrappers.append { _, runExample in + try closure() + runExample() + } + } + + internal func appendAfter(_ closure: @escaping AfterExampleWithMetadataClosure) { + wrappers.prepend { exampleMetadata, runExample in + runExample() + try closure(exampleMetadata) + } + } + + internal func appendAfter(_ closure: @escaping AfterExampleClosure) { + wrappers.prepend { _, runExample in + runExample() + try closure() + } + } + + internal func appendAround(_ closure: @escaping AroundExampleWithMetadataClosure) { + wrappers.append(closure) + } + + internal func appendAround(_ closure: @escaping AroundExampleClosure) { + wrappers.append { _, runExample in try closure(runExample) } + } +} + +extension Array { + mutating func prepend(_ element: Element) { + insert(element, at: 0) + } +} diff --git a/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift b/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift new file mode 100644 index 0000000..2440158 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift @@ -0,0 +1,11 @@ +/** + A description of the execution cycle of the current example with + respect to the hooks of that example. + */ +internal enum HooksPhase { + case nothingExecuted + case beforesExecuting + case beforesFinished + case aftersExecuting + case aftersFinished +} diff --git a/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift b/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift new file mode 100644 index 0000000..337ff1f --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift @@ -0,0 +1,40 @@ +/** + A container for closures to be executed before and after all examples. +*/ +final internal class SuiteHooks { + internal var befores: [BeforeSuiteClosure] = [] + internal var afters: [AfterSuiteClosure] = [] + internal var phase: HooksPhase = .nothingExecuted + + internal func appendBefore(_ closure: @escaping BeforeSuiteClosure) { + befores.append(closure) + } + + internal func appendAfter(_ closure: @escaping AfterSuiteClosure) { + afters.append(closure) + } + + internal func executeBefores() { + phase = .beforesExecuting + for before in befores { + do { + try before() + } catch { + break + } + } + phase = .beforesFinished + } + + internal func executeAfters() { + phase = .aftersExecuting + for after in afters { + do { + try after() + } catch { + break + } + } + phase = .aftersFinished + } +} diff --git a/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift new file mode 100644 index 0000000..f5596cc --- /dev/null +++ b/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift @@ -0,0 +1,25 @@ +#if canImport(Darwin) + +import Foundation + +extension Bundle { + + /** + Locates the first bundle with a '.xctest' file extension. + */ + internal static var currentTestBundle: Bundle? { + return allBundles.first { $0.bundlePath.hasSuffix(".xctest") } + } + + /** + Return the module name of the bundle. + Uses the bundle filename and transform it to match Xcode's transformation. + Module name has to be a valid "C99 extended identifier". + */ + internal var moduleName: String { + let fileName = bundleURL.fileName + return fileName.c99ExtendedIdentifier + } +} + +#endif diff --git a/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift b/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift new file mode 100644 index 0000000..5326d25 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift @@ -0,0 +1,90 @@ +#if canImport(Darwin) +import Foundation + +/** + Responsible for building a "Selected tests" suite. This corresponds to a single + spec, and all its examples. + */ +internal class QuickSelectedTestSuiteBuilder: QuickTestSuiteBuilder { + + /** + The test spec class to run. + */ + let testCaseClass: AnyClass! + + /** + The test name to filter by, if there is one. + */ + let testName: String? + + /** + For Objective-C classes, returns the class name. For Swift classes without, + an explicit Objective-C name, returns a module-namespaced class name + (e.g., "FooTests.FooSpec"). + */ + var testSuiteClassName: String { + return NSStringFromClass(testCaseClass) + } + + /** + Given a test case name: + + FooSpec/testFoo + + Optionally constructs a test suite builder for the named test case class + in the running test bundle. + + If no test bundle can be found, or the test case class can't be found, + initialization fails and returns `nil`. + */ + init?(forTestCaseWithName name: String, testName: String?) { + guard let testCaseClass = testCaseClassForTestCaseWithName(name) else { + self.testCaseClass = nil + return nil + } + + self.testCaseClass = testCaseClass + self.testName = testNameForTestCaseName(name, testName: testName) + } + + /** + Returns a `QuickTestSuite` that runs the associated test case class. + */ + func buildTestSuite() -> QuickTestSuite { + let suite = QuickTestSuite(forTestCaseClass: testCaseClass) + + if let testName = testName { + let filteredSuite = QuickTestSuite(name: suite.name) + // test names are in the format "-[ClassName testName]" + for test in suite.tests.filter({ $0.name == testName }) { + filteredSuite.addTest(test) + } + return filteredSuite + } else { + return suite + } + } +} + +/** + Searches `Bundle.allBundles()` for an xctest bundle, then looks up the named + test case class in that bundle. + + Returns `nil` if a bundle or test case class cannot be found. + */ +private func testCaseClassForTestCaseWithName(_ name: String) -> AnyClass? { + guard let bundle = Bundle.currentTestBundle else { return nil } + + if let testCaseClass = bundle.classNamed(name) { return testCaseClass } + + let moduleName = bundle.moduleName + + return NSClassFromString("\(moduleName).\(name)") +} + +private func testNameForTestCaseName(_ testCaseName: String, testName: String?) -> String? { + guard let testName = testName else { return nil } + return "-[\(testCaseName) \(testName)]" +} + +#endif diff --git a/Pods/Quick/Sources/Quick/QuickTestObservation.swift b/Pods/Quick/Sources/Quick/QuickTestObservation.swift new file mode 100644 index 0000000..1c2c033 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickTestObservation.swift @@ -0,0 +1,38 @@ +#if !SWIFT_PACKAGE + +import Foundation +import XCTest + +/// A dummy protocol for calling the internal `+[QuickSpec buildExamplesIfNeeded]` method +/// which is defined in Objective-C from Swift. +@objc internal protocol _QuickSpecInternal { // swiftlint:disable:this type_name + static func buildExamplesIfNeeded() +} + +@objc internal final class QuickTestObservation: NSObject, XCTestObservation { + @objc(sharedInstance) + static let shared = QuickTestObservation() + + private var didBuildAllExamples = false + + // Quick hooks into this event to compile example groups for each QuickSpec subclasses. + // + // If an exception occurs when compiling examples, report it to the user. Chances are they + // included an expectation outside of a "it", "describe", or "context" block. + func testBundleWillStart(_ testBundle: Bundle) { + buildAllExamplesIfNeeded() + } + + @objc func buildAllExamplesIfNeeded() { + guard !didBuildAllExamples else { return } + didBuildAllExamples = true + + allSubclasses(ofType: QuickSpec.self) + .forEach { (specClass: QuickSpec.Type) in + // This relies on `_QuickSpecInternal`. + (specClass as AnyClass).buildExamplesIfNeeded() + } + } +} + +#endif diff --git a/Pods/Quick/Sources/Quick/QuickTestSuite.swift b/Pods/Quick/Sources/Quick/QuickTestSuite.swift new file mode 100644 index 0000000..87d8989 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickTestSuite.swift @@ -0,0 +1,64 @@ +#if canImport(Darwin) + +import XCTest + +/** + This protocol defines the role of an object that builds test suites. + */ +internal protocol QuickTestSuiteBuilder { + + /** + Construct a `QuickTestSuite` instance with the appropriate test cases added as tests. + + Subsequent calls to this method should return equivalent test suites. + */ + func buildTestSuite() -> QuickTestSuite + +} + +/** + A base class for a class cluster of Quick test suites, that should correctly + build dynamic test suites for XCTest to execute. + */ +public class QuickTestSuite: XCTestSuite { + /** Resets the built test suites + + Exposed for testing reasons only. + */ + @objc + internal static func reset() { + builtTestSuites = [] + } + + private static var builtTestSuites: Set = Set() + + /** + Construct a test suite for a specific, selected subset of tests and test cases (rather + than the default, which as all test cases). + + If this method is called multiple times for the same test case class, e.g.. + + FooSpec, testBar + FooSpec, testBar + + It is expected that the first call should return a valid test suite, and + all subsequent calls should return `nil`. + + - Parameter name: The name of the `XCTastCase`/`QuickSpec` subclass. + - Parameter testName: The name of the individual test to run (if specified). + - Returns: A valid test case (if tests were added to the test suite to run), or nil (if tests were not added to the test suite to run) + */ + @objc + public static func selectedTestSuite(forTestCaseWithName name: String, testName: String?) -> QuickTestSuite? { + guard let builder = QuickSelectedTestSuiteBuilder(forTestCaseWithName: name, testName: testName) else { return nil } + + let (inserted, _) = builtTestSuites.insert(builder.testSuiteClassName) + if inserted { + return builder.buildTestSuite() + } else { + return nil + } + } +} + +#endif diff --git a/Pods/Quick/Sources/Quick/StopTest.swift b/Pods/Quick/Sources/Quick/StopTest.swift new file mode 100644 index 0000000..f740621 --- /dev/null +++ b/Pods/Quick/Sources/Quick/StopTest.swift @@ -0,0 +1,70 @@ +/// Stops execution of test when thrown inside an `it` block, emitting a failure message. +/// +/// Unlike other errors that can be thrown during a test, `StopTest` represents an expected +/// failure, with the failure description tied to the file and line it is thrown on. +/// +/// Tests can also be stopped silently by throwing `StopTest.silently`. +/// +/// The primary use case of `StopTest` as opposed to normal error logging is when a condition +/// is critical for the remainder of the test. It serves as an alternative to force unwrapping +/// or out-of-range subscripts that could be cause the test to crash. +/// +/// For example, +/// +/// ``` +/// guard let value = getValue() else { +/// throw StopTest("Got a null value from `getValue()`) +/// } +/// ``` +/// +/// When used with Nimble, any expectation can stop a test by adding +/// `.onFailure(throw: StopTest.silently)`. +/// +/// For example, +/// +/// ``` +/// try expect(array).toEventually(haveCount(10)).onFailure(throw: StopTest.silently) +/// ``` +public struct StopTest: Error { + public let failureDescription: String + public let reportError: Bool + public let callsite: Callsite + + /// A private initializer to support creating the `silently` singleton. + private init(_ failureDescription: String, reportError: Bool, file: FileString, line: UInt) { + self.failureDescription = failureDescription + self.reportError = reportError + self.callsite = .init(file: file, line: line) + } + + /// Returns a new `StopTest` instance that, when thrown, stops the test and logs an error. + /// + /// - parameter failureDescription: The message to display in the test results. + /// - parameter file: The absolute path to the file containing the error. A sensible default is provided. + /// - parameter line: The line containing the error. A sensible default is provided. + public init(_ failureDescription: String, file: FileString = #file, line: UInt = #line) { + self.init(failureDescription, reportError: true, file: file, line: line) + } + + /// An error that, when thrown, stops the test without logging an error. + /// + /// This is meant to be used alongside methods that have already logged a test failure. + /// + /// For example, + /// + /// ``` + /// func checkProperty() -> Bool { + /// if property.isValid { + /// return true + /// } else { + /// XCTFail("\(property) is not valid") + /// return false + /// } + /// } + /// + /// guard checkProperty() else { + /// throw StopTest.error + /// } + /// ``` + public static let silently: StopTest = .init("", reportError: false, file: #file, line: #line) +} diff --git a/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift b/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift new file mode 100644 index 0000000..db2fc9d --- /dev/null +++ b/Pods/Quick/Sources/Quick/String+C99ExtendedIdentifier.swift @@ -0,0 +1,46 @@ +#if canImport(Darwin) +import Foundation + +extension String { + private static var invalidCharacters: CharacterSet = { + var invalidCharacters = CharacterSet() + + let invalidCharacterSets: [CharacterSet] = [ + .whitespacesAndNewlines, + .illegalCharacters, + .controlCharacters, + .punctuationCharacters, + .nonBaseCharacters, + .symbols, + ] + + for invalidSet in invalidCharacterSets { + invalidCharacters.formUnion(invalidSet) + } + + return invalidCharacters + }() + + internal var c99ExtendedIdentifier: String { + let validComponents = components(separatedBy: String.invalidCharacters) + let result = validComponents.joined(separator: "_") + + return result.isEmpty ? "_" : result + } +} + +/// Extension methods or properties for NSObject subclasses are invisible from +/// the Objective-C runtime on static linking unless the consumers add `-ObjC` +/// linker flag, so let's make a wrapper class to mitigate that situation. +/// +/// See: https://github.com/Quick/Quick/issues/785 and https://github.com/Quick/Quick/pull/803 +@objc +class QCKObjCStringUtils: NSObject { + override private init() {} + + @objc + static func c99ExtendedIdentifier(from string: String) -> String { + return string.c99ExtendedIdentifier + } +} +#endif diff --git a/Pods/Quick/Sources/Quick/SubclassDetection.swift b/Pods/Quick/Sources/Quick/SubclassDetection.swift new file mode 100644 index 0000000..ad93036 --- /dev/null +++ b/Pods/Quick/Sources/Quick/SubclassDetection.swift @@ -0,0 +1,41 @@ +#if canImport(Darwin) + +import Foundation + +/// Determines if a class is a subclass of another by looping over the superclasses of the given class. +/// Apparently, `isSubclass(of:)` uses a different method to check this, which can cause exceptions to +/// be raised under certain circumstances when used in conjuction with `objc_getClassList`. +/// See https://github.com/Quick/Quick/issues/1155, and https://openradar.appspot.com/FB9854851. +func isClass(_ klass: AnyClass, aSubclassOf targetClass: AnyClass) -> Bool { + var superclass: AnyClass? = klass + while superclass != nil { + superclass = class_getSuperclass(superclass) + if superclass == targetClass { return true } + } + return false +} +#endif + +/// Retrieves the current list of all known classes that are a subtype of the desired type. +/// This uses `objc_copyClassList` instead of `objc_getClassList` because the get function +/// is subject to race conditions and buffer overflow issues. The copy function handles all of that for us. +/// Note: On non-Apple platforms, this will return an empty array. +func allSubclasses(ofType targetType: T.Type) -> [T.Type] { + #if canImport(Darwin) + // See https://developer.apple.com/forums/thread/700770. + var classesCount: UInt32 = 0 + guard let classList = objc_copyClassList(&classesCount) else { return [] } + defer { free(UnsafeMutableRawPointer(classList)) } + let classes = UnsafeBufferPointer(start: classList, count: Int(classesCount)) + + guard classesCount > 0 else { + return [] + } + + return classes.filter { isClass($0, aSubclassOf: targetType) } + // swiftlint:disable:next force_cast + .map { $0 as! T.Type } + #else + return [] + #endif +} diff --git a/Pods/Quick/Sources/Quick/TestSelectorNameProvider.swift b/Pods/Quick/Sources/Quick/TestSelectorNameProvider.swift new file mode 100644 index 0000000..4fad845 --- /dev/null +++ b/Pods/Quick/Sources/Quick/TestSelectorNameProvider.swift @@ -0,0 +1,52 @@ +#if canImport(Darwin) +import Foundation + +@objc internal final class TestSelectorNameProvider: NSObject { + @objc static func testSelectorName(for example: Example, classSelectorNames selectorNames: Set) -> String { + if useLegacyStyleTestSelectorNames { + return legacyStyleTestSelectorName(exampleName: example.name, classSelectorNames: selectorNames, isAsync: false) + } else { + return humanReadableTestSelectorName(exampleName: example.name, classSelectorNames: selectorNames) + } + } + + static func testSelectorName(forAsync example: AsyncExample, classSelectorNames selectorNames: Set) -> String { + if useLegacyStyleTestSelectorNames { + return legacyStyleTestSelectorName(exampleName: example.name, classSelectorNames: selectorNames, isAsync: true) + } else { + return humanReadableTestSelectorName(exampleName: example.name, classSelectorNames: selectorNames) + } + } + + internal static var useLegacyStyleTestSelectorNames: Bool = { + ProcessInfo.processInfo.environment["QUICK_USE_ENCODED_TEST_SELECTOR_NAMES"] != nil + }() + + private static func legacyStyleTestSelectorName(exampleName: String, classSelectorNames selectorNames: Set, isAsync: Bool) -> String { + let originalName = exampleName.c99ExtendedIdentifier + var selectorName = originalName + var index: UInt = 2 + + var proposedName = isAsync ? selectorName.appending(":") : selectorName + + while selectorNames.contains(proposedName) { + selectorName = String(format: "%@_%tu", originalName, index) + proposedName = isAsync ? selectorName.appending(":") : selectorName + index += 1 + } + + return proposedName + } + + private static func humanReadableTestSelectorName(exampleName: String, classSelectorNames selectorNames: Set) -> String { + var selectorName = exampleName + var index: UInt = 2 + + while selectorNames.contains(selectorName) { + selectorName = String(format: "%@ (%tu)", exampleName, index) + index += 1 + } + return selectorName + } +} +#endif diff --git a/Pods/Quick/Sources/Quick/TestState.swift b/Pods/Quick/Sources/Quick/TestState.swift new file mode 100644 index 0000000..c66cd38 --- /dev/null +++ b/Pods/Quick/Sources/Quick/TestState.swift @@ -0,0 +1,59 @@ +/// A property wrapper that will automatically reset the contained value after each test. +@propertyWrapper +public struct TestState { + private class Container { + var value: T? + } + + private let container = Container() + + public var wrappedValue: T! { + get { container.value } + set { container.value = newValue } + } + + /// Resets the property to nil after each test. + public init() { + if AsyncWorld.sharedWorld.currentExampleGroup != nil { + AsyncWorld.sharedWorld.beforeEach { [container] in + AsyncSpec.current.addTeardownBlock { + container.value = nil + } + } + } + + if World.sharedWorld.currentExampleGroup != nil { + World.sharedWorld.beforeEach { [container] in + QuickSpec.current.addTeardownBlock { + container.value = nil + } + } + } + } + + public init(wrappedValue: @escaping @autoclosure () -> T?) { + if AsyncWorld.sharedWorld.currentExampleGroup != nil { + AsyncWorld.sharedWorld.beforeEach { [container] in + container.value = wrappedValue() + AsyncSpec.current.addTeardownBlock { + container.value = nil + } + } + } + + if World.sharedWorld.currentExampleGroup != nil { + World.sharedWorld.beforeEach { [container] in + container.value = wrappedValue() + QuickSpec.current.addTeardownBlock { + container.value = nil + } + } + } + } + + /// Sets the property to an initial value before each test and resets it to nil after each test. + /// - Parameter initialValue: An autoclosure to return the initial value to use before the test. + public init(_ initialValue: @escaping @autoclosure () -> T) { + self.init(wrappedValue: initialValue()) + } +} diff --git a/Pods/Quick/Sources/Quick/URL+FileName.swift b/Pods/Quick/Sources/Quick/URL+FileName.swift new file mode 100644 index 0000000..23c4781 --- /dev/null +++ b/Pods/Quick/Sources/Quick/URL+FileName.swift @@ -0,0 +1,12 @@ +import Foundation + +extension URL { + + /** + Returns the path file name without file extension. + */ + var fileName: String { + return self.deletingPathExtension().lastPathComponent + } + +} diff --git a/Pods/Quick/Sources/Quick/World.swift b/Pods/Quick/Sources/Quick/World.swift new file mode 100644 index 0000000..3a51132 --- /dev/null +++ b/Pods/Quick/Sources/Quick/World.swift @@ -0,0 +1,307 @@ +import Foundation + +/** + A closure that, when evaluated, returns a dictionary of key-value + pairs that can be accessed from within a group of shared examples. +*/ +public typealias SharedExampleContext = () -> [String: Any] + +/** + A closure that is used to define a group of shared examples. This + closure may contain any number of example and example groups. +*/ +public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void + +#if canImport(Darwin) +// swiftlint:disable type_name +@objcMembers +internal class _WorldBase: NSObject {} +#else +internal class _WorldBase: NSObject {} +// swiftlint:enable type_name +#endif + +/** + A collection of state Quick builds up in order to work its magic. + World is primarily responsible for maintaining a mapping of QuickSpec + classes to root example groups for those classes. + + It also maintains a mapping of shared example names to shared + example closures. + + You may configure how Quick behaves by calling the -[World configure:] + method from within an overridden +[QuickConfiguration configure:] method. +*/ +final internal class World: _WorldBase { + /** + The example group that is currently being run. + The DSL requires that this group is correctly set in order to build a + correct hierarchy of example groups and their examples. + */ + internal var currentExampleGroup: ExampleGroup! + + /** + The example metadata of the test that is currently being run. + This is useful for using the Quick test metadata (like its name) at + runtime. + */ + internal var currentExampleMetadata: SyncExampleMetadata? + + internal var numberOfSyncExamplesRun = 0 + internal var numberOfExamplesRun: Int { + numberOfSyncExamplesRun + AsyncWorld.sharedWorld.numberOfAsyncExamplesRun + } + + /** + A flag that indicates whether additional test suites are being run + within this test suite. This is only true within the context of Quick + functional tests. + */ +#if canImport(Darwin) + // Convention of generating Objective-C selector has been changed on Swift 3 + @objc(isRunningAdditionalSuites) + internal var isRunningAdditionalSuites = false +#else + internal var isRunningAdditionalSuites = false +#endif + + private var specs: [String: ExampleGroup] = [:] + private var sharedExamples: [String: SharedExampleClosure] = [:] + private let configuration = QCKConfiguration() + + internal private(set) var isConfigurationFinalized = false + + internal var exampleHooks: ExampleHooks { return configuration.exampleHooks } + internal var asyncExampleHooks: AsyncExampleHooks { return configuration.asyncExampleHooks } + internal var suiteHooks: SuiteHooks { return configuration.suiteHooks } + + // MARK: Singleton Constructor + + private override init() {} + + static private(set) var sharedWorld = World() + + static func anotherWorld(block: (World) -> T) -> T { + let previous = sharedWorld + defer { sharedWorld = previous } + + let newWorld = World() + sharedWorld = newWorld + return block(newWorld) + } + + // MARK: Public Interface + + /** + Exposes the World's QCKConfiguration object within the scope of the closure + so that it may be configured. This method must not be called outside of + an overridden +[QuickConfiguration configure:] method. + + - parameter closure: A closure that takes a Configuration object that can + be mutated to change Quick's behavior. + */ + internal func configure(_ closure: QuickConfigurer) { + assert( + !isConfigurationFinalized, + // swiftlint:disable:next line_length + "Quick cannot be configured outside of a +[QuickConfiguration configure:] method. You should not call -[World configure:] directly. Instead, subclass QuickConfiguration and override the +[QuickConfiguration configure:] method." + ) + closure(configuration) + } + + /** + Finalizes the World's configuration. + Any subsequent calls to World.configure() will raise. + */ + internal func finalizeConfiguration() { + isConfigurationFinalized = true + } + + /** + Returns `true` if the root example group for the given spec class has been already initialized. + + - parameter specClass: The QuickSpec class for which is checked for the existing root example group. + - returns: Whether the root example group for the given spec class has been already initialized or not. + */ + internal func isRootExampleGroupInitialized(forSpecClass specClass: QuickSpec.Type) -> Bool { + let name = String(describing: specClass) + return specs.keys.contains(name) + } + + /** + Returns an internally constructed root example group for the given + QuickSpec class. + + A root example group with the description "root example group" is lazily + initialized for each QuickSpec class. This root example group wraps the + top level of a -[QuickSpec spec] method--it's thanks to this group that + users can define beforeEach and it closures at the top level, like so: + + override class func spec() { + // These belong to the root example group + beforeEach {} + it("is at the top level") {} + } + + - parameter specClass: The QuickSpec class for which to retrieve the root example group. + - returns: The root example group for the class. + */ + internal func rootExampleGroup(forSpecClass specClass: QuickSpec.Type) -> ExampleGroup { + let name = String(describing: specClass) + + if let group = specs[name] { + return group + } else { + let group = ExampleGroup( + description: "root example group", + flags: [:], + isInternalRootExampleGroup: true + ) + specs[name] = group + return group + } + } + + /** + Returns all examples that should be run for a given spec class. + There are two filtering passes that occur when determining which examples should be run. + That is, these examples are the ones that are included by inclusion filters, and are + not excluded by exclusion filters. + + - parameter specClass: The QuickSpec subclass for which examples are to be returned. + - returns: A list of examples to be run as test invocations, along with whether to run the full test, or just mark it as skipped. + */ + internal func examples(forSpecClass specClass: QuickSpec.Type) -> [ExampleWrapper] { + // 1. Grab all included examples. + let included = includedExamples() + // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. + let spec = rootExampleGroup(forSpecClass: specClass).examples.map { example in + return ExampleWrapper( + example: example, + runFullTest: included.first(where: { $0.example == example})?.runFullTest ?? false + ) + } + // 3. Remove all excluded examples. + return spec.map { test -> ExampleWrapper in + ExampleWrapper(example: test.example, runFullTest: test.runFullTest && !self.configuration.exclusionFilters.contains { $0(test.example) }) + } + } + + // MARK: Internal + + internal func registerSharedExample(_ name: String, closure: @escaping SharedExampleClosure) { + raiseIfSharedExampleAlreadyRegistered(name) + sharedExamples[name] = closure + } + + internal func sharedExample(_ name: String) -> SharedExampleClosure { + raiseIfSharedExampleNotRegistered(name) + return sharedExamples[name]! + } + + internal var includedExampleCount: Int { + return includedExamples().count + } + + internal lazy var cachedIncludedExampleCount: Int = self.includedExampleCount + + internal var beforesCurrentlyExecuting: Bool { + let suiteBeforesExecuting = suiteHooks.phase == .beforesExecuting + let exampleBeforesExecuting = exampleHooks.phase == .beforesExecuting + var groupBeforesExecuting = false + if let runningExampleGroup = currentExampleMetadata?.group { + groupBeforesExecuting = runningExampleGroup.phase == .beforesExecuting + } + + return suiteBeforesExecuting || exampleBeforesExecuting || groupBeforesExecuting + } + + internal var aftersCurrentlyExecuting: Bool { + let suiteAftersExecuting = suiteHooks.phase == .aftersExecuting + let exampleAftersExecuting = exampleHooks.phase == .aftersExecuting + var groupAftersExecuting = false + if let runningExampleGroup = currentExampleMetadata?.group { + groupAftersExecuting = runningExampleGroup.phase == .aftersExecuting + } + + return suiteAftersExecuting || exampleAftersExecuting || groupAftersExecuting + } + + internal func performWithCurrentExampleGroup(_ group: ExampleGroup, closure: () -> Void) { + let previousExampleGroup = currentExampleGroup + currentExampleGroup = group + + closure() + + currentExampleGroup = previousExampleGroup + } + + private func allExamples() -> [Example] { + var all: [Example] = [] + for (_, group) in specs { + group.walkDownExamples { all.append($0) } + } + return all + } + + internal func hasFocusedExamples() -> Bool { + return allExamples().contains { example in + return self.configuration.inclusionFilters.contains { $0(example) } + } + } + + private func includedExamples() -> [ExampleWrapper] { + let all = allExamples() + let hasFocusedExamples = self.hasFocusedExamples() || AsyncWorld.sharedWorld.hasFocusedExamples() + + if !hasFocusedExamples && configuration.runAllWhenEverythingFiltered { + return all.map { example in + return ExampleWrapper( + example: example, + runFullTest: !self.configuration.exclusionFilters.contains { $0(example) } + ) + } + } else { + return all.map { example in + return ExampleWrapper( + example: example, + runFullTest: self.configuration.inclusionFilters.contains { + $0(example) + } + ) + } + } + } + + private func raiseIfSharedExampleAlreadyRegistered(_ name: String) { + if sharedExamples[name] != nil { + raiseError("A shared example named '\(name)' has already been registered.") + } + } + + private func raiseIfSharedExampleNotRegistered(_ name: String) { + if sharedExamples[name] == nil { + raiseError("No shared example named '\(name)' has been registered. Registered shared examples: '\(Array(sharedExamples.keys))'") + } + } +} + +#if canImport(Darwin) +// swiftlint:disable type_name +@objcMembers +internal class _ExampleWrapperBase: NSObject {} +#else +internal class _ExampleWrapperBase: NSObject {} +// swiftlint:enable type_name +#endif + +final internal class ExampleWrapper: _ExampleWrapperBase { + private(set) var example: Example + private(set) var runFullTest: Bool + + init(example: Example, runFullTest: Bool) { + self.example = example + self.runFullTest = runFullTest + super.init() + } +} diff --git a/Pods/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m b/Pods/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m new file mode 100644 index 0000000..e452e65 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjCRuntime/QuickSpecBase.m @@ -0,0 +1,38 @@ +#import "QuickSpecBase.h" + +#pragma mark - _QuickSpecBase + +@implementation _QuickSpecBase + +- (instancetype)init { + self = [super initWithInvocation: nil]; + return self; +} + +/** + Invocations for each test method in the test case. QuickSpec overrides this method to define a + new method for each example defined in +[QuickSpec spec]. + + @return An array of invocations that execute the newly defined example methods. + */ ++ (NSArray *)testInvocations { + NSArray *selectors = [self _qck_testMethodSelectors]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:selectors.count]; + + for (NSString *selectorString in selectors) { + SEL selector = NSSelectorFromString(selectorString); + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + invocation.selector = selector; + + [invocations addObject:invocation]; + } + + return invocations; +} + ++ (NSArray *)_qck_testMethodSelectors { + return @[]; +} + +@end diff --git a/Pods/Quick/Sources/QuickObjCRuntime/include/QuickObjCRuntime.h b/Pods/Quick/Sources/QuickObjCRuntime/include/QuickObjCRuntime.h new file mode 100644 index 0000000..65d7a31 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjCRuntime/include/QuickObjCRuntime.h @@ -0,0 +1,5 @@ +#if __has_include("QuickSpecBase.h") +#import "QuickSpecBase.h" +#else +#import +#endif diff --git a/Pods/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h b/Pods/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h new file mode 100644 index 0000000..2ee00e7 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjCRuntime/include/QuickSpecBase.h @@ -0,0 +1,7 @@ +#import +#import + +@interface _QuickSpecBase : XCTestCase ++ (NSArray *)_qck_testMethodSelectors; +- (instancetype)init NS_DESIGNATED_INITIALIZER; +@end diff --git a/Pods/Quick/Sources/QuickObjectiveC/AsyncSpec+testMethodSelectors.m b/Pods/Quick/Sources/QuickObjectiveC/AsyncSpec+testMethodSelectors.m new file mode 100644 index 0000000..26ef3b1 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/AsyncSpec+testMethodSelectors.m @@ -0,0 +1,28 @@ +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + +@interface AsyncSpec (testMethodSelectors) +@end + +@implementation AsyncSpec (testMethodSelectors) + ++ (NSArray *)testInvocations { + NSArray *selectors = [self darwinXCTestMethodSelectors]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:selectors.count]; + + for (NSString *selectorString in selectors) { + SEL selector = NSSelectorFromString(selectorString); + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + invocation.selector = selector; + + [invocations addObject:invocation]; + } + + return invocations; +} + +@end diff --git a/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h b/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h new file mode 100644 index 0000000..dbd0d80 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h @@ -0,0 +1,30 @@ +#import + +@class QCKConfiguration; + +/** + Subclass QuickConfiguration and override the +[QuickConfiguration configure:] + method in order to configure how Quick behaves when running specs, or to define + shared examples that are used across spec files. + */ +@interface QuickConfiguration : NSObject + +/** + This method is executed on each subclass of this class before Quick runs + any examples. You may override this method on as many subclasses as you like, but + there is no guarantee as to the order in which these methods are executed. + + You can override this method in order to: + + 1. Configure how Quick behaves, by modifying properties on the Configuration object. + Setting the same properties in several methods has undefined behavior. + + 2. Define shared examples using `sharedExamples`. + + @param configuration A mutable object that is used to configure how Quick behaves on + a framework level. For details on all the options, see the + documentation in QCKConfiguration.swift. + */ ++ (void)configure:(QCKConfiguration *)configuration; + +@end diff --git a/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m b/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m new file mode 100644 index 0000000..b6bd155 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m @@ -0,0 +1,47 @@ +#import "QuickConfiguration.h" +#import + +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + +@implementation QuickConfiguration + +#pragma mark - Object Lifecycle + +/** + QuickConfiguration is not meant to be instantiated; it merely provides a hook + for users to configure how Quick behaves. Raise an exception if an instance of + QuickConfiguration is created. + */ +- (instancetype)init { + NSString *className = NSStringFromClass([self class]); + NSString *selectorName = NSStringFromSelector(@selector(configure:)); + [NSException raise:NSInternalInconsistencyException + format:@"%@ is not meant to be instantiated; " + @"subclass %@ and override %@ to configure Quick.", + className, className, selectorName]; + return nil; +} + +#pragma mark - NSObject Overrides + +/** + Hook into when QuickConfiguration is initialized in the runtime in order to + call +[QuickConfiguration configure:] on each of its subclasses. + */ ++ (void)initialize { + // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. + if ([self class] == [QuickConfiguration class]) { + World *world = [World sharedWorld]; + [self configureSubclassesIfNeededWithWorld:world]; + } +} + +#pragma mark - Public Interface + ++ (void)configure:(QCKConfiguration *)configuration { } + +@end diff --git a/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h b/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h new file mode 100644 index 0000000..f2d52e7 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h @@ -0,0 +1,276 @@ +#import + +@class ExampleMetadata; + +/** + Provides a hook for Quick to be configured before any examples are run. + Within this scope, override the +[QuickConfiguration configure:] method + to set properties on a configuration object to customize Quick behavior. + For details, see the documentation for Configuraiton.swift. + + @param name The name of the configuration class. Like any Objective-C + class name, this must be unique to the current runtime + environment. + */ +#define QuickConfigurationBegin(name) \ + @interface name : QuickConfiguration; @end \ + @implementation name \ + + +/** + Marks the end of a Quick configuration. + Make sure you put this after `QuickConfigurationBegin`. + */ +#define QuickConfigurationEnd \ + @end \ + + +/** + Defines a new QuickSpec. Define examples and example groups within the space + between this and `QuickSpecEnd`. + + @param name The name of the spec class. Like any Objective-C class name, this + must be unique to the current runtime environment. + */ +#define QuickSpecBegin(name) \ + @interface name : QuickSpec; @end \ + @implementation name \ + + (void)spec { \ + + +/** + Marks the end of a QuickSpec. Make sure you put this after `QuickSpecBegin`. + */ +#define QuickSpecEnd \ + } \ + @end \ + +typedef NSDictionary *(^QCKDSLSharedExampleContext)(void); +typedef void (^QCKDSLSharedExampleBlock)(QCKDSLSharedExampleContext); +typedef void (^QCKDSLEmptyBlock)(void); +typedef void (^QCKDSLExampleMetadataBlock)(ExampleMetadata *exampleMetadata); +typedef void (^QCKDSLAroundExampleBlock)(QCKDSLEmptyBlock runExample); +typedef void (^QCKDSLAroundExampleMetadataBlock)(ExampleMetadata *exampleMetadata, QCKDSLEmptyBlock runExample); + +#define QUICK_EXPORT FOUNDATION_EXPORT + +QUICK_EXPORT void qck_beforeSuite(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_afterSuite(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure); +QUICK_EXPORT void qck_describe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_context(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_beforeEach(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure); +QUICK_EXPORT void qck_afterEach(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure); +QUICK_EXPORT void qck_aroundEach(QCKDSLAroundExampleBlock closure); +QUICK_EXPORT void qck_aroundEachWithMetadata(QCKDSLAroundExampleMetadataBlock closure); +QUICK_EXPORT void qck_justBeforeEach(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_pending(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure); + +#ifndef QUICK_DISABLE_SHORT_SYNTAX +/** + Defines a closure to be run prior to any examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before the first example is run, this closure + will not be executed. + + @param closure The closure to be run prior to any examples in the test suite. + */ +static inline void beforeSuite(QCKDSLEmptyBlock closure) { + qck_beforeSuite(closure); +} NS_SWIFT_UNAVAILABLE("") + + +/** + Defines a closure to be run after all of the examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before all examples are run, this closure + will not be executed. + + @param closure The closure to be run after all of the examples in the test suite. + */ +static inline void afterSuite(QCKDSLEmptyBlock closure) { + qck_afterSuite(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines a group of shared examples. These examples can be re-used in several locations + by using the ``itBehavesLike`` function. + + @param name The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + @param closure A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + */ +static inline void sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { + qck_sharedExamples(name, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines an example group. Example groups are logical groupings of examples. + Example groups can share setup and teardown code. + + @param description An arbitrary string describing the example group. + @param closure A closure that can contain other examples. + */ +static inline void describe(NSString *description, QCKDSLEmptyBlock closure) { + qck_describe(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines an example group. Equivalent to ``describe(description, closure)``. + */ +static inline void context(NSString *description, QCKDSLEmptyBlock closure) { + qck_context(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines a closure to be run prior to each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of beforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to be run prior to each example. + */ +static inline void beforeEach(QCKDSLEmptyBlock closure) { + qck_beforeEach(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Identical to ``beforeEach(closure)``, except the closure is provided with + metadata on the example that the closure is being run prior to. + */ +static inline void beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + qck_beforeEachWithMetadata(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines a closure to be run after each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of afterEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to be run after each example. + */ +static inline void afterEach(QCKDSLEmptyBlock closure) { + qck_afterEach(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Identical to ``afterEach(closure)``, except the closure is provided with + metadata on the example that the closure is being run after. + */ +static inline void afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + qck_afterEachWithMetadata(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines a closure to be run around each example in the currente example group. + You must call the passed-in `runClosure` argument at least once in order to + run the example. This closure is not run for pending or otherwise disabled example. + An example group may contain an unlimited number of `aroundEach`. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to run around each example. This closure itself takes + in a closure: the before-mentioned `runClosure` argument. The `runClosure` argument + must be called at once and only once. + */ +static inline void aroundEach(QCKDSLAroundExampleBlock closure) { + qck_aroundEach(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Identical to ``aroundEach(closure)``, except the closure is provided with + metadata on the example that the closure is being run around. + + @param closure The closure to run around each example. This closure itself takes + in an ``ExampleMetadata-swift.class`` object and a closure. + The ``ExampleMetadata-swift.class`` provides information about the example being run around. + The closure is the example to run, and must be called at once and only once. + */ +static inline void aroundEachWithMetadata(QCKDSLAroundExampleMetadataBlock closure) { + qck_aroundEachWithMetadata(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Defines a closure to be run prior to each example but after any beforeEach blocks. + This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of justBeforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to be run prior to each example but before any beforeEach blocks in the test suite. + */ +static inline void justBeforeEach(QCKDSLEmptyBlock closure) { + qck_justBeforeEach(closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Use this to quickly mark a ``describe(description, closure)`` block as pending. + This disables all examples within the block. + */ +static inline void xdescribe(NSString *description, QCKDSLEmptyBlock closure) { + qck_xdescribe(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Use this to quickly mark a ``context(description, closure)`` block as pending. + This disables all examples within the block. + */ +static inline void xcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_xcontext(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Use this to quickly focus a ``describe(description, closure)`` block, focusing the examples in the block. + If any examples in the test suite are focused, only those examples are executed. + This trumps any explicitly focused or unfocused examples within the block--they are all treated as focused. + */ +static inline void fdescribe(NSString *description, QCKDSLEmptyBlock closure) { + qck_fdescribe(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +/** + Use this to quickly focus a ``context(description, closure)`` block. + Equivalent to ``fdescribe(description, closure)``. + */ +static inline void fcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_fcontext(description, closure); +} NS_SWIFT_UNAVAILABLE("") + +#define it qck_it +#define xit qck_xit +#define fit qck_fit +#define itBehavesLike qck_itBehavesLike +#define xitBehavesLike qck_xitBehavesLike +#define fitBehavesLike qck_fitBehavesLike +#define pending qck_pending +#endif + +#define qck_it qck_it_builder(@(__FILE__), __LINE__) +#define qck_xit qck_xit_builder(@(__FILE__), __LINE__) +#define qck_fit qck_fit_builder(@(__FILE__), __LINE__) +#define qck_itBehavesLike qck_itBehavesLike_builder(@(__FILE__), __LINE__) +#define qck_xitBehavesLike qck_xitBehavesLike_builder(@(__FILE__), __LINE__) +#define qck_fitBehavesLike qck_fitBehavesLike_builder(@(__FILE__), __LINE__) +#define qck_pending qck_pending_builder(@(__FILE__), __LINE__) + +typedef void (^QCKItBlock)(NSString *description, QCKDSLEmptyBlock closure); +typedef void (^QCKItBehavesLikeBlock)(NSString *description, QCKDSLSharedExampleContext context); + +QUICK_EXPORT QCKItBlock qck_it_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBlock qck_xit_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBlock qck_fit_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBehavesLikeBlock qck_xitBehavesLike_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBehavesLikeBlock qck_fitBehavesLike_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); +QUICK_EXPORT QCKItBlock qck_pending_builder(NSString *file, NSUInteger line) NS_SWIFT_UNAVAILABLE(""); diff --git a/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m b/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m new file mode 100644 index 0000000..ba30410 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m @@ -0,0 +1,123 @@ +#import "QCKDSL.h" + +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + +void qck_beforeSuite(QCKDSLEmptyBlock closure) { + [[World sharedWorld] beforeSuite:closure]; +} + +void qck_afterSuite(QCKDSLEmptyBlock closure) { + [[World sharedWorld] afterSuite:closure]; +} + +void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { + [[World sharedWorld] sharedExamples:name closure:closure]; +} + +void qck_describe(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] describe:description flags:@{} closure:closure]; +} + +void qck_context(NSString *description, QCKDSLEmptyBlock closure) { + qck_describe(description, closure); +} + +void qck_beforeEach(QCKDSLEmptyBlock closure) { + [[World sharedWorld] beforeEach:closure]; +} + +void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + [[World sharedWorld] beforeEachWithMetadata:closure]; +} + +void qck_afterEach(QCKDSLEmptyBlock closure) { + [[World sharedWorld] afterEach:closure]; +} + +void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + [[World sharedWorld] afterEachWithMetadata:closure]; +} + +void qck_justBeforeEach(QCKDSLEmptyBlock closure) { + [[World sharedWorld] justBeforeEach:closure]; +} + +void qck_aroundEach(QCKDSLAroundExampleBlock closure) { + [[World sharedWorld] aroundEach:closure]; +} + +void qck_aroundEachWithMetadata(QCKDSLAroundExampleMetadataBlock closure) { + [[World sharedWorld] aroundEachWithMetadata:closure]; +} + +QCKItBlock qck_it_builder(NSString *file, NSUInteger line) { + return ^(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] itWithDescription:description + file:file + line:line + closure:closure]; + }; +} + +QCKItBlock qck_xit_builder(NSString *file, NSUInteger line) { + return ^(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] xitWithDescription:description + file:file + line:line + closure:closure]; + }; +} + +QCKItBlock qck_fit_builder(NSString *file, NSUInteger line) { + return ^(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] fitWithDescription:description + file:file + line:line + closure:closure]; + }; +} + +QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSString *file, NSUInteger line) { + return ^(NSString *name, QCKDSLSharedExampleContext context) { + [[World sharedWorld] itBehavesLikeSharedExampleNamed:name + sharedExampleContext:context + file:file + line:line]; + }; +} + +QCKItBehavesLikeBlock qck_xitBehavesLike_builder(NSString *file, NSUInteger line) { + return ^(NSString *name, QCKDSLSharedExampleContext context) { + [[World sharedWorld] xitBehavesLikeSharedExampleNamed:name + sharedExampleContext:context + file:file + line:line]; + }; +} + +QCKItBehavesLikeBlock qck_fitBehavesLike_builder(NSString *file, NSUInteger line) { + return ^(NSString *name, QCKDSLSharedExampleContext context) { + [[World sharedWorld] fitBehavesLikeSharedExampleNamed:name + sharedExampleContext:context + file:file + line:line]; + }; +} + +QCKItBlock qck_pending_builder(NSString *file, NSUInteger line) { + return ^(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] pendingWithDescription:description file:file line:line closure:closure]; + }; +} + +void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] fdescribe:description closure:closure]; +} + +void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_fdescribe(description, closure); +} diff --git a/Pods/Quick/Sources/QuickObjectiveC/Quick.h b/Pods/Quick/Sources/QuickObjectiveC/Quick.h new file mode 100644 index 0000000..f97097b --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/Quick.h @@ -0,0 +1,11 @@ +#import + +//! Project version number for Quick. +FOUNDATION_EXPORT double QuickVersionNumber; + +//! Project version string for Quick. +FOUNDATION_EXPORT const unsigned char QuickVersionString[]; + +#import +#import +#import diff --git a/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h b/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h new file mode 100644 index 0000000..e4d3e5e --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h @@ -0,0 +1,58 @@ +#import + +/** + QuickSpec is a base class all specs written in Quick inherit from. + They need to inherit from QuickSpec, a subclass of XCTestCase, in + order to be discovered by the XCTest framework. + + XCTest automatically compiles a list of XCTestCase subclasses included + in the test target. It iterates over each class in that list, and creates + a new instance of that class for each test method. It then creates an + "invocation" to execute that test method. The invocation is an instance of + NSInvocation, which represents a single message send in Objective-C. + The invocation is set on the XCTestCase instance, and the test is run. + + Most of the code in QuickSpec is dedicated to hooking into XCTest events. + First, when the spec is first loaded and before it is sent any messages, + the +[NSObject initialize] method is called. QuickSpec overrides this method + to call +[QuickSpec spec]. This builds the example group stacks and + registers them with Quick.World, a global register of examples. + + Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest + automatically finds all methods whose selectors begin with the string "test". + However, QuickSpec overrides this default behavior by implementing the + +[XCTestCase testInvocations] method. This method iterates over each example + registered in Quick.World, defines a new method for that example, and + returns an invocation to call that method to XCTest. Those invocations are + the tests that are run by XCTest. Their selector names are displayed in + the Xcode test navigation bar. + */ +@interface QuickSpec : XCTestCase + +/** + Override this method in your spec to define a set of example groups + and examples. + + @code + override class func spec() { + describe("winter") { + it("is coming") { + // ... + } + } + } + @endcode + + See DSL.swift for more information on what syntax is available. + */ ++ (void)spec; + +/** + Returns the currently executing spec. Use in specs that require XCTestCase + methods, e.g. expectationWithDescription. + + If you're using `beforeSuite`/`afterSuite`, you should consider the ``currentSpec()`` helper. +*/ +@property (class, nonatomic, readonly) QuickSpec *current; + +@end diff --git a/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m b/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m new file mode 100644 index 0000000..a7d83a1 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m @@ -0,0 +1,186 @@ +#import "QuickSpec.h" +#import "QuickConfiguration.h" + +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + +static QuickSpec *currentSpec = nil; + +@interface QuickSpec () +@property (nonatomic, strong) Example *example; +@end + +@implementation QuickSpec + +#pragma mark - XCTestCase Overrides + +/** + Invocations for each test method in the test case. QuickSpec overrides this method to define a + new method for each example defined in +[QuickSpec spec]. + + @return An array of invocations that execute the newly defined example methods. + */ ++ (NSArray *)testInvocations { + // Xcode 13.3 hack, see this issue for more info: https://github.com/Quick/Quick/issues/1123 + // In case of fix in later versions next line can be removed + [[QuickTestObservation sharedInstance] buildAllExamplesIfNeeded]; + + NSArray *examples = [[World sharedWorld] examplesForSpecClass:[self class]]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:[examples count]]; + + NSMutableSet *selectorNames = [NSMutableSet set]; + + for (ExampleWrapper *exampleWrapper in examples) { + SEL selector = [self addInstanceMethodForExample:exampleWrapper.example runFullTest:exampleWrapper.runFullTest classSelectorNames:selectorNames]; + + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + invocation.selector = selector; + + [invocations addObject:invocation]; + } + + return invocations; +} + +/** + This method is used as a hook for injecting test methods into the + Objective-C runtime on individual test runs. + + When `xctest` runs a test on a single method, it does not call + `defaultTestSuite` on the test class but rather calls + `instancesRespondToSelector:` to build its own suite. + + In normal conditions, Quick uses the implicit call to `defaultTestSuite` + to both generate examples and inject them as methods by way of + `testInvocations`. Under single test conditions, there's no implicit + call to `defaultTestSuite` so we make it explicitly here. + */ ++ (BOOL)instancesRespondToSelector:(SEL)aSelector { + [self defaultTestSuite]; + return [super instancesRespondToSelector:aSelector]; +} + +#pragma mark - Public Interface + ++ (void)spec { } + ++ (QuickSpec*) current { + return currentSpec; +} + +#pragma mark - Internal Methods + +/** + Runs the `spec` method and builds the examples for this class. + + It's safe to call this method multiple times. If the examples for the class have been built, invocation + of this method has no effect. + */ ++ (void)buildExamplesIfNeeded { + [QuickConfiguration class]; + World *world = [World sharedWorld]; + + if ([world isRootExampleGroupInitializedForSpecClass:[self class]]) { + // The examples for this subclass have been already built. Skipping. + return; + } + + ExampleGroup *rootExampleGroup = [world rootExampleGroupForSpecClass:[self class]]; + [world performWithCurrentExampleGroup:rootExampleGroup closure:^{ + @try { + [self spec]; + } + @catch (NSException *exception) { + [NSException raise:NSInternalInconsistencyException + format:@"An exception occurred when building Quick's example groups.\n" + @"Some possible reasons this might happen include:\n\n" + @"- An 'expect(...).to' expectation was evaluated outside of " + @"an 'it', 'context', or 'describe' block\n" + @"- 'sharedExamples' was called twice with the same name\n" + @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" + @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", + exception.name, exception.reason, exception.userInfo]; + } + }]; +} + +/** + QuickSpec uses this method to dynamically define a new instance method for the + given example. The instance method runs the example, catching any exceptions. + The exceptions are then reported as test failures. + + In order to report the correct file and line number, examples must raise exceptions + containing following keys in their userInfo: + + - "SenTestFilenameKey": A String representing the file name + - "SenTestLineNumberKey": An Int representing the line number + + These keys used to be used by SenTestingKit, and are still used by some testing tools + in the wild. See: https://github.com/Quick/Quick/pull/41 + + @return The selector of the newly defined instance method. + */ ++ (SEL)addInstanceMethodForExample:(Example *)example runFullTest:(BOOL)runFullTest classSelectorNames:(NSMutableSet *)selectorNames { + IMP implementation = imp_implementationWithBlock(^(QuickSpec *self){ + self.example = example; + currentSpec = self; + if (runFullTest) { + [example run]; + } else { + [example runSkippedTest]; + } + currentSpec = nil; + }); + + const char *types = [[NSString stringWithFormat:@"%s%s%s", @encode(void), @encode(id), @encode(SEL)] UTF8String]; + + NSString *selectorName = [TestSelectorNameProvider testSelectorNameFor:example classSelectorNames:selectorNames]; + + [selectorNames addObject:selectorName]; + + SEL selector = NSSelectorFromString(selectorName); + class_addMethod(self, selector, implementation, types); + + return selector; +} + +/** + This method is used to record failures, whether they represent example + expectations that were not met, or exceptions raised during test setup + and teardown. By default, the failure will be reported as an + XCTest failure, and the example will be highlighted in Xcode. + */ +- (void)recordIssue:(XCTIssue *)issue { + if (self != [QuickSpec current]) { + [[QuickSpec current] recordIssue:issue]; + return; + } + + if (self.example.isSharedExample) { + XCTSourceCodeLocation *location = [[XCTSourceCodeLocation alloc] initWithFilePath:self.example.callsite.file + lineNumber:self.example.callsite.line]; + XCTSourceCodeContext *sourceCodeContext = [[XCTSourceCodeContext alloc] initWithLocation:location]; + XCTIssue *newIssue = [[XCTIssue alloc] initWithType:issue.type + compactDescription:issue.compactDescription + detailedDescription:issue.detailedDescription + sourceCodeContext:sourceCodeContext + associatedError:issue.associatedError + attachments:issue.attachments]; + [super recordIssue:newIssue]; + } else { + [super recordIssue:issue]; + } +} + +@end + +#pragma mark - Test Observation + +__attribute__((constructor)) +static void registerQuickTestObservation(void) { + [[XCTestObservationCenter sharedTestObservationCenter] addTestObserver:[QuickTestObservation sharedInstance]]; +} diff --git a/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m b/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m new file mode 100644 index 0000000..021ab75 --- /dev/null +++ b/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m @@ -0,0 +1,46 @@ +#import +#import + +#if __has_include("Quick-Swift.h") +#import "Quick-Swift.h" +#else +#import +#endif + +@interface XCTestSuite (QuickTestSuiteBuilder) +@end + +@implementation XCTestSuite (QuickTestSuiteBuilder) + +/** + In order to ensure we can correctly build dynamic test suites, we need to + replace some of the default test suite constructors. + */ ++ (void)load { + Method testCaseWithName = class_getClassMethod(self, @selector(testSuiteForTestCaseWithName:)); + Method hooked_testCaseWithName = class_getClassMethod(self, @selector(qck_hooked_testSuiteForTestCaseWithName:)); + method_exchangeImplementations(testCaseWithName, hooked_testCaseWithName); +} + +/** + The `+testSuiteForTestCaseWithName:` method is called when a specific test case + class is run from the Xcode test navigator. If the built test suite is `nil`, + Xcode will not run any tests for that test case. + + Given if the following test case class is run from the Xcode test navigator: + + FooSpec + testFoo + testBar + + XCTest will invoke this once per test case, with test case names following this format: + + FooSpec/testFoo + FooSpec/testBar + */ ++ (nullable instancetype)qck_hooked_testSuiteForTestCaseWithName:(nonnull NSString *)name { + NSArray *components = [name componentsSeparatedByString:@"/"]; + return [QuickTestSuite selectedTestSuiteForTestCaseWithName:[components firstObject] testName:[components count] > 1 ? [components lastObject] : nil]; +} + +@end diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException-Info.plist b/Pods/Target Support Files/CwlCatchException/CwlCatchException-Info.plist new file mode 100644 index 0000000..3e91b61 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.2.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException-dummy.m b/Pods/Target Support Files/CwlCatchException/CwlCatchException-dummy.m new file mode 100644 index 0000000..3efcf02 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_CwlCatchException : NSObject +@end +@implementation PodsDummy_CwlCatchException +@end diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException-prefix.pch b/Pods/Target Support Files/CwlCatchException/CwlCatchException-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException-umbrella.h b/Pods/Target Support Files/CwlCatchException/CwlCatchException-umbrella.h new file mode 100644 index 0000000..7acce82 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; +FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; + diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException.debug.xcconfig b/Pods/Target Support Files/CwlCatchException/CwlCatchException.debug.xcconfig new file mode 100644 index 0000000..faee21f --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException.debug.xcconfig @@ -0,0 +1,16 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchExceptionSupport" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlCatchException +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException.modulemap b/Pods/Target Support Files/CwlCatchException/CwlCatchException.modulemap new file mode 100644 index 0000000..6ec3281 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException.modulemap @@ -0,0 +1,6 @@ +framework module CwlCatchException { + umbrella header "CwlCatchException-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException.release.xcconfig b/Pods/Target Support Files/CwlCatchException/CwlCatchException.release.xcconfig new file mode 100644 index 0000000..faee21f --- /dev/null +++ b/Pods/Target Support Files/CwlCatchException/CwlCatchException.release.xcconfig @@ -0,0 +1,16 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchExceptionSupport" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlCatchException +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-Info.plist b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-Info.plist new file mode 100644 index 0000000..3e91b61 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.2.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-dummy.m b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-dummy.m new file mode 100644 index 0000000..c9327de --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_CwlCatchExceptionSupport : NSObject +@end +@implementation PodsDummy_CwlCatchExceptionSupport +@end diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-prefix.pch b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-umbrella.h b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-umbrella.h new file mode 100644 index 0000000..4b76b2b --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport-umbrella.h @@ -0,0 +1,17 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "CwlCatchException.h" + +FOUNDATION_EXPORT double CwlCatchExceptionSupportVersionNumber; +FOUNDATION_EXPORT const unsigned char CwlCatchExceptionSupportVersionString[]; + diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.debug.xcconfig b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.debug.xcconfig new file mode 100644 index 0000000..3f9a387 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.debug.xcconfig @@ -0,0 +1,12 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlCatchExceptionSupport +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.modulemap b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.modulemap new file mode 100644 index 0000000..670403d --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.modulemap @@ -0,0 +1,6 @@ +framework module CwlCatchExceptionSupport { + umbrella header "CwlCatchExceptionSupport-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.release.xcconfig b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.release.xcconfig new file mode 100644 index 0000000..3f9a387 --- /dev/null +++ b/Pods/Target Support Files/CwlCatchExceptionSupport/CwlCatchExceptionSupport.release.xcconfig @@ -0,0 +1,12 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlCatchExceptionSupport +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-Info.plist b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-Info.plist new file mode 100644 index 0000000..3e91b61 --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.2.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-dummy.m b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-dummy.m new file mode 100644 index 0000000..d9fac03 --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_CwlMachBadInstructionHandler : NSObject +@end +@implementation PodsDummy_CwlMachBadInstructionHandler +@end diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-prefix.pch b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-umbrella.h b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-umbrella.h new file mode 100644 index 0000000..8f87427 --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler-umbrella.h @@ -0,0 +1,18 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "CwlMachBadInstructionHandler.h" +#import "mach_excServer.h" + +FOUNDATION_EXPORT double CwlMachBadInstructionHandlerVersionNumber; +FOUNDATION_EXPORT const unsigned char CwlMachBadInstructionHandlerVersionString[]; + diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.debug.xcconfig b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.debug.xcconfig new file mode 100644 index 0000000..8b0579b --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.debug.xcconfig @@ -0,0 +1,12 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlMachBadInstructionHandler +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.modulemap b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.modulemap new file mode 100644 index 0000000..bdb3056 --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.modulemap @@ -0,0 +1,6 @@ +framework module CwlMachBadInstructionHandler { + umbrella header "CwlMachBadInstructionHandler-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.release.xcconfig b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.release.xcconfig new file mode 100644 index 0000000..8b0579b --- /dev/null +++ b/Pods/Target Support Files/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.release.xcconfig @@ -0,0 +1,12 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlMachBadInstructionHandler +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-Info.plist b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-Info.plist new file mode 100644 index 0000000..3e91b61 --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.2.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-dummy.m b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-dummy.m new file mode 100644 index 0000000..9df5b30 --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_CwlPosixPreconditionTesting : NSObject +@end +@implementation PodsDummy_CwlPosixPreconditionTesting +@end diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-prefix.pch b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-umbrella.h b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-umbrella.h new file mode 100644 index 0000000..6d066cd --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double CwlPosixPreconditionTestingVersionNumber; +FOUNDATION_EXPORT const unsigned char CwlPosixPreconditionTestingVersionString[]; + diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.debug.xcconfig b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.debug.xcconfig new file mode 100644 index 0000000..e72066d --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.debug.xcconfig @@ -0,0 +1,14 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlPosixPreconditionTesting +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.modulemap b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.modulemap new file mode 100644 index 0000000..b388a47 --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.modulemap @@ -0,0 +1,6 @@ +framework module CwlPosixPreconditionTesting { + umbrella header "CwlPosixPreconditionTesting-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.release.xcconfig b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.release.xcconfig new file mode 100644 index 0000000..e72066d --- /dev/null +++ b/Pods/Target Support Files/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.release.xcconfig @@ -0,0 +1,14 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlPosixPreconditionTesting +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-Info.plist b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-Info.plist new file mode 100644 index 0000000..38610d2 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.2.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-dummy.m b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-dummy.m new file mode 100644 index 0000000..b33eab5 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_CwlPreconditionTesting : NSObject +@end +@implementation PodsDummy_CwlPreconditionTesting +@end diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-prefix.pch b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-umbrella.h b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-umbrella.h new file mode 100644 index 0000000..e6319a2 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; +FOUNDATION_EXPORT const unsigned char CwlPreconditionTestingVersionString[]; + diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.debug.xcconfig b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.debug.xcconfig new file mode 100644 index 0000000..9294c61 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.debug.xcconfig @@ -0,0 +1,16 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchException" -framework "CwlMachBadInstructionHandler" -framework "CwlPosixPreconditionTesting" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlPreconditionTesting +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.modulemap b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.modulemap new file mode 100644 index 0000000..b0cb51e --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.modulemap @@ -0,0 +1,6 @@ +framework module CwlPreconditionTesting { + umbrella header "CwlPreconditionTesting-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.release.xcconfig b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.release.xcconfig new file mode 100644 index 0000000..9294c61 --- /dev/null +++ b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.release.xcconfig @@ -0,0 +1,16 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchException" -framework "CwlMachBadInstructionHandler" -framework "CwlPosixPreconditionTesting" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlPreconditionTesting +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Nimble/Nimble-Info.plist b/Pods/Target Support Files/Nimble/Nimble-Info.plist new file mode 100644 index 0000000..dced619 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 13.2.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Nimble/Nimble-dummy.m b/Pods/Target Support Files/Nimble/Nimble-dummy.m new file mode 100644 index 0000000..e8177ab --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Nimble : NSObject +@end +@implementation PodsDummy_Nimble +@end diff --git a/Pods/Target Support Files/Nimble/Nimble-prefix.pch b/Pods/Target Support Files/Nimble/Nimble-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/Nimble/Nimble-umbrella.h b/Pods/Target Support Files/Nimble/Nimble-umbrella.h new file mode 100644 index 0000000..35609a7 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-umbrella.h @@ -0,0 +1,20 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "Nimble.h" +#import "DSL.h" +#import "NMBExceptionCapture.h" +#import "NMBStringify.h" + +FOUNDATION_EXPORT double NimbleVersionNumber; +FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; + diff --git a/Pods/Target Support Files/Nimble/Nimble.debug.xcconfig b/Pods/Target Support Files/Nimble/Nimble.debug.xcconfig new file mode 100644 index 0000000..c3b0599 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble.debug.xcconfig @@ -0,0 +1,20 @@ +APPLICATION_EXTENSION_API_ONLY = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Nimble +DEFINES_MODULE = YES +ENABLE_BITCODE = NO +ENABLE_TESTING_SEARCH_PATHS = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension -weak-lXCTestSwiftSupport -framework "CwlPreconditionTesting" -weak_framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS $(inherited) -suppress-warnings +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/Nimble +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Nimble/Nimble.modulemap b/Pods/Target Support Files/Nimble/Nimble.modulemap new file mode 100644 index 0000000..6f77009 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble.modulemap @@ -0,0 +1,6 @@ +framework module Nimble { + umbrella header "Nimble-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Nimble/Nimble.release.xcconfig b/Pods/Target Support Files/Nimble/Nimble.release.xcconfig new file mode 100644 index 0000000..c3b0599 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble.release.xcconfig @@ -0,0 +1,20 @@ +APPLICATION_EXTENSION_API_ONLY = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Nimble +DEFINES_MODULE = YES +ENABLE_BITCODE = NO +ENABLE_TESTING_SEARCH_PATHS = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension -weak-lXCTestSwiftSupport -framework "CwlPreconditionTesting" -weak_framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS $(inherited) -suppress-warnings +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/Nimble +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist new file mode 100644 index 0000000..19cf209 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown new file mode 100644 index 0000000..1a386c1 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.markdown @@ -0,0 +1,508 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## CwlCatchException + +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +## CwlCatchExceptionSupport + +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +## CwlMachBadInstructionHandler + +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +## CwlPosixPreconditionTesting + +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +## CwlPreconditionTesting + +ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +## Nimble + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +## Quick + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist new file mode 100644 index 0000000..1807af9 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-acknowledgements.plist @@ -0,0 +1,576 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + License + ISC + Title + CwlCatchException + Type + PSGroupSpecifier + + + FooterText + ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + License + ISC + Title + CwlCatchExceptionSupport + Type + PSGroupSpecifier + + + FooterText + ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + License + ISC + Title + CwlMachBadInstructionHandler + Type + PSGroupSpecifier + + + FooterText + ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + License + ISC + Title + CwlPosixPreconditionTesting + Type + PSGroupSpecifier + + + FooterText + ISC License + +Copyright © 2017 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + License + ISC + Title + CwlPreconditionTesting + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + License + Apache 2.0 + Title + Nimble + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + License + Apache 2.0 + Title + Quick + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m new file mode 100644 index 0000000..7bf07f1 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_OSPaymentsLib_OSPaymentsLibTests : NSObject +@end +@implementation PodsDummy_Pods_OSPaymentsLib_OSPaymentsLibTests +@end diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-input-files.xcfilelist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-input-files.xcfilelist new file mode 100644 index 0000000..5d60bf6 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-input-files.xcfilelist @@ -0,0 +1,8 @@ +${PODS_ROOT}/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh +${BUILT_PRODUCTS_DIR}/CwlCatchException/CwlCatchException.framework +${BUILT_PRODUCTS_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework +${BUILT_PRODUCTS_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework +${BUILT_PRODUCTS_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework +${BUILT_PRODUCTS_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework +${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework +${BUILT_PRODUCTS_DIR}/Quick/Quick.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-output-files.xcfilelist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-output-files.xcfilelist new file mode 100644 index 0000000..66dffc3 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Debug-output-files.xcfilelist @@ -0,0 +1,7 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlCatchException.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlCatchExceptionSupport.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlMachBadInstructionHandler.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlPosixPreconditionTesting.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlPreconditionTesting.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-input-files.xcfilelist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-input-files.xcfilelist new file mode 100644 index 0000000..5d60bf6 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-input-files.xcfilelist @@ -0,0 +1,8 @@ +${PODS_ROOT}/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh +${BUILT_PRODUCTS_DIR}/CwlCatchException/CwlCatchException.framework +${BUILT_PRODUCTS_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework +${BUILT_PRODUCTS_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework +${BUILT_PRODUCTS_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework +${BUILT_PRODUCTS_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework +${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework +${BUILT_PRODUCTS_DIR}/Quick/Quick.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-output-files.xcfilelist b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-output-files.xcfilelist new file mode 100644 index 0000000..66dffc3 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks-Release-output-files.xcfilelist @@ -0,0 +1,7 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlCatchException.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlCatchExceptionSupport.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlMachBadInstructionHandler.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlPosixPreconditionTesting.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CwlPreconditionTesting.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh new file mode 100755 index 0000000..4233ffc --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-frameworks.sh @@ -0,0 +1,198 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +function on_error { + echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" +} +trap 'on_error $LINENO' ERR + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" +SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" +BCSYMBOLMAP_DIR="BCSymbolMaps" + + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +# Copies and strips a vendored framework +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink -f "${source}")" + fi + + if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then + # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied + find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do + echo "Installing $f" + install_bcsymbolmap "$f" "$destination" + rm "$f" + done + rmdir "${source}/${BCSYMBOLMAP_DIR}" + fi + + # Use filter instead of exclude so missing patterns don't throw errors. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + elif [ -L "${binary}" ]; then + echo "Destination binary is symlinked..." + dirname="$(dirname "${binary}")" + binary="${dirname}/$(readlink "${binary}")" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} +# Copies and strips a vendored dSYM +install_dsym() { + local source="$1" + warn_missing_arch=${2:-true} + if [ -r "$source" ]; then + # Copy the dSYM into the targets temp dir. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" + + local basename + basename="$(basename -s .dSYM "$source")" + binary_name="$(ls "$source/Contents/Resources/DWARF")" + binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" + + # Strip invalid architectures from the dSYM. + if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then + strip_invalid_archs "$binary" "$warn_missing_arch" + fi + if [[ $STRIP_BINARY_RETVAL == 0 ]]; then + # Move the stripped file into its final destination. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" + else + # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. + mkdir -p "${DWARF_DSYM_FOLDER_PATH}" + touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" + fi + fi +} + +# Used as a return value for each invocation of `strip_invalid_archs` function. +STRIP_BINARY_RETVAL=0 + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + warn_missing_arch=${2:-true} + # Get architectures for current target binary + binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" + # Intersect them with the architectures we are building for + intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" + # If there are no archs supported by this binary then warn the user + if [[ -z "$intersected_archs" ]]; then + if [[ "$warn_missing_arch" == "true" ]]; then + echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." + fi + STRIP_BINARY_RETVAL=1 + return + fi + stripped="" + for arch in $binary_archs; do + if ! [[ "${ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi + STRIP_BINARY_RETVAL=0 +} + +# Copies the bcsymbolmap files of a vendored framework +install_bcsymbolmap() { + local bcsymbolmap_path="$1" + local destination="${BUILT_PRODUCTS_DIR}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identity + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" + + if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + code_sign_cmd="$code_sign_cmd &" + fi + echo "$code_sign_cmd" + eval "$code_sign_cmd" + fi +} + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/CwlCatchException/CwlCatchException.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework" + install_framework "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework" + install_framework "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/CwlCatchException/CwlCatchException.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework" + install_framework "${BUILT_PRODUCTS_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework" + install_framework "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework" + install_framework "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework" +fi +if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + wait +fi diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h new file mode 100644 index 0000000..686d203 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_OSPaymentsLib_OSPaymentsLibTestsVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_OSPaymentsLib_OSPaymentsLibTestsVersionString[]; + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig new file mode 100644 index 0000000..972ed33 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.debug.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/Quick" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException/CwlCatchException.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Quick/Quick.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchException" -framework "CwlCatchExceptionSupport" -framework "CwlMachBadInstructionHandler" -framework "CwlPosixPreconditionTesting" -framework "CwlPreconditionTesting" -framework "Nimble" -framework "Quick" -framework "XCTest" -weak_framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap new file mode 100644 index 0000000..197424d --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.modulemap @@ -0,0 +1,6 @@ +framework module Pods_OSPaymentsLib_OSPaymentsLibTests { + umbrella header "Pods-OSPaymentsLib-OSPaymentsLibTests-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig new file mode 100644 index 0000000..972ed33 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib-OSPaymentsLibTests/Pods-OSPaymentsLib-OSPaymentsLibTests.release.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/Quick" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException/CwlCatchException.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchExceptionSupport/CwlCatchExceptionSupport.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPosixPreconditionTesting/CwlPosixPreconditionTesting.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting/CwlPreconditionTesting.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Quick/Quick.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "CwlCatchException" -framework "CwlCatchExceptionSupport" -framework "CwlMachBadInstructionHandler" -framework "CwlPosixPreconditionTesting" -framework "CwlPreconditionTesting" -framework "Nimble" -framework "Quick" -framework "XCTest" -weak_framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-Info.plist b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-Info.plist new file mode 100644 index 0000000..19cf209 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.markdown b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.markdown new file mode 100644 index 0000000..102af75 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.plist b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.plist new file mode 100644 index 0000000..7acbad1 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-dummy.m b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-dummy.m new file mode 100644 index 0000000..bf400d8 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_OSPaymentsLib : NSObject +@end +@implementation PodsDummy_Pods_OSPaymentsLib +@end diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-umbrella.h b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-umbrella.h new file mode 100644 index 0000000..04094e4 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_OSPaymentsLibVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_OSPaymentsLibVersionString[]; + diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.debug.xcconfig b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.debug.xcconfig new file mode 100644 index 0000000..26f2c77 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.debug.xcconfig @@ -0,0 +1,8 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.modulemap b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.modulemap new file mode 100644 index 0000000..44f6f64 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.modulemap @@ -0,0 +1,6 @@ +framework module Pods_OSPaymentsLib { + umbrella header "Pods-OSPaymentsLib-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.release.xcconfig b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.release.xcconfig new file mode 100644 index 0000000..26f2c77 --- /dev/null +++ b/Pods/Target Support Files/Pods-OSPaymentsLib/Pods-OSPaymentsLib.release.xcconfig @@ -0,0 +1,8 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Quick/Quick-Info.plist b/Pods/Target Support Files/Quick/Quick-Info.plist new file mode 100644 index 0000000..8cc444f --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + ${PODS_DEVELOPMENT_LANGUAGE} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 7.5.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Quick/Quick-dummy.m b/Pods/Target Support Files/Quick/Quick-dummy.m new file mode 100644 index 0000000..54d7dc0 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Quick : NSObject +@end +@implementation PodsDummy_Quick +@end diff --git a/Pods/Target Support Files/Quick/Quick-prefix.pch b/Pods/Target Support Files/Quick/Quick-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/Quick/Quick-umbrella.h b/Pods/Target Support Files/Quick/Quick-umbrella.h new file mode 100644 index 0000000..1de6bf3 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-umbrella.h @@ -0,0 +1,20 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "QuickConfiguration.h" +#import "QCKDSL.h" +#import "Quick.h" +#import "QuickSpec.h" + +FOUNDATION_EXPORT double QuickVersionNumber; +FOUNDATION_EXPORT const unsigned char QuickVersionString[]; + diff --git a/Pods/Target Support Files/Quick/Quick.debug.xcconfig b/Pods/Target Support Files/Quick/Quick.debug.xcconfig new file mode 100644 index 0000000..d949e13 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick.debug.xcconfig @@ -0,0 +1,20 @@ +APPLICATION_EXTENSION_API_ONLY = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Quick +DEFINES_MODULE = YES +ENABLE_BITCODE = NO +ENABLE_TESTING_SEARCH_PATHS = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension -framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/Quick +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Quick/Quick.modulemap b/Pods/Target Support Files/Quick/Quick.modulemap new file mode 100644 index 0000000..1d12b21 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick.modulemap @@ -0,0 +1,6 @@ +framework module Quick { + umbrella header "Quick-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Quick/Quick.release.xcconfig b/Pods/Target Support Files/Quick/Quick.release.xcconfig new file mode 100644 index 0000000..d949e13 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick.release.xcconfig @@ -0,0 +1,20 @@ +APPLICATION_EXTENSION_API_ONLY = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Quick +DEFINES_MODULE = YES +ENABLE_BITCODE = NO +ENABLE_TESTING_SEARCH_PATHS = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension -framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/Quick +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..065a2af --- /dev/null +++ b/build.sh @@ -0,0 +1,30 @@ +rm -rf build + +sudo xcode-select --switch /Applications/Xcode_15.1.app + +xcodebuild archive \ +-workspace OSPaymentsLib.xcworkspace \ +-scheme OSPaymentsLib \ +-configuration Release \ +-sdk iphonesimulator \ +-destination 'generic/platform=iOS Simulator' \ +-archivePath './build/OSPaymentsLib.framework-iphonesimulator.xcarchive' \ +SKIP_INSTALL=NO \ +BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + +xcodebuild archive \ +-workspace OSPaymentsLib.xcworkspace \ +-scheme OSPaymentsLib \ +-configuration Release \ +-sdk iphoneos \ +-destination 'generic/platform=iOS' \ +-archivePath './build/OSPaymentsLib.framework-iphoneos.xcarchive' \ +SKIP_INSTALL=NO \ +BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + +xcodebuild -create-xcframework \ +-framework './build/OSPaymentsLib.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/OSPaymentsLib.framework' \ +-framework './build/OSPaymentsLib.framework-iphoneos.xcarchive/Products/Library/Frameworks/OSPaymentsLib.framework' \ +-output './build/OSPaymentsLib.xcframework' + +codesign --timestamp -v --sign 'OutSystems Inc. (S25XN959HW)' './build/OSPaymentsLib.xcframework' \ No newline at end of file diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d689004..74190ed 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -### 2022-04-12 +## [1.2.0] + +### Features +- Add Privacy Manifest file (https://outsystemsrd.atlassian.net/browse/RMET-3283). + +### Fixes +- Update `github_actions.yml` file steps versions (https://outsystemsrd.atlassian.net/browse/RMET-2568). + +## 1.1.1 + +### 2023-02-08 +- Make library available as `xcframework` (https://outsystemsrd.atlassian.net/browse/RMET-2280). + +## 1.1.0 + +### 2023-01-05 +- Feat: Add access token to Full Payment Process (https://outsystemsrd.atlassian.net/browse/RMET-2147). + +### 2022-12-12 +- Feat: Add Payment Service Provider property to `OSPMTDetailsModel` struct (https://outsystemsrd.atlassian.net/browse/RMET-2095). -Create repository. +### 2022-12-02 +- Feat: Add Stripe as Payment Service Provider (https://outsystemsrd.atlassian.net/browse/RMET-2078). + +### 2022-11-14 +- Add `podspec` file. + +## 1.0.0 + +### 2022-08-03 +- Feat: Set Payment Details (https://outsystemsrd.atlassian.net/browse/RMET-1723). + +### 2022-08-02 +- Feat: Check Wallet Availability for Payment (https://outsystemsrd.atlassian.net/browse/RMET-1695). + +### 2022-08-01 +- Feat: Setup Apple Pay Configurations (https://outsystemsrd.atlassian.net/browse/RMET-1722). + +### 2022-04-12 +- Create repository. diff --git a/docs/README.md b/docs/README.md index b069b67..f13d59b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,10 +1,82 @@ -# OSPaymentsLib +# OSPaymentsPluginLib-iOS -Welcome to **OSPaymentsLib**. +The `OSPaymentsPluginLib-iOS` is a library build using `Swift` that lets you set a payment experience using Apple Pay. It allows to set the payment's details, such as the merchant’s information, payment amount and currency, as well as shipping and billing address. This information can then used to process a payment within an app. -Commands to create the xcframework: +The `OSPMTActionDelegate` protocol, along with the class that implements it - `OSPMTPayments` - allows this interaction, providing the following operations: +- Setup Payment Configuration +- Check if Device is Ready for Payment +- Set Details and Trigger Payment -"sh build.sh" (will create the xcframewotk file in the output folder "build") +Each is detailed on following sections. -Copy and paste the file in the plugin. -path: "PLUGIN_ROOT_FOLDER" src/ios/frameworks/ +## Index + +- [Motivation](#motivation) +- [Usage](#usage) +- [Methods](#methods) + - [Setup Payment Configuration](#setup-payment-configuration) + - [Check if Device is Ready for Payment](#check-if-device-is-ready-for-payment) + - [Set Details and Trigger Payment](#set-details-and-trigger-payment) + +## Motivation + +This library is to be used by the [Payments Plugin](https://github.com/OutSystems/cordova-outsystems-payments). The repository contains a `podspec` file that is published and available on the `CocoaPods`' repository, and should be imported on the Cordova bridge as a `pod`. + +## Usage + +1. Include the `OSPaymentsPluginLib` pod in the Cordova Bridge. o accomplish this, the following needs to be inserted into the `plugin.xml` file. The `spec` field should be changed to the version the developer desires to use. + +```xml + + ... + + + + + + ... + + ... + + + ... + +``` + +2. Go to [Apple Developer Portal](https://developer.apple.com/) and configure the Provisioning Profile with the `Apple Pay Payment Processing` and `In-App Purchase` capabilities enabled. + +## Methods + +The library provides the following methods to interact with: + +### Setup Payment Configuration + +```swift +func setupConfiguration() +``` + +Sets up the payment configuration. + +The method's success is returned through a `OSPMTCallbackDelegate` call. Success operations returns an object of the structure type `OSPMTConfigurationModel`, encoded in a UTF-8 string. An `OSPMTError` error is returned in case of error. + +### Check if Device is Ready for Payment + +```swift +func checkWalletSetup() +``` + +Verifies the device is ready to process a payment, considering the configuration provided before. + +The method's success is returned through a `OSPMTCallbackDelegate` call. Success operations returns an empty string or a `OSPMTError` error otherwise. + +### Set Details and Trigger Payment + +```swift +func set(_ details: String, and: accessToken: String?) +``` + +Sets payment details and triggers the request proccess. The method contains the following parameter: +- `details`: Payment details model serialized into a text field. This model can be checked in the `OSPMTDetailsModel` structure. +- `accessToken`: Authorisation token related with a full payment type. Can be empty, which should be the case for custom payments. + +The method's success is returned through a `OSPMTCallbackDelegate` call. Success operations returns an object of the structure type `OSPMTScopeModel`, encoded in a UTF-8 string. An `OSPMTError` error is returned in case of error. diff --git a/docs/assets/createRepositoryButton.png b/docs/assets/createRepositoryButton.png deleted file mode 100644 index 423ed4a..0000000 Binary files a/docs/assets/createRepositoryButton.png and /dev/null differ diff --git a/docs/assets/repositoryNameExample.png b/docs/assets/repositoryNameExample.png deleted file mode 100644 index 68efa30..0000000 Binary files a/docs/assets/repositoryNameExample.png and /dev/null differ diff --git a/docs/assets/useThisTemplateButton.png b/docs/assets/useThisTemplateButton.png deleted file mode 100644 index 22dab19..0000000 Binary files a/docs/assets/useThisTemplateButton.png and /dev/null differ diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 234570f..a36e5bf 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -26,6 +26,7 @@ platform :ios do lane :coverage do slather( scheme: "OSPaymentsLib", + workspace: "OSPaymentsLib.xcworkspace", proj: "OSPaymentsLib.xcodeproj", output_directory: "sonar-reports", sonarqube_xml: "true" diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100644 index 312d624..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,26 +0,0 @@ -cd .. - -rm -rf build - -xcodebuild archive \ --scheme OSPaymentsLib \ --configuration Release \ --destination 'generic/platform=iOS Simulator' \ --archivePath './scripts/build/OSPaymentsLib.framework-iphonesimulator.xcarchive' \ -SKIP_INSTALL=NO \ -BUILD_LIBRARIES_FOR_DISTRIBUTION=YES - - -xcodebuild archive \ --scheme OSPaymentsLib \ --configuration Release \ --destination 'generic/platform=iOS' \ --archivePath './scripts/build/OSPaymentsLib.framework-iphoneos.xcarchive' \ -SKIP_INSTALL=NO \ -BUILD_LIBRARIES_FOR_DISTRIBUTION=YES - - -xcodebuild -create-xcframework \ --framework './scripts/build/OSPaymentsLib.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/OSPaymentsLib.framework' \ --framework './scripts/build/OSPaymentsLib.framework-iphoneos.xcarchive/Products/Library/Frameworks/OSPaymentsLib.framework' \ --output './scripts/build/OSPaymentsLib.xcframework' \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties index 87c2b70..79ab51d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -23,11 +23,12 @@ sonar.objc.file.suffixes=- # Exclude directories sonar.test.inclusions=**/*Test*/** sonar.test.inclusions=*.swift -sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/* +sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*,**/*Test*/** -sonar.coverage.exclusions=**/*Test*/**,**/FirebaseMessagingErrors.swift +sonar.coverage.exclusions=**/*Test*/**,**/*Error.swift,**/*Extensions*/** sonar.tests=OSPaymentsLibTests sonar.swift.project=OSPaymentsLib.xcodeproj +sonar.swift.workspace=OSPaymentsLib.xcworkspace sonar.swift.appScheme=OSPaymentsLib \ No newline at end of file