├── .gitignore ├── .travis.yml ├── Example ├── GHApplicationMediator.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── GHApplicationMediator-Example.xcscheme ├── GHApplicationMediator.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── GHApplicationMediator │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── GHAppDelegate.h │ ├── GHAppDelegate.m │ ├── GHApplicationMediator-Info.plist │ ├── GHApplicationMediator-Prefix.pch │ ├── GHViewController.h │ ├── GHViewController.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ModuleA.h │ ├── ModuleA.m │ ├── ModuleB.h │ ├── ModuleB.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── Podfile ├── Podfile.lock ├── Pods │ ├── Expecta │ │ ├── Expecta │ │ │ ├── EXPBlockDefinedMatcher.h │ │ │ ├── EXPBlockDefinedMatcher.m │ │ │ ├── EXPDefines.h │ │ │ ├── EXPDoubleTuple.h │ │ │ ├── EXPDoubleTuple.m │ │ │ ├── EXPExpect.h │ │ │ ├── EXPExpect.m │ │ │ ├── EXPFloatTuple.h │ │ │ ├── EXPFloatTuple.m │ │ │ ├── EXPMatcher.h │ │ │ ├── EXPUnsupportedObject.h │ │ │ ├── EXPUnsupportedObject.m │ │ │ ├── Expecta.h │ │ │ ├── ExpectaObject.h │ │ │ ├── ExpectaObject.m │ │ │ ├── ExpectaSupport.h │ │ │ ├── ExpectaSupport.m │ │ │ ├── Matchers │ │ │ │ ├── EXPMatcherHelpers.h │ │ │ │ ├── EXPMatcherHelpers.m │ │ │ │ ├── EXPMatchers+beCloseTo.h │ │ │ │ ├── EXPMatchers+beCloseTo.m │ │ │ │ ├── EXPMatchers+beFalsy.h │ │ │ │ ├── EXPMatchers+beFalsy.m │ │ │ │ ├── EXPMatchers+beGreaterThan.h │ │ │ │ ├── EXPMatchers+beGreaterThan.m │ │ │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.h │ │ │ │ ├── EXPMatchers+beGreaterThanOrEqualTo.m │ │ │ │ ├── EXPMatchers+beIdenticalTo.h │ │ │ │ ├── EXPMatchers+beIdenticalTo.m │ │ │ │ ├── EXPMatchers+beInTheRangeOf.h │ │ │ │ ├── EXPMatchers+beInTheRangeOf.m │ │ │ │ ├── EXPMatchers+beInstanceOf.h │ │ │ │ ├── EXPMatchers+beInstanceOf.m │ │ │ │ ├── EXPMatchers+beKindOf.h │ │ │ │ ├── EXPMatchers+beKindOf.m │ │ │ │ ├── EXPMatchers+beLessThan.h │ │ │ │ ├── EXPMatchers+beLessThan.m │ │ │ │ ├── EXPMatchers+beLessThanOrEqualTo.h │ │ │ │ ├── EXPMatchers+beLessThanOrEqualTo.m │ │ │ │ ├── EXPMatchers+beNil.h │ │ │ │ ├── EXPMatchers+beNil.m │ │ │ │ ├── EXPMatchers+beSubclassOf.h │ │ │ │ ├── EXPMatchers+beSubclassOf.m │ │ │ │ ├── EXPMatchers+beSupersetOf.h │ │ │ │ ├── EXPMatchers+beSupersetOf.m │ │ │ │ ├── EXPMatchers+beTruthy.h │ │ │ │ ├── EXPMatchers+beTruthy.m │ │ │ │ ├── EXPMatchers+beginWith.h │ │ │ │ ├── EXPMatchers+beginWith.m │ │ │ │ ├── EXPMatchers+conformTo.h │ │ │ │ ├── EXPMatchers+conformTo.m │ │ │ │ ├── EXPMatchers+contain.h │ │ │ │ ├── EXPMatchers+contain.m │ │ │ │ ├── EXPMatchers+endWith.h │ │ │ │ ├── EXPMatchers+endWith.m │ │ │ │ ├── EXPMatchers+equal.h │ │ │ │ ├── EXPMatchers+equal.m │ │ │ │ ├── EXPMatchers+haveCountOf.h │ │ │ │ ├── EXPMatchers+haveCountOf.m │ │ │ │ ├── EXPMatchers+match.h │ │ │ │ ├── EXPMatchers+match.m │ │ │ │ ├── EXPMatchers+postNotification.h │ │ │ │ ├── EXPMatchers+postNotification.m │ │ │ │ ├── EXPMatchers+raise.h │ │ │ │ ├── EXPMatchers+raise.m │ │ │ │ ├── EXPMatchers+raiseWithReason.h │ │ │ │ ├── EXPMatchers+raiseWithReason.m │ │ │ │ ├── EXPMatchers+respondTo.h │ │ │ │ ├── EXPMatchers+respondTo.m │ │ │ │ └── EXPMatchers.h │ │ │ ├── NSObject+Expecta.h │ │ │ ├── NSValue+Expecta.h │ │ │ └── NSValue+Expecta.m │ │ ├── LICENSE │ │ └── README.md │ ├── Local Podspecs │ │ └── GHApplicationMediator.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ ├── Specta │ │ ├── LICENSE │ │ ├── README.md │ │ └── Specta │ │ │ └── Specta │ │ │ ├── SPTCallSite.h │ │ │ ├── SPTCallSite.m │ │ │ ├── SPTCompiledExample.h │ │ │ ├── SPTCompiledExample.m │ │ │ ├── SPTExample.h │ │ │ ├── SPTExample.m │ │ │ ├── SPTExampleGroup.h │ │ │ ├── SPTExampleGroup.m │ │ │ ├── SPTExcludeGlobalBeforeAfterEach.h │ │ │ ├── SPTGlobalBeforeAfterEach.h │ │ │ ├── SPTSharedExampleGroups.h │ │ │ ├── SPTSharedExampleGroups.m │ │ │ ├── SPTSpec.h │ │ │ ├── SPTSpec.m │ │ │ ├── SPTTestSuite.h │ │ │ ├── SPTTestSuite.m │ │ │ ├── Specta.h │ │ │ ├── SpectaDSL.h │ │ │ ├── SpectaDSL.m │ │ │ ├── SpectaTypes.h │ │ │ ├── SpectaUtility.h │ │ │ ├── SpectaUtility.m │ │ │ ├── XCTest+Private.h │ │ │ ├── XCTestCase+Specta.h │ │ │ └── XCTestCase+Specta.m │ └── Target Support Files │ │ ├── Expecta │ │ ├── Expecta-Info.plist │ │ ├── Expecta-dummy.m │ │ ├── Expecta-prefix.pch │ │ ├── Expecta-umbrella.h │ │ ├── Expecta.modulemap │ │ └── Expecta.xcconfig │ │ ├── GHApplicationMediator │ │ ├── GHApplicationMediator-Info.plist │ │ ├── GHApplicationMediator-dummy.m │ │ ├── GHApplicationMediator-prefix.pch │ │ ├── GHApplicationMediator-umbrella.h │ │ ├── GHApplicationMediator.modulemap │ │ └── GHApplicationMediator.xcconfig │ │ ├── Pods-GHApplicationMediator_Example │ │ ├── Pods-GHApplicationMediator_Example-Info.plist │ │ ├── Pods-GHApplicationMediator_Example-acknowledgements.markdown │ │ ├── Pods-GHApplicationMediator_Example-acknowledgements.plist │ │ ├── Pods-GHApplicationMediator_Example-dummy.m │ │ ├── Pods-GHApplicationMediator_Example-frameworks.sh │ │ ├── Pods-GHApplicationMediator_Example-umbrella.h │ │ ├── Pods-GHApplicationMediator_Example.debug.xcconfig │ │ ├── Pods-GHApplicationMediator_Example.modulemap │ │ └── Pods-GHApplicationMediator_Example.release.xcconfig │ │ ├── Pods-GHApplicationMediator_Tests │ │ ├── Pods-GHApplicationMediator_Tests-Info.plist │ │ ├── Pods-GHApplicationMediator_Tests-acknowledgements.markdown │ │ ├── Pods-GHApplicationMediator_Tests-acknowledgements.plist │ │ ├── Pods-GHApplicationMediator_Tests-dummy.m │ │ ├── Pods-GHApplicationMediator_Tests-frameworks.sh │ │ ├── Pods-GHApplicationMediator_Tests-umbrella.h │ │ ├── Pods-GHApplicationMediator_Tests.debug.xcconfig │ │ ├── Pods-GHApplicationMediator_Tests.modulemap │ │ └── Pods-GHApplicationMediator_Tests.release.xcconfig │ │ └── Specta │ │ ├── Specta-Info.plist │ │ ├── Specta-dummy.m │ │ ├── Specta-prefix.pch │ │ ├── Specta-umbrella.h │ │ ├── Specta.modulemap │ │ └── Specta.xcconfig └── Tests │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── en.lproj │ └── InfoPlist.strings ├── GHApplicationMediator.podspec ├── GHApplicationMediator ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── GHApplicationMediator.h │ └── GHApplicationMediator.m ├── LICENSE ├── README.md ├── _Pods.xcodeproj └── repo.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/GHApplicationMediator.xcworkspace -scheme GHApplicationMediator-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator.xcodeproj/xcshareddata/xcschemes/GHApplicationMediator-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHAppDelegate.h 3 | // GHApplicationMediator 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface GHAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GHAppDelegate.m 3 | // GHApplicationMediator 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | #import "GHAppDelegate.h" 10 | #import "GHApplicationMediator.h" 11 | #import "ModuleA.h" 12 | #import "ModuleB.h" 13 | 14 | @implementation GHAppDelegate 15 | 16 | + (void)load 17 | { 18 | [GHApplicationMediator registerAppilgationModuleDelegate:[[ModuleA alloc] init]]; 19 | 20 | [GHApplicationMediator registerAppilgationModuleDelegate:[[ModuleB alloc] init]]; 21 | } 22 | 23 | - (BOOL)respondsToSelector:(SEL)aSelector 24 | { 25 | return [[GHApplicationMediator sharedInstance] respondsToSelector:aSelector]; 26 | } 27 | 28 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 29 | { 30 | return [[GHApplicationMediator sharedInstance] methodSignatureForSelector:aSelector]; 31 | } 32 | 33 | - (void)forwardInvocation:(NSInvocation *)anInvocation 34 | { 35 | [[GHApplicationMediator sharedInstance] forwardInvocation:anInvocation]; 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHApplicationMediator-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHApplicationMediator-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHViewController.h 3 | // GHApplicationMediator 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface GHViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/GHViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GHViewController.m 3 | // GHApplicationMediator 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | #import "GHViewController.h" 10 | 11 | @interface GHViewController () 12 | 13 | @end 14 | 15 | @implementation GHViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/ModuleA.h: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleA.h 3 | // ApplicationMediator 4 | // 5 | // Created by JunhuaShao on 2019/3/6. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface ModuleA : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/ModuleA.m: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleA.m 3 | // ApplicationMediator 4 | // 5 | // Created by JunhuaShao on 2019/3/6. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import "ModuleA.h" 10 | 11 | @implementation ModuleA 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | NSLog(@"%@--->%s",self.class,__FUNCTION__); 16 | 17 | return YES; 18 | } 19 | 20 | - (void)applicationDidBecomeActive:(UIApplication *)application 21 | { 22 | NSLog(@"%@--->%s",self.class,__FUNCTION__); 23 | } 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/ModuleB.h: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleB.h 3 | // ApplicationMediator 4 | // 5 | // Created by JunhuaShao on 2019/3/6. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface ModuleB : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/ModuleB.m: -------------------------------------------------------------------------------- 1 | // 2 | // ModuleB.m 3 | // ApplicationMediator 4 | // 5 | // Created by JunhuaShao on 2019/3/6. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import "ModuleB.h" 10 | 11 | @implementation ModuleB 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | NSLog(@"%@--->%s",self.class,__FUNCTION__); 16 | 17 | return YES; 18 | } 19 | 20 | - (void)applicationDidBecomeActive:(UIApplication *)application 21 | { 22 | NSLog(@"%@--->%s",self.class,__FUNCTION__); 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/GHApplicationMediator/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GHApplicationMediator 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "GHAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([GHAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '10.0' 4 | 5 | target 'GHApplicationMediator_Example' do 6 | pod 'GHApplicationMediator', :path => '../' 7 | 8 | target 'GHApplicationMediator_Tests' do 9 | inherit! :search_paths 10 | 11 | pod 'Specta' 12 | pod 'Expecta' 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Expecta (1.0.6) 3 | - GHApplicationMediator (0.1.0) 4 | - Specta (1.0.7) 5 | 6 | DEPENDENCIES: 7 | - Expecta 8 | - GHApplicationMediator (from `../`) 9 | - Specta 10 | 11 | SPEC REPOS: 12 | https://github.com/cocoapods/specs.git: 13 | - Expecta 14 | - Specta 15 | 16 | EXTERNAL SOURCES: 17 | GHApplicationMediator: 18 | :path: "../" 19 | 20 | SPEC CHECKSUMS: 21 | Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5 22 | GHApplicationMediator: d71428f10f1212f7533c5d1bab7d54fe3f08b6c3 23 | Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 24 | 25 | PODFILE CHECKSUM: d0fc96c34780fbef0eed138097fb818dd1b3c7a9 26 | 27 | COCOAPODS: 1.6.0 28 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPBlockDefinedMatcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXPRuntimeMatcher.h 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EXPMatcher.h" 11 | #import "EXPDefines.h" 12 | 13 | @interface EXPBlockDefinedMatcher : NSObject { 14 | EXPBoolBlock prerequisiteBlock; 15 | EXPBoolBlock matchBlock; 16 | EXPStringBlock failureMessageForToBlock; 17 | EXPStringBlock failureMessageForNotToBlock; 18 | } 19 | 20 | @property(nonatomic, copy) EXPBoolBlock prerequisiteBlock; 21 | @property(nonatomic, copy) EXPBoolBlock matchBlock; 22 | @property(nonatomic, copy) EXPStringBlock failureMessageForToBlock; 23 | @property(nonatomic, copy) EXPStringBlock failureMessageForNotToBlock; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPBlockDefinedMatcher.m: -------------------------------------------------------------------------------- 1 | // 2 | // EXPRuntimeMatcher.m 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #import "EXPBlockDefinedMatcher.h" 10 | 11 | @implementation EXPBlockDefinedMatcher 12 | 13 | - (void)dealloc 14 | { 15 | self.prerequisiteBlock = nil; 16 | self.matchBlock = nil; 17 | self.failureMessageForToBlock = nil; 18 | self.failureMessageForNotToBlock = nil; 19 | 20 | [super dealloc]; 21 | } 22 | 23 | @synthesize prerequisiteBlock; 24 | @synthesize matchBlock; 25 | @synthesize failureMessageForToBlock; 26 | @synthesize failureMessageForNotToBlock; 27 | 28 | - (BOOL)meetsPrerequesiteFor:(id)actual 29 | { 30 | if (self.prerequisiteBlock) { 31 | return self.prerequisiteBlock(); 32 | } 33 | return YES; 34 | } 35 | 36 | - (BOOL)matches:(id)actual 37 | { 38 | if (self.matchBlock) { 39 | return self.matchBlock(); 40 | } 41 | return YES; 42 | } 43 | 44 | - (NSString *)failureMessageForTo:(id)actual 45 | { 46 | if (self.failureMessageForToBlock) { 47 | return self.failureMessageForToBlock(); 48 | } 49 | return nil; 50 | } 51 | 52 | - (NSString *)failureMessageForNotTo:(id)actual 53 | { 54 | if (self.failureMessageForNotToBlock) { 55 | return self.failureMessageForNotToBlock(); 56 | } 57 | return nil; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // EXPDefines.h 3 | // Expecta 4 | // 5 | // Created by Luke Redpath on 26/03/2012. 6 | // Copyright (c) 2012 Peter Jihoon Kim. All rights reserved. 7 | // 8 | 9 | #ifndef Expecta_EXPDefines_h 10 | #define Expecta_EXPDefines_h 11 | 12 | typedef void (^EXPBasicBlock)(void); 13 | typedef id (^EXPIdBlock)(void); 14 | typedef BOOL (^EXPBoolBlock)(void); 15 | typedef NSString *(^EXPStringBlock)(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPDoubleTuple.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPDoubleTuple : NSObject { 4 | double *_values; 5 | size_t _size; 6 | } 7 | 8 | @property (nonatomic, assign) double *values; 9 | @property (nonatomic, assign) size_t size; 10 | 11 | - (instancetype)initWithDoubleValues:(double *)values size:(size_t)size NS_DESIGNATED_INITIALIZER; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPDoubleTuple.m: -------------------------------------------------------------------------------- 1 | #import "EXPDoubleTuple.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPDoubleTuple 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize values = _values, size = _size; 9 | 10 | - (instancetype)initWithDoubleValues:(double *)values size:(size_t)size { 11 | if ((self = [super init])) { 12 | self.values = malloc(sizeof(double) * size); 13 | memcpy(self.values, values, sizeof(double) * size); 14 | self.size = size; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)dealloc { 20 | free(self.values); 21 | [super dealloc]; 22 | } 23 | 24 | - (BOOL)isEqual:(id)object { 25 | if (![object isKindOfClass:[EXPDoubleTuple class]]) return NO; 26 | EXPDoubleTuple *other = (EXPDoubleTuple *)object; 27 | if (self.size == other.size) { 28 | for (int i = 0; i < self.size; ++i) { 29 | if (self.values[i] != other.values[i]) return NO; 30 | } 31 | return YES; 32 | } 33 | return NO; 34 | } 35 | 36 | - (NSString *)description { 37 | if (self.size == 2) { 38 | return [NSString stringWithFormat:@"Double tuple: {%f, %f}", self.values[0], self.values[1]]; 39 | } else if (self.size == 4) { 40 | return [NSString stringWithFormat:@"Double tuple: {%f, %f, %f, %f}", self.values[0], self.values[1], self.values[2], self.values[3]]; 41 | } 42 | return [NSString stringWithFormat:@"Double tuple of unexpected size %zd, sadly", self.size]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPExpect.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "EXPMatcher.h" 3 | #import "EXPDefines.h" 4 | 5 | @interface EXPExpect : NSObject { 6 | EXPIdBlock _actualBlock; 7 | id _testCase; 8 | int _lineNumber; 9 | char *_fileName; 10 | BOOL _negative; 11 | BOOL _asynchronous; 12 | NSTimeInterval _timeout; 13 | } 14 | 15 | @property(nonatomic, copy) EXPIdBlock actualBlock; 16 | @property(nonatomic, readonly) id actual; 17 | @property(nonatomic, assign) id testCase; 18 | @property(nonatomic) int lineNumber; 19 | @property(nonatomic) const char *fileName; 20 | @property(nonatomic) BOOL negative; 21 | @property(nonatomic) BOOL asynchronous; 22 | @property(nonatomic) NSTimeInterval timeout; 23 | 24 | @property(nonatomic, readonly) EXPExpect *to; 25 | @property(nonatomic, readonly) EXPExpect *toNot; 26 | @property(nonatomic, readonly) EXPExpect *notTo; 27 | @property(nonatomic, readonly) EXPExpect *will; 28 | @property(nonatomic, readonly) EXPExpect *willNot; 29 | @property(nonatomic, readonly) EXPExpect *(^after)(NSTimeInterval timeInterval); 30 | 31 | - (instancetype)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName NS_DESIGNATED_INITIALIZER; 32 | + (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName; 33 | 34 | - (void)applyMatcher:(id)matcher; 35 | - (void)applyMatcher:(id)matcher to:(NSObject **)actual; 36 | 37 | @end 38 | 39 | @interface EXPDynamicPredicateMatcher : NSObject { 40 | EXPExpect *_expectation; 41 | SEL _selector; 42 | } 43 | - (instancetype)initWithExpectation:(EXPExpect *)expectation selector:(SEL)selector NS_DESIGNATED_INITIALIZER; 44 | @property (nonatomic, readonly, copy) void (^dispatch)(void); 45 | @end 46 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPExpect.m: -------------------------------------------------------------------------------- 1 | #import "EXPExpect.h" 2 | #import "NSObject+Expecta.h" 3 | #import "Expecta.h" 4 | #import "EXPUnsupportedObject.h" 5 | #import "EXPMatcher.h" 6 | #import "EXPBlockDefinedMatcher.h" 7 | #import 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 11 | @implementation EXPExpect 12 | #pragma clang diagnostic pop 13 | 14 | @dynamic 15 | actual, 16 | to, 17 | toNot, 18 | notTo, 19 | will, 20 | willNot, 21 | after; 22 | 23 | @synthesize 24 | actualBlock=_actualBlock, 25 | testCase=_testCase, 26 | negative=_negative, 27 | asynchronous=_asynchronous, 28 | timeout=_timeout, 29 | lineNumber=_lineNumber, 30 | fileName=_fileName; 31 | 32 | - (instancetype)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName { 33 | self = [super init]; 34 | if(self) { 35 | self.actualBlock = actualBlock; 36 | self.testCase = testCase; 37 | self.negative = NO; 38 | self.asynchronous = NO; 39 | self.timeout = [Expecta asynchronousTestTimeout]; 40 | self.lineNumber = lineNumber; 41 | self.fileName = fileName; 42 | } 43 | return self; 44 | } 45 | 46 | - (void)dealloc 47 | { 48 | [_actualBlock release]; 49 | _actualBlock = nil; 50 | [super dealloc]; 51 | } 52 | 53 | + (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName { 54 | return [[[EXPExpect alloc] initWithActualBlock:actualBlock testCase:(id)testCase lineNumber:lineNumber fileName:fileName] autorelease]; 55 | } 56 | 57 | #pragma mark - 58 | 59 | - (EXPExpect *)to { 60 | return self; 61 | } 62 | 63 | - (EXPExpect *)toNot { 64 | self.negative = !self.negative; 65 | return self; 66 | } 67 | 68 | - (EXPExpect *)notTo { 69 | return [self toNot]; 70 | } 71 | 72 | - (EXPExpect *)will { 73 | self.asynchronous = YES; 74 | return self; 75 | } 76 | 77 | - (EXPExpect *)willNot { 78 | return self.will.toNot; 79 | } 80 | 81 | - (EXPExpect *(^)(NSTimeInterval))after 82 | { 83 | EXPExpect * (^block)(NSTimeInterval) = [^EXPExpect *(NSTimeInterval timeout) { 84 | self.asynchronous = YES; 85 | self.timeout = timeout; 86 | return self; 87 | } copy]; 88 | 89 | return [block autorelease]; 90 | } 91 | 92 | #pragma mark - 93 | 94 | - (id)actual { 95 | if(self.actualBlock) { 96 | return self.actualBlock(); 97 | } 98 | return nil; 99 | } 100 | 101 | - (void)applyMatcher:(id)matcher 102 | { 103 | id actual = [self actual]; 104 | [self applyMatcher:matcher to:&actual]; 105 | } 106 | 107 | - (void)applyMatcher:(id)matcher to:(NSObject **)actual { 108 | if([*actual isKindOfClass:[EXPUnsupportedObject class]]) { 109 | EXPFail(self.testCase, self.lineNumber, self.fileName, 110 | [NSString stringWithFormat:@"expecting a %@ is not supported", ((EXPUnsupportedObject *)*actual).type]); 111 | } else { 112 | BOOL failed = NO; 113 | if([matcher respondsToSelector:@selector(meetsPrerequesiteFor:)] && 114 | ![matcher meetsPrerequesiteFor:*actual]) { 115 | failed = YES; 116 | } else { 117 | BOOL matchResult = NO; 118 | if(self.asynchronous) { 119 | NSTimeInterval timeOut = self.timeout; 120 | NSDate *expiryDate = [NSDate dateWithTimeIntervalSinceNow:timeOut]; 121 | while(1) { 122 | matchResult = [matcher matches:*actual]; 123 | failed = self.negative ? matchResult : !matchResult; 124 | if(!failed || ([(NSDate *)[NSDate date] compare:expiryDate] == NSOrderedDescending)) { 125 | break; 126 | } 127 | [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; 128 | OSMemoryBarrier(); 129 | *actual = self.actual; 130 | } 131 | } else { 132 | matchResult = [matcher matches:*actual]; 133 | } 134 | failed = self.negative ? matchResult : !matchResult; 135 | } 136 | if(failed) { 137 | NSString *message = nil; 138 | 139 | if(self.negative) { 140 | if ([matcher respondsToSelector:@selector(failureMessageForNotTo:)]) { 141 | message = [matcher failureMessageForNotTo:*actual]; 142 | } 143 | } else { 144 | if ([matcher respondsToSelector:@selector(failureMessageForTo:)]) { 145 | message = [matcher failureMessageForTo:*actual]; 146 | } 147 | } 148 | if (message == nil) { 149 | message = @"Match Failed."; 150 | } 151 | 152 | EXPFail(self.testCase, self.lineNumber, self.fileName, message); 153 | } 154 | } 155 | self.negative = NO; 156 | } 157 | 158 | #pragma mark - Dynamic predicate dispatch 159 | 160 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 161 | { 162 | if ([self.actual respondsToSelector:aSelector]) { 163 | return [self.actual methodSignatureForSelector:aSelector]; 164 | } 165 | return [super methodSignatureForSelector:aSelector]; 166 | } 167 | 168 | - (void)forwardInvocation:(NSInvocation *)anInvocation 169 | { 170 | if ([self.actual respondsToSelector:anInvocation.selector]) { 171 | EXPDynamicPredicateMatcher *matcher = [[EXPDynamicPredicateMatcher alloc] initWithExpectation:self selector:anInvocation.selector]; 172 | [anInvocation setSelector:@selector(dispatch)]; 173 | [anInvocation invokeWithTarget:matcher]; 174 | [matcher release]; 175 | } 176 | else { 177 | [super forwardInvocation:anInvocation]; 178 | } 179 | } 180 | 181 | @end 182 | 183 | #pragma clang diagnostic push 184 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 185 | @implementation EXPDynamicPredicateMatcher 186 | #pragma clang diagnostic pop 187 | 188 | - (instancetype)initWithExpectation:(EXPExpect *)expectation selector:(SEL)selector 189 | { 190 | if ((self = [super init])) { 191 | _expectation = expectation; 192 | _selector = selector; 193 | } 194 | return self; 195 | } 196 | 197 | - (BOOL)matches:(id)actual 198 | { 199 | return (BOOL)[actual performSelector:_selector]; 200 | } 201 | 202 | - (NSString *)failureMessageForTo:(id)actual 203 | { 204 | return [NSString stringWithFormat:@"expected %@ to be true", NSStringFromSelector(_selector)]; 205 | } 206 | 207 | - (NSString *)failureMessageForNotTo:(id)actual 208 | { 209 | return [NSString stringWithFormat:@"expected %@ to be false", NSStringFromSelector(_selector)]; 210 | } 211 | 212 | - (void (^)(void))dispatch 213 | { 214 | __block id blockExpectation = _expectation; 215 | 216 | return [[^{ 217 | [blockExpectation applyMatcher:self]; 218 | } copy] autorelease]; 219 | } 220 | 221 | @end 222 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPFloatTuple.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPFloatTuple : NSObject { 4 | float *_values; 5 | size_t _size; 6 | } 7 | 8 | @property (nonatomic, assign) float *values; 9 | @property (nonatomic, assign) size_t size; 10 | 11 | - (instancetype)initWithFloatValues:(float *)values size:(size_t)size NS_DESIGNATED_INITIALIZER; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPFloatTuple.m: -------------------------------------------------------------------------------- 1 | #import "EXPFloatTuple.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPFloatTuple 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize values = _values, size = _size; 9 | 10 | - (instancetype)initWithFloatValues:(float *)values size:(size_t)size { 11 | if ((self = [super init])) { 12 | self.values = malloc(sizeof(float) * size); 13 | memcpy(self.values, values, sizeof(float) * size); 14 | self.size = size; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)dealloc { 20 | free(self.values); 21 | [super dealloc]; 22 | } 23 | 24 | - (BOOL)isEqual:(id)object { 25 | if (![object isKindOfClass:[EXPFloatTuple class]]) return NO; 26 | EXPFloatTuple *other = (EXPFloatTuple *)object; 27 | if (self.size == other.size) { 28 | for (int i = 0; i < self.size; ++i) { 29 | if (self.values[i] != other.values[i]) return NO; 30 | } 31 | return YES; 32 | } 33 | return NO; 34 | } 35 | 36 | - (NSUInteger)hash 37 | { 38 | NSUInteger prime = 31; 39 | NSUInteger hash = 0; 40 | for (int i=0; i 10 | 11 | @protocol EXPMatcher 12 | 13 | - (BOOL)matches:(id)actual; 14 | 15 | @optional 16 | - (BOOL)meetsPrerequesiteFor:(id)actual; 17 | - (NSString *)failureMessageForTo:(id)actual; 18 | - (NSString *)failureMessageForNotTo:(id)actual; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPUnsupportedObject.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface EXPUnsupportedObject : NSObject { 4 | NSString *_type; 5 | } 6 | 7 | @property (nonatomic, retain) NSString *type; 8 | 9 | - (instancetype)initWithType:(NSString *)type NS_DESIGNATED_INITIALIZER; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/EXPUnsupportedObject.m: -------------------------------------------------------------------------------- 1 | #import "EXPUnsupportedObject.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wobjc-designated-initializers" 5 | @implementation EXPUnsupportedObject 6 | #pragma clang diagnostic pop 7 | 8 | @synthesize type=_type; 9 | 10 | - (instancetype)initWithType:(NSString *)type { 11 | self = [super init]; 12 | if(self) { 13 | self.type = type; 14 | } 15 | return self; 16 | } 17 | 18 | - (void)dealloc { 19 | self.type = nil; 20 | [super dealloc]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for Expecta. 4 | FOUNDATION_EXPORT double ExpectaVersionNumber; 5 | 6 | //! Project version string for Expecta. 7 | FOUNDATION_EXPORT const unsigned char ExpectaVersionString[]; 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | // Enable shorthand by default 14 | #define expect(...) EXP_expect((__VA_ARGS__)) 15 | #define failure(...) EXP_failure((__VA_ARGS__)) 16 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/ExpectaObject.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #define EXPObjectify(value) _EXPObjectify(@encode(__typeof__((value))), (value)) 4 | #define EXP_expect(actual) _EXP_expect(self, __LINE__, __FILE__, ^id{ __typeof__((actual)) strongActual = (actual); return EXPObjectify(strongActual); }) 5 | #define EXPMatcherInterface(matcherName, matcherArguments) _EXPMatcherInterface(matcherName, matcherArguments) 6 | #define EXPMatcherImplementationBegin(matcherName, matcherArguments) _EXPMatcherImplementationBegin(matcherName, matcherArguments) 7 | #define EXPMatcherImplementationEnd _EXPMatcherImplementationEnd 8 | #define EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) _EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) 9 | 10 | #define EXP_failure(message) EXPFail(self, __LINE__, __FILE__, message) 11 | 12 | 13 | @interface Expecta : NSObject 14 | 15 | + (NSTimeInterval)asynchronousTestTimeout; 16 | + (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/ExpectaObject.m: -------------------------------------------------------------------------------- 1 | #import "ExpectaObject.h" 2 | 3 | @implementation Expecta 4 | 5 | static NSTimeInterval _asynchronousTestTimeout = 1.0; 6 | 7 | + (NSTimeInterval)asynchronousTestTimeout { 8 | return _asynchronousTestTimeout; 9 | } 10 | 11 | + (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout { 12 | _asynchronousTestTimeout = timeout; 13 | } 14 | 15 | @end -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/ExpectaSupport.h: -------------------------------------------------------------------------------- 1 | #import "EXPExpect.h" 2 | #import "EXPBlockDefinedMatcher.h" 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | id _EXPObjectify(const char *type, ...); 9 | EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock); 10 | 11 | void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message); 12 | NSString *EXPDescribeObject(id obj); 13 | 14 | void EXP_prerequisite(EXPBoolBlock block); 15 | void EXP_match(EXPBoolBlock block); 16 | void EXP_failureMessageForTo(EXPStringBlock block); 17 | void EXP_failureMessageForNotTo(EXPStringBlock block); 18 | 19 | #if __has_feature(objc_arc) 20 | #define _EXP_release(x) 21 | #define _EXP_autorelease(x) (x) 22 | 23 | #else 24 | #define _EXP_release(x) [x release] 25 | #define _EXP_autorelease(x) [x autorelease] 26 | #endif 27 | 28 | // workaround for the categories bug: http://developer.apple.com/library/mac/#qa/qa1490/_index.html 29 | #define EXPFixCategoriesBug(name) \ 30 | __attribute__((constructor)) static void EXPFixCategoriesBug##name() {} 31 | 32 | #define _EXPMatcherInterface(matcherName, matcherArguments) \ 33 | @interface EXPExpect (matcherName##Matcher) \ 34 | @property (nonatomic, readonly) void(^ matcherName) matcherArguments; \ 35 | @end 36 | 37 | #define _EXPMatcherImplementationBegin(matcherName, matcherArguments) \ 38 | EXPFixCategoriesBug(EXPMatcher##matcherName##Matcher); \ 39 | @implementation EXPExpect (matcherName##Matcher) \ 40 | @dynamic matcherName;\ 41 | - (void(^) matcherArguments) matcherName { \ 42 | EXPBlockDefinedMatcher *matcher = [[EXPBlockDefinedMatcher alloc] init]; \ 43 | [[[NSThread currentThread] threadDictionary] setObject:matcher forKey:@"EXP_currentMatcher"]; \ 44 | __block id actual = self.actual; \ 45 | __block void (^prerequisite)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_prerequisite(block); }; \ 46 | __block void (^match)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_match(block); }; \ 47 | __block void (^failureMessageForTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForTo(block); }; \ 48 | __block void (^failureMessageForNotTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForNotTo(block); }; \ 49 | prerequisite(nil); match(nil); failureMessageForTo(nil); failureMessageForNotTo(nil); \ 50 | void (^matcherBlock) matcherArguments = [^ matcherArguments { \ 51 | { 52 | 53 | #define _EXPMatcherImplementationEnd \ 54 | } \ 55 | [self applyMatcher:matcher to:&actual]; \ 56 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:@"EXP_currentMatcher"]; \ 57 | } copy]; \ 58 | _EXP_release(matcher); \ 59 | return _EXP_autorelease(matcherBlock); \ 60 | } \ 61 | @end 62 | 63 | #define _EXPMatcherAliasImplementation(newMatcherName, oldMatcherName, matcherArguments) \ 64 | EXPFixCategoriesBug(EXPMatcher##newMatcherName##Matcher); \ 65 | @implementation EXPExpect (newMatcherName##Matcher) \ 66 | @dynamic newMatcherName;\ 67 | - (void(^) matcherArguments) newMatcherName { \ 68 | return [self oldMatcherName]; \ 69 | }\ 70 | @end 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/ExpectaSupport.m: -------------------------------------------------------------------------------- 1 | #import "ExpectaSupport.h" 2 | #import "NSValue+Expecta.h" 3 | #import "NSObject+Expecta.h" 4 | #import "EXPUnsupportedObject.h" 5 | #import "EXPFloatTuple.h" 6 | #import "EXPDoubleTuple.h" 7 | #import "EXPDefines.h" 8 | #import 9 | 10 | @interface NSObject (ExpectaXCTestRecordFailure) 11 | 12 | // suppress warning 13 | - (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filename atLine:(NSUInteger)lineNumber expected:(BOOL)expected; 14 | 15 | @end 16 | 17 | id _EXPObjectify(const char *type, ...) { 18 | va_list v; 19 | va_start(v, type); 20 | id obj = nil; 21 | if(strcmp(type, @encode(char)) == 0) { 22 | char actual = (char)va_arg(v, int); 23 | obj = @(actual); 24 | } else if(strcmp(type, @encode(_Bool)) == 0) { 25 | _Static_assert(sizeof(_Bool) <= sizeof(int), "Expected _Bool to be subject to vararg type promotion"); 26 | _Bool actual = (_Bool)va_arg(v, int); 27 | obj = @(actual); 28 | } else if(strcmp(type, @encode(double)) == 0) { 29 | double actual = (double)va_arg(v, double); 30 | obj = @(actual); 31 | } else if(strcmp(type, @encode(float)) == 0) { 32 | float actual = (float)va_arg(v, double); 33 | obj = @(actual); 34 | } else if(strcmp(type, @encode(int)) == 0) { 35 | int actual = (int)va_arg(v, int); 36 | obj = @(actual); 37 | } else if(strcmp(type, @encode(long)) == 0) { 38 | long actual = (long)va_arg(v, long); 39 | obj = @(actual); 40 | } else if(strcmp(type, @encode(long long)) == 0) { 41 | long long actual = (long long)va_arg(v, long long); 42 | obj = @(actual); 43 | } else if(strcmp(type, @encode(short)) == 0) { 44 | short actual = (short)va_arg(v, int); 45 | obj = @(actual); 46 | } else if(strcmp(type, @encode(unsigned char)) == 0) { 47 | unsigned char actual = (unsigned char)va_arg(v, unsigned int); 48 | obj = @(actual); 49 | } else if(strcmp(type, @encode(unsigned int)) == 0) { 50 | unsigned int actual = (int)va_arg(v, unsigned int); 51 | obj = @(actual); 52 | } else if(strcmp(type, @encode(unsigned long)) == 0) { 53 | unsigned long actual = (unsigned long)va_arg(v, unsigned long); 54 | obj = @(actual); 55 | } else if(strcmp(type, @encode(unsigned long long)) == 0) { 56 | unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long); 57 | obj = @(actual); 58 | } else if(strcmp(type, @encode(unsigned short)) == 0) { 59 | unsigned short actual = (unsigned short)va_arg(v, unsigned int); 60 | obj = @(actual); 61 | } else if(strstr(type, @encode(EXPBasicBlock)) != NULL) { 62 | // @encode(EXPBasicBlock) returns @? as of clang 4.1. 63 | // This condition must occur before the test for id/class type, 64 | // otherwise blocks will be treated as vanilla objects. 65 | id actual = va_arg(v, EXPBasicBlock); 66 | obj = [[actual copy] autorelease]; 67 | } else if((strstr(type, @encode(id)) != NULL) || (strstr(type, @encode(Class)) != 0)) { 68 | id actual = va_arg(v, id); 69 | obj = actual; 70 | } else if(strcmp(type, @encode(__typeof__(nil))) == 0) { 71 | obj = nil; 72 | } else if(strstr(type, "ff}{") != NULL) { //TODO: of course this only works for a 2x2 e.g. CGRect 73 | obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[4]) size:4] autorelease]; 74 | } else if(strstr(type, "=ff}") != NULL) { 75 | obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[2]) size:2] autorelease]; 76 | } else if(strstr(type, "=ffff}") != NULL) { 77 | obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[4]) size:4] autorelease]; 78 | } else if(strstr(type, "dd}{") != NULL) { //TODO: same here 79 | obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[4]) size:4] autorelease]; 80 | } else if(strstr(type, "=dd}") != NULL) { 81 | obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[2]) size:2] autorelease]; 82 | } else if(strstr(type, "=dddd}") != NULL) { 83 | obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[4]) size:4] autorelease]; 84 | } else if(type[0] == '{') { 85 | EXPUnsupportedObject *actual = [[[EXPUnsupportedObject alloc] initWithType:@"struct"] autorelease]; 86 | obj = actual; 87 | } else if(type[0] == '(') { 88 | EXPUnsupportedObject *actual = [[[EXPUnsupportedObject alloc] initWithType:@"union"] autorelease]; 89 | obj = actual; 90 | } else { 91 | void *actual = va_arg(v, void *); 92 | obj = (actual == NULL ? nil :[NSValue valueWithPointer:actual]); 93 | } 94 | if([obj isKindOfClass:[NSValue class]] && ![obj isKindOfClass:[NSNumber class]]) { 95 | [(NSValue *)obj set_EXP_objCType:type]; 96 | } 97 | va_end(v); 98 | return obj; 99 | } 100 | 101 | EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock) { 102 | return [EXPExpect expectWithActualBlock:actualBlock testCase:testCase lineNumber:lineNumber fileName:fileName]; 103 | } 104 | 105 | void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message) { 106 | NSLog(@"%s:%d %@", fileName, lineNumber, message); 107 | NSString *reason = [NSString stringWithFormat:@"%s:%d %@", fileName, lineNumber, message]; 108 | NSException *exception = [NSException exceptionWithName:@"Expecta Error" reason:reason userInfo:nil]; 109 | 110 | if(testCase && [testCase respondsToSelector:@selector(recordFailureWithDescription:inFile:atLine:expected:)]){ 111 | [testCase recordFailureWithDescription:message 112 | inFile:@(fileName) 113 | atLine:lineNumber 114 | expected:NO]; 115 | } else { 116 | [exception raise]; 117 | } 118 | } 119 | 120 | NSString *EXPDescribeObject(id obj) { 121 | if(obj == nil) { 122 | return @"nil/null"; 123 | } else if([obj isKindOfClass:[NSValue class]] && ![obj isKindOfClass:[NSNumber class]]) { 124 | const char *type = [(NSValue *)obj _EXP_objCType]; 125 | if(type) { 126 | if(strcmp(type, @encode(SEL)) == 0) { 127 | return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector([obj pointerValue])]; 128 | } else if(strcmp(type, @encode(Class)) == 0) { 129 | return NSStringFromClass([obj pointerValue]); 130 | } 131 | } 132 | } 133 | NSString *description = [obj description]; 134 | if([obj isKindOfClass:[NSArray class]]) { 135 | NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]]; 136 | for(id o in obj) { 137 | [arr addObject:EXPDescribeObject(o)]; 138 | } 139 | description = [NSString stringWithFormat:@"(%@)", [arr componentsJoinedByString:@", "]]; 140 | } else if([obj isKindOfClass:[NSSet class]] || [obj isKindOfClass:[NSOrderedSet class]]) { 141 | NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]]; 142 | for(id o in obj) { 143 | [arr addObject:EXPDescribeObject(o)]; 144 | } 145 | description = [NSString stringWithFormat:@"{(%@)}", [arr componentsJoinedByString:@", "]]; 146 | } else if([obj isKindOfClass:[NSDictionary class]]) { 147 | NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]]; 148 | for(id k in obj) { 149 | id v = obj[k]; 150 | [arr addObject:[NSString stringWithFormat:@"%@ = %@;",EXPDescribeObject(k), EXPDescribeObject(v)]]; 151 | } 152 | description = [NSString stringWithFormat:@"{%@}", [arr componentsJoinedByString:@" "]]; 153 | } else if([obj isKindOfClass:[NSAttributedString class]]) { 154 | description = [obj string]; 155 | } else { 156 | description = [description stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]; 157 | } 158 | return description; 159 | } 160 | 161 | void EXP_prerequisite(EXPBoolBlock block) { 162 | [[[NSThread currentThread] threadDictionary][@"EXP_currentMatcher"] setPrerequisiteBlock:block]; 163 | } 164 | 165 | void EXP_match(EXPBoolBlock block) { 166 | [[[NSThread currentThread] threadDictionary][@"EXP_currentMatcher"] setMatchBlock:block]; 167 | } 168 | 169 | void EXP_failureMessageForTo(EXPStringBlock block) { 170 | [[[NSThread currentThread] threadDictionary][@"EXP_currentMatcher"] setFailureMessageForToBlock:block]; 171 | } 172 | 173 | void EXP_failureMessageForNotTo(EXPStringBlock block) { 174 | [[[NSThread currentThread] threadDictionary][@"EXP_currentMatcher"] setFailureMessageForNotToBlock:block]; 175 | } 176 | 177 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatcherHelpers.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | BOOL EXPIsValuePointer(NSValue *value); 4 | BOOL EXPIsNumberFloat(NSNumber *number); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatcherHelpers.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatcherHelpers.h" 2 | 3 | BOOL EXPIsValuePointer(NSValue *value) { 4 | return [value objCType][0] == @encode(void *)[0]; 5 | } 6 | 7 | BOOL EXPIsNumberFloat(NSNumber *number) { 8 | return strcmp([number objCType], @encode(float)) == 0; 9 | } 10 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beCloseToWithin, (id expected, id within)); 4 | EXPMatcherInterface(beCloseToWithin, (id expected, id within)); 5 | 6 | #define beCloseTo(expected) _beCloseToWithin(EXPObjectify((expected)), nil) 7 | #define beCloseToWithin(expected, range) _beCloseToWithin(EXPObjectify((expected)), EXPObjectify((range))) 8 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beCloseTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beCloseTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beCloseToWithin, (id expected, id within)) { 5 | prerequisite(^BOOL{ 6 | return [actual isKindOfClass:[NSNumber class]] && 7 | [expected isKindOfClass:[NSNumber class]] && 8 | ([within isKindOfClass:[NSNumber class]] || (within == nil)); 9 | }); 10 | 11 | match(^BOOL{ 12 | double actualValue = [actual doubleValue]; 13 | double expectedValue = [expected doubleValue]; 14 | 15 | if (within != nil) { 16 | double withinValue = [within doubleValue]; 17 | double lowerBound = expectedValue - withinValue; 18 | double upperBound = expectedValue + withinValue; 19 | return (actualValue >= lowerBound) && (actualValue <= upperBound); 20 | } else { 21 | double diff = fabs(actualValue - expectedValue); 22 | actualValue = fabs(actualValue); 23 | expectedValue = fabs(expectedValue); 24 | double largest = (expectedValue > actualValue) ? expectedValue : actualValue; 25 | return (diff <= largest * FLT_EPSILON); 26 | } 27 | }); 28 | 29 | failureMessageForTo(^NSString *{ 30 | if (within) { 31 | return [NSString stringWithFormat:@"expected %@ to be close to %@ within %@", 32 | EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)]; 33 | } else { 34 | return [NSString stringWithFormat:@"expected %@ to be close to %@", 35 | EXPDescribeObject(actual), EXPDescribeObject(expected)]; 36 | } 37 | }); 38 | 39 | failureMessageForNotTo(^NSString *{ 40 | if (within) { 41 | return [NSString stringWithFormat:@"expected %@ not to be close to %@ within %@", 42 | EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)]; 43 | } else { 44 | return [NSString stringWithFormat:@"expected %@ not to be close to %@", 45 | EXPDescribeObject(actual), EXPDescribeObject(expected)]; 46 | } 47 | }); 48 | } 49 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beFalsy.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beFalsy, (void)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beFalsy.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beFalsy.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(beFalsy, (void)) { 5 | match(^BOOL{ 6 | if([actual isKindOfClass:[NSNumber class]]) { 7 | return ![(NSNumber *)actual boolValue]; 8 | } else if([actual isKindOfClass:[NSValue class]]) { 9 | if(EXPIsValuePointer((NSValue *)actual)) { 10 | return ![(NSValue *)actual pointerValue]; 11 | } 12 | } 13 | return !actual; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: a falsy value, got: %@, which is truthy", EXPDescribeObject(actual)]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: a non-falsy value, got: %@, which is falsy", EXPDescribeObject(actual)]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beGreaterThan, (id expected)); 4 | EXPMatcherInterface(beGreaterThan, (id expected)); 5 | 6 | #define beGreaterThan(expected) _beGreaterThan(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThan.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beGreaterThan.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beGreaterThan, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] == NSOrderedDescending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beGreaterThanOrEqualTo, (id expected)); 4 | EXPMatcherInterface(beGreaterThanOrEqualTo, (id expected)); 5 | 6 | #define beGreaterThanOrEqualTo(expected) _beGreaterThanOrEqualTo(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beGreaterThanOrEqualTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beGreaterThanOrEqualTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beGreaterThanOrEqualTo, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] != NSOrderedAscending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beIdenticalTo, (void *expected)); 4 | EXPMatcherInterface(beIdenticalTo, (void *expected)); // to aid code completion 5 | 6 | #if __has_feature(objc_arc) 7 | #define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected) 8 | #else 9 | #define beIdenticalTo(expected) _beIdenticalTo(expected) 10 | #endif 11 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beIdenticalTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+equal.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beIdenticalTo, (void *expected)) { 5 | match(^BOOL{ 6 | if(actual == expected) { 7 | return YES; 8 | } else if([actual isKindOfClass:[NSValue class]] && EXPIsValuePointer((NSValue *)actual)) { 9 | if([(NSValue *)actual pointerValue] == expected) { 10 | return YES; 11 | } 12 | } 13 | return NO; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: <%p>, got: <%p>", expected, actual]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: not <%p>, got: <%p>", expected, actual]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)); 4 | EXPMatcherInterface(beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)); 5 | 6 | #define beInTheRangeOf(expectedLowerBound, expectedUpperBound) _beInTheRangeOf(EXPObjectify((expectedLowerBound)), EXPObjectify((expectedUpperBound))) 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beInTheRangeOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beInTheRangeOf.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | NSComparisonResult compareLowerBound = [expectedLowerBound compare: actual]; 8 | NSComparisonResult compareUpperBound = [expectedUpperBound compare: actual]; 9 | if (compareLowerBound == NSOrderedSame) { 10 | return YES; 11 | } 12 | if (compareUpperBound == NSOrderedSame) { 13 | return YES; 14 | } 15 | if ((compareLowerBound == NSOrderedAscending) && (compareUpperBound == NSOrderedDescending)) { 16 | return YES; 17 | } 18 | } 19 | return NO; 20 | }); 21 | 22 | failureMessageForTo(^NSString *{ 23 | return [NSString stringWithFormat:@"expected: %@ to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)]; 24 | }); 25 | 26 | failureMessageForNotTo(^NSString *{ 27 | return [NSString stringWithFormat:@"expected: %@ not to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)]; 28 | }); 29 | } 30 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beInstanceOf, (Class expected)); 4 | EXPMatcherInterface(beAnInstanceOf, (Class expected)); 5 | EXPMatcherInterface(beMemberOf, (Class expected)); 6 | EXPMatcherInterface(beAMemberOf, (Class expected)); 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beInstanceOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beInstanceOf.h" 2 | 3 | EXPMatcherImplementationBegin(beInstanceOf, (Class expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return !(actualIsNil || expectedIsNil); 9 | }); 10 | 11 | match(^BOOL{ 12 | return [actual isMemberOfClass:expected]; 13 | }); 14 | 15 | failureMessageForTo(^NSString *{ 16 | if(actualIsNil) return @"the actual value is nil/null"; 17 | if(expectedIsNil) return @"the expected value is nil/null"; 18 | return [NSString stringWithFormat:@"expected: an instance of %@, got: an instance of %@", [expected class], [actual class]]; 19 | }); 20 | 21 | failureMessageForNotTo(^NSString *{ 22 | if(actualIsNil) return @"the actual value is nil/null"; 23 | if(expectedIsNil) return @"the expected value is nil/null"; 24 | return [NSString stringWithFormat:@"expected: not an instance of %@, got: an instance of %@", [expected class], [actual class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beAnInstanceOf, beInstanceOf, (Class expected)); 30 | EXPMatcherAliasImplementation(beMemberOf, beInstanceOf, (Class expected)); 31 | EXPMatcherAliasImplementation(beAMemberOf, beInstanceOf, (Class expected)); 32 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beKindOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beKindOf, (Class expected)); 4 | EXPMatcherInterface(beAKindOf, (Class expected)); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beKindOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beKindOf.h" 2 | 3 | EXPMatcherImplementationBegin(beKindOf, (Class expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return !(actualIsNil || expectedIsNil); 9 | }); 10 | 11 | match(^BOOL{ 12 | return [actual isKindOfClass:expected]; 13 | }); 14 | 15 | failureMessageForTo(^NSString *{ 16 | if(actualIsNil) return @"the actual value is nil/null"; 17 | if(expectedIsNil) return @"the expected value is nil/null"; 18 | return [NSString stringWithFormat:@"expected: a kind of %@, got: an instance of %@, which is not a kind of %@", [expected class], [actual class], [expected class]]; 19 | }); 20 | 21 | failureMessageForNotTo(^NSString *{ 22 | if(actualIsNil) return @"the actual value is nil/null"; 23 | if(expectedIsNil) return @"the expected value is nil/null"; 24 | return [NSString stringWithFormat:@"expected: not a kind of %@, got: an instance of %@, which is a kind of %@", [expected class], [actual class], [expected class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beAKindOf, beKindOf, (Class expected)); 30 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThan.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beLessThan, (id expected)); 4 | EXPMatcherInterface(beLessThan, (id expected)); 5 | 6 | #define beLessThan(expected) _beLessThan(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThan.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beLessThan.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beLessThan, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] == NSOrderedAscending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_beLessThanOrEqualTo, (id expected)); 4 | EXPMatcherInterface(beLessThanOrEqualTo, (id expected)); 5 | 6 | #define beLessThanOrEqualTo(expected) _beLessThanOrEqualTo(EXPObjectify((expected))) 7 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beLessThanOrEqualTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beLessThanOrEqualTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_beLessThanOrEqualTo, (id expected)) { 5 | match(^BOOL{ 6 | if ([actual respondsToSelector:@selector(compare:)]) { 7 | return [actual compare:expected] != NSOrderedDescending; 8 | } 9 | return NO; 10 | }); 11 | 12 | failureMessageForTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: %@ to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 14 | }); 15 | 16 | failureMessageForNotTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: %@ not to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 18 | }); 19 | } 20 | EXPMatcherImplementationEnd -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beNil.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beNil, (void)); 4 | EXPMatcherInterface(beNull, (void)); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beNil.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beNil.h" 2 | 3 | EXPMatcherImplementationBegin(beNil, (void)) { 4 | match(^BOOL{ 5 | return actual == nil; 6 | }); 7 | 8 | failureMessageForTo(^NSString *{ 9 | return [NSString stringWithFormat:@"expected: nil/null, got: %@", EXPDescribeObject(actual)]; 10 | }); 11 | 12 | failureMessageForNotTo(^NSString *{ 13 | return [NSString stringWithFormat:@"expected: not nil/null, got: %@", EXPDescribeObject(actual)]; 14 | }); 15 | } 16 | EXPMatcherImplementationEnd 17 | 18 | EXPMatcherAliasImplementation(beNull, beNil, (void)); 19 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beSubclassOf, (Class expected)); 4 | EXPMatcherInterface(beASubclassOf, (Class expected)); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beSubclassOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beSubclassOf.h" 2 | #import "NSValue+Expecta.h" 3 | #import 4 | 5 | EXPMatcherImplementationBegin(beSubclassOf, (Class expected)) { 6 | __block BOOL actualIsClass = YES; 7 | 8 | prerequisite(^BOOL { 9 | actualIsClass = class_isMetaClass(object_getClass(actual)); 10 | return actualIsClass; 11 | }); 12 | 13 | match(^BOOL{ 14 | return [actual isSubclassOfClass:expected]; 15 | }); 16 | 17 | failureMessageForTo(^NSString *{ 18 | if(!actualIsClass) return @"the actual value is not a Class"; 19 | return [NSString stringWithFormat:@"expected: a subclass of %@, got: a class %@, which is not a subclass of %@", [expected class], actual, [expected class]]; 20 | }); 21 | 22 | failureMessageForNotTo(^NSString *{ 23 | if(!actualIsClass) return @"the actual value is not a Class"; 24 | return [NSString stringWithFormat:@"expected: not a subclass of %@, got: a class %@, which is a subclass of %@", [expected class], actual, [expected class]]; 25 | }); 26 | } 27 | EXPMatcherImplementationEnd 28 | 29 | EXPMatcherAliasImplementation(beASubclassOf, beSubclassOf, (Class expected)); 30 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beSupersetOf, (id subset)); 4 | 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beSupersetOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+contain.h" 2 | 3 | EXPMatcherImplementationBegin(beSupersetOf, (id subset)) { 4 | BOOL actualIsCompatible = [actual isKindOfClass:[NSDictionary class]] || [actual respondsToSelector:@selector(containsObject:)]; 5 | BOOL subsetIsNil = (subset == nil); 6 | 7 | // For some instances the isKindOfClass: method returns false, even though 8 | // they are both actually dictionaries. e.g. Comparing a NSCFDictionary and a 9 | // NSDictionary. 10 | // Or in cases when you compare NSMutableArray (which implementation is __NSArrayM:NSMutableArray:NSArray) 11 | // and NSArray (which implementation is __NSArrayI:NSArray) 12 | BOOL bothAreIdenticalCollectionClasses = ([actual isKindOfClass:[NSDictionary class]] && [subset isKindOfClass:[NSDictionary class]]) || 13 | ([actual isKindOfClass:[NSArray class]] && [subset isKindOfClass:[NSArray class]]) || 14 | ([actual isKindOfClass:[NSSet class]] && [subset isKindOfClass:[NSSet class]]) || 15 | ([actual isKindOfClass:[NSOrderedSet class]] && [subset isKindOfClass:[NSOrderedSet class]]); 16 | 17 | BOOL classMatches = bothAreIdenticalCollectionClasses || [subset isKindOfClass:[actual class]]; 18 | 19 | prerequisite(^BOOL{ 20 | return actualIsCompatible && !subsetIsNil && classMatches; 21 | }); 22 | 23 | match(^BOOL{ 24 | if(!actualIsCompatible) return NO; 25 | 26 | if([actual isKindOfClass:[NSDictionary class]]) { 27 | for (id key in subset) { 28 | id actualValue = [actual valueForKey:key]; 29 | id subsetValue = [subset valueForKey:key]; 30 | 31 | if (![subsetValue isEqual:actualValue]) return NO; 32 | } 33 | } else { 34 | for (id object in subset) { 35 | if (![actual containsObject:object]) return NO; 36 | } 37 | } 38 | 39 | return YES; 40 | }); 41 | 42 | failureMessageForTo(^NSString *{ 43 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)]; 44 | 45 | if(subsetIsNil) return @"the expected value is nil/null"; 46 | 47 | if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)]; 48 | 49 | return [NSString stringWithFormat:@"expected %@ to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)]; 50 | }); 51 | 52 | failureMessageForNotTo(^NSString *{ 53 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)]; 54 | 55 | if(subsetIsNil) return @"the expected value is nil/null"; 56 | 57 | if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)]; 58 | 59 | return [NSString stringWithFormat:@"expected %@ not to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)]; 60 | }); 61 | } 62 | EXPMatcherImplementationEnd 63 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beTruthy.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beTruthy, (void)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beTruthy.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beTruthy.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(beTruthy, (void)) { 5 | match(^BOOL{ 6 | if([actual isKindOfClass:[NSNumber class]]) { 7 | return !![(NSNumber *)actual boolValue]; 8 | } else if([actual isKindOfClass:[NSValue class]]) { 9 | if(EXPIsValuePointer((NSValue *)actual)) { 10 | return !![(NSValue *)actual pointerValue]; 11 | } 12 | } 13 | return !!actual; 14 | }); 15 | 16 | failureMessageForTo(^NSString *{ 17 | return [NSString stringWithFormat:@"expected: a truthy value, got: %@, which is falsy", EXPDescribeObject(actual)]; 18 | }); 19 | 20 | failureMessageForNotTo(^NSString *{ 21 | return [NSString stringWithFormat:@"expected: a non-truthy value, got: %@, which is truthy", EXPDescribeObject(actual)]; 22 | }); 23 | } 24 | EXPMatcherImplementationEnd 25 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beginWith.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(beginWith, (id expected)); 4 | EXPMatcherInterface(startWith, (id expected)); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+beginWith.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beginWith.h" 2 | 3 | EXPMatcherImplementationBegin(beginWith, (id expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | //This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same 7 | BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]]) 8 | || ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]]) 9 | || ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]])); 10 | 11 | prerequisite(^BOOL { 12 | return actualAndExpectedAreCompatible; 13 | }); 14 | 15 | match(^BOOL { 16 | if ([actual isKindOfClass:[NSString class]]) { 17 | return [actual hasPrefix:expected]; 18 | } else if ([actual isKindOfClass:[NSArray class]]) { 19 | if ([expected count] > [actual count] || [expected count] == 0) { 20 | return NO; 21 | } 22 | NSArray *subArray = [actual subarrayWithRange:NSMakeRange(0, [expected count])]; 23 | return [subArray isEqualToArray:expected]; 24 | } else { 25 | if ([expected count] > [actual count] || [expected count] == 0) { 26 | return NO; 27 | } 28 | 29 | NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange(0, [expected count]) copyItems:NO]; 30 | return [subset isEqualToOrderedSet:expected]; 31 | } 32 | }); 33 | 34 | failureMessageForTo(^NSString *{ 35 | if (actualIsNil) return @"the object is nil/null"; 36 | if (expectedIsNil) return @"the expected value is nil/null"; 37 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 38 | return [NSString stringWithFormat:@"expected: %@ to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 39 | }); 40 | 41 | failureMessageForNotTo(^NSString *{ 42 | if (actualIsNil) return @"the object is nil/null"; 43 | if (expectedIsNil) return @"the expected value is nil/null"; 44 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 45 | 46 | return [NSString stringWithFormat:@"expected: %@ not to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 47 | }); 48 | } 49 | EXPMatcherImplementationEnd 50 | 51 | EXPMatcherAliasImplementation(startWith, beginWith, (id expected)); 52 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+conformTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(conformTo, (Protocol *expected)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+conformTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+conformTo.h" 2 | #import "NSValue+Expecta.h" 3 | #import 4 | 5 | EXPMatcherImplementationBegin(conformTo, (Protocol *expected)) { 6 | BOOL actualIsNil = (actual == nil); 7 | BOOL expectedIsNil = (expected == nil); 8 | 9 | prerequisite(^BOOL{ 10 | return !(actualIsNil || expectedIsNil); 11 | }); 12 | 13 | match(^BOOL{ 14 | return [actual conformsToProtocol:expected]; 15 | }); 16 | 17 | failureMessageForTo(^NSString *{ 18 | if(actualIsNil) return @"the object is nil/null"; 19 | if(expectedIsNil) return @"the protocol is nil/null"; 20 | 21 | NSString *name = NSStringFromProtocol(expected); 22 | return [NSString stringWithFormat:@"expected: %@ to conform to %@", actual, name]; 23 | }); 24 | 25 | failureMessageForNotTo(^NSString *{ 26 | if(actualIsNil) return @"the object is nil/null"; 27 | if(expectedIsNil) return @"the protocol is nil/null"; 28 | 29 | NSString *name = NSStringFromProtocol(expected); 30 | return [NSString stringWithFormat:@"expected: %@ not to conform to %@", actual, name]; 31 | }); 32 | } 33 | EXPMatcherImplementationEnd 34 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+contain.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_contain, (id expected)); 4 | EXPMatcherInterface(contain, (id expected)); // to aid code completion 5 | #define contain(expected) _contain(EXPObjectify((expected))) 6 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+contain.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+contain.h" 2 | 3 | EXPMatcherImplementationBegin(_contain, (id expected)) { 4 | BOOL actualIsCompatible = [actual isKindOfClass:[NSString class]] || [actual conformsToProtocol:@protocol(NSFastEnumeration)]; 5 | BOOL expectedIsNil = (expected == nil); 6 | 7 | prerequisite(^BOOL{ 8 | return actualIsCompatible && !expectedIsNil; 9 | }); 10 | 11 | match(^BOOL{ 12 | if(actualIsCompatible) { 13 | if([actual isKindOfClass:[NSString class]]) { 14 | return [(NSString *)actual rangeOfString:[expected description]].location != NSNotFound; 15 | } else { 16 | for (id object in actual) { 17 | if ([object isEqual:expected]) { 18 | return YES; 19 | } 20 | } 21 | } 22 | } 23 | return NO; 24 | }); 25 | 26 | failureMessageForTo(^NSString *{ 27 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)]; 28 | if(expectedIsNil) return @"the expected value is nil/null"; 29 | return [NSString stringWithFormat:@"expected %@ to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 30 | }); 31 | 32 | failureMessageForNotTo(^NSString *{ 33 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)]; 34 | if(expectedIsNil) return @"the expected value is nil/null"; 35 | return [NSString stringWithFormat:@"expected %@ not to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+endWith.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(endWith, (id expected)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+endWith.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+endWith.h" 2 | 3 | EXPMatcherImplementationBegin(endWith, (id expected)) { 4 | BOOL actualIsNil = (actual == nil); 5 | BOOL expectedIsNil = (expected == nil); 6 | //This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same 7 | BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]]) 8 | || ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]]) 9 | || ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]])); 10 | 11 | prerequisite(^BOOL { 12 | return actualAndExpectedAreCompatible; 13 | }); 14 | 15 | match(^BOOL { 16 | if ([actual isKindOfClass:[NSString class]]) { 17 | return [actual hasSuffix:expected]; 18 | } else if ([actual isKindOfClass:[NSArray class]]) { 19 | if ([expected count] > [actual count] || [expected count] == 0) { 20 | return NO; 21 | } 22 | NSArray *subArray = [actual subarrayWithRange:NSMakeRange([actual count] - [expected count], [expected count])]; 23 | return [subArray isEqualToArray:expected]; 24 | } else { 25 | if ([expected count] > [actual count] || [expected count] == 0) { 26 | return NO; 27 | } 28 | 29 | NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange([actual count] - [expected count], [expected count]) copyItems:NO]; 30 | return [subset isEqualToOrderedSet:expected]; 31 | } 32 | }); 33 | 34 | failureMessageForTo(^NSString *{ 35 | if (actualIsNil) return @"the object is nil/null"; 36 | if (expectedIsNil) return @"the expected value is nil/null"; 37 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 38 | return [NSString stringWithFormat:@"expected: %@ to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 39 | }); 40 | 41 | failureMessageForNotTo(^NSString *{ 42 | if (actualIsNil) return @"the object is nil/null"; 43 | if (expectedIsNil) return @"the expected value is nil/null"; 44 | if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; 45 | 46 | return [NSString stringWithFormat:@"expected: %@ not to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; 47 | }); 48 | } 49 | EXPMatcherImplementationEnd 50 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+equal.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(_equal, (id expected)); 4 | EXPMatcherInterface(equal, (id expected)); // to aid code completion 5 | #define equal(...) _equal(EXPObjectify((__VA_ARGS__))) 6 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+equal.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+equal.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(_equal, (id expected)) { 5 | match(^BOOL{ 6 | if((actual == expected) || [actual isEqual:expected]) { 7 | return YES; 8 | } else if([actual isKindOfClass:[NSNumber class]] && [expected isKindOfClass:[NSNumber class]]) { 9 | if([actual isKindOfClass:[NSDecimalNumber class]] || [expected isKindOfClass:[NSDecimalNumber class]]) { 10 | NSDecimalNumber *actualDecimalNumber = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *) actual decimalValue]]; 11 | NSDecimalNumber *expectedDecimalNumber = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *) expected decimalValue]]; 12 | return [actualDecimalNumber isEqualToNumber:expectedDecimalNumber]; 13 | } 14 | else { 15 | if(EXPIsNumberFloat((NSNumber *)actual) || EXPIsNumberFloat((NSNumber *)expected)) { 16 | return [(NSNumber *)actual floatValue] == [(NSNumber *)expected floatValue]; 17 | } 18 | } 19 | } 20 | return NO; 21 | }); 22 | 23 | failureMessageForTo(^NSString *{ 24 | NSString *expectedDescription = EXPDescribeObject(expected); 25 | NSString *actualDescription = EXPDescribeObject(actual); 26 | 27 | if (![expectedDescription isEqualToString:actualDescription]) { 28 | return [NSString stringWithFormat:@"expected: %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)]; 29 | } else { 30 | return [NSString stringWithFormat:@"expected (%@): %@, got (%@): %@", NSStringFromClass([expected class]), EXPDescribeObject(expected), NSStringFromClass([actual class]), EXPDescribeObject(actual)]; 31 | } 32 | }); 33 | 34 | failureMessageForNotTo(^NSString *{ 35 | return [NSString stringWithFormat:@"expected: not %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(haveCountOf, (NSUInteger expected)); 4 | EXPMatcherInterface(haveCount, (NSUInteger expected)); 5 | EXPMatcherInterface(haveACountOf, (NSUInteger expected)); 6 | EXPMatcherInterface(haveLength, (NSUInteger expected)); 7 | EXPMatcherInterface(haveLengthOf, (NSUInteger expected)); 8 | EXPMatcherInterface(haveALengthOf, (NSUInteger expected)); 9 | 10 | #define beEmpty() haveCountOf(0) 11 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+haveCountOf.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+haveCountOf.h" 2 | 3 | EXPMatcherImplementationBegin(haveCountOf, (NSUInteger expected)) { 4 | BOOL actualIsStringy = [actual isKindOfClass:[NSString class]] || [actual isKindOfClass:[NSAttributedString class]]; 5 | BOOL actualIsCompatible = actualIsStringy || [actual respondsToSelector:@selector(count)]; 6 | 7 | prerequisite(^BOOL{ 8 | return actualIsCompatible; 9 | }); 10 | 11 | NSUInteger (^count)(id) = ^(id actual) { 12 | if(actualIsStringy) { 13 | return [actual length]; 14 | } else { 15 | return [actual count]; 16 | } 17 | }; 18 | 19 | match(^BOOL{ 20 | if(actualIsCompatible) { 21 | return count(actual) == expected; 22 | } 23 | return NO; 24 | }); 25 | 26 | failureMessageForTo(^NSString *{ 27 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)]; 28 | return [NSString stringWithFormat:@"expected %@ to have a count of %zi but got %zi", EXPDescribeObject(actual), expected, count(actual)]; 29 | }); 30 | 31 | failureMessageForNotTo(^NSString *{ 32 | if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)]; 33 | return [NSString stringWithFormat:@"expected %@ not to have a count of %zi", EXPDescribeObject(actual), expected]; 34 | }); 35 | } 36 | EXPMatcherImplementationEnd 37 | 38 | EXPMatcherAliasImplementation(haveCount, haveCountOf, (NSUInteger expected)); 39 | EXPMatcherAliasImplementation(haveACountOf, haveCountOf, (NSUInteger expected)); 40 | EXPMatcherAliasImplementation(haveLength, haveCountOf, (NSUInteger expected)); 41 | EXPMatcherAliasImplementation(haveLengthOf, haveCountOf, (NSUInteger expected)); 42 | EXPMatcherAliasImplementation(haveALengthOf, haveCountOf, (NSUInteger expected)); 43 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+match.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(match, (NSString *expected)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+match.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+match.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(match, (NSString *expected)) { 5 | BOOL actualIsNil = (actual == nil); 6 | BOOL expectedIsNil = (expected == nil); 7 | 8 | __block NSRegularExpression *regex = nil; 9 | __block NSError *regexError = nil; 10 | 11 | prerequisite (^BOOL { 12 | BOOL nilInput = (actualIsNil || expectedIsNil); 13 | if (!nilInput) { 14 | regex = [NSRegularExpression regularExpressionWithPattern:expected options:0 error:®exError]; 15 | } 16 | return !nilInput && regex; 17 | }); 18 | 19 | match(^BOOL { 20 | NSRange range = [regex rangeOfFirstMatchInString:actual options:0 range:NSMakeRange(0, [actual length])]; 21 | return !NSEqualRanges(range, NSMakeRange(NSNotFound, 0)); 22 | }); 23 | 24 | failureMessageForTo(^NSString *{ 25 | if (actualIsNil) return @"the object is nil/null"; 26 | if (expectedIsNil) return @"the expression is nil/null"; 27 | if (regexError) return [NSString stringWithFormat:@"unable to create regular expression from given parameter: %@", [regexError localizedDescription]]; 28 | return [NSString stringWithFormat:@"expected: %@ to match to %@", EXPDescribeObject(actual), expected]; 29 | }); 30 | 31 | failureMessageForNotTo(^NSString *{ 32 | if (actualIsNil) return @"the object is nil/null"; 33 | if (expectedIsNil) return @"the expression is nil/null"; 34 | if (regexError) return [NSString stringWithFormat:@"unable to create regular expression from given parameter: %@", [regexError localizedDescription]]; 35 | return [NSString stringWithFormat:@"expected: %@ not to match to %@", EXPDescribeObject(actual), expected]; 36 | }); 37 | } 38 | EXPMatcherImplementationEnd 39 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+postNotification.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(postNotification, (id expectedNotification)); 4 | EXPMatcherInterface(notify, (id expectedNotification)); 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+postNotification.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+postNotification.h" 2 | 3 | @implementation NSNotification (EXPEquality) 4 | 5 | - (BOOL)exp_isFunctionallyEqualTo:(NSNotification *)otherNotification 6 | { 7 | if (![otherNotification isKindOfClass:[NSNotification class]]) return NO; 8 | 9 | BOOL namesMatch = [otherNotification.name isEqualToString:self.name]; 10 | 11 | BOOL objectsMatch = YES; 12 | if (otherNotification.object || self.object) { 13 | objectsMatch = [otherNotification.object isEqual:self.object]; 14 | } 15 | 16 | BOOL userInfoMatches = YES; 17 | if (otherNotification.userInfo || self.userInfo) { 18 | userInfoMatches = [otherNotification.userInfo isEqual:self.userInfo]; 19 | } 20 | 21 | return (namesMatch && objectsMatch && userInfoMatches); 22 | } 23 | 24 | @end 25 | 26 | EXPMatcherImplementationBegin(postNotification, (id expected)){ 27 | BOOL actualIsNil = (actual == nil); 28 | BOOL expectedIsNil = (expected == nil); 29 | BOOL isNotification = [expected isKindOfClass:[NSNotification class]]; 30 | BOOL isName = [expected isKindOfClass:[NSString class]]; 31 | 32 | __block NSString *expectedName; 33 | __block BOOL expectedNotificationOccurred = NO; 34 | __block id observer; 35 | 36 | prerequisite(^BOOL{ 37 | expectedNotificationOccurred = NO; 38 | if (actualIsNil || expectedIsNil) return NO; 39 | if (isNotification) { 40 | expectedName = [expected name]; 41 | }else if(isName) { 42 | expectedName = expected; 43 | }else{ 44 | return NO; 45 | } 46 | 47 | observer = [[NSNotificationCenter defaultCenter] addObserverForName:expectedName object:nil queue:nil usingBlock:^(NSNotification *note){ 48 | if (isNotification) { 49 | expectedNotificationOccurred |= [expected exp_isFunctionallyEqualTo:note]; 50 | }else{ 51 | expectedNotificationOccurred = YES; 52 | } 53 | }]; 54 | ((EXPBasicBlock)actual)(); 55 | return YES; 56 | }); 57 | 58 | match(^BOOL{ 59 | if(expectedNotificationOccurred) { 60 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 61 | } 62 | return expectedNotificationOccurred; 63 | }); 64 | 65 | failureMessageForTo(^NSString *{ 66 | if (observer) { 67 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 68 | } 69 | if(actualIsNil) return @"the actual value is nil/null"; 70 | if(expectedIsNil) return @"the expected value is nil/null"; 71 | if(!(isNotification || isName)) return @"the actual value is not a notification or string"; 72 | return [NSString stringWithFormat:@"expected: %@, got: none",expectedName]; 73 | }); 74 | 75 | failureMessageForNotTo(^NSString *{ 76 | if (observer) { 77 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 78 | } 79 | if(actualIsNil) return @"the actual value is nil/null"; 80 | if(expectedIsNil) return @"the expected value is nil/null"; 81 | if(!(isNotification || isName)) return @"the actual value is not a notification or string"; 82 | return [NSString stringWithFormat:@"expected: none, got: %@", expectedName]; 83 | }); 84 | } 85 | 86 | EXPMatcherImplementationEnd 87 | 88 | EXPMatcherAliasImplementation(notify, postNotification, (id expectedNotification)) 89 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+raise.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(raise, (NSString *expectedExceptionName)); 4 | #define raiseAny() raise(nil) 5 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+raise.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+raise.h" 2 | #import "EXPDefines.h" 3 | 4 | EXPMatcherImplementationBegin(raise, (NSString *expectedExceptionName)) { 5 | __block NSException *exceptionCaught = nil; 6 | 7 | match(^BOOL{ 8 | BOOL expectedExceptionCaught = NO; 9 | @try { 10 | ((EXPBasicBlock)actual)(); 11 | } @catch(NSException *e) { 12 | exceptionCaught = e; 13 | expectedExceptionCaught = (expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]; 14 | } 15 | return expectedExceptionCaught; 16 | }); 17 | 18 | failureMessageForTo(^NSString *{ 19 | return [NSString stringWithFormat:@"expected: %@, got: %@", 20 | expectedExceptionName ? expectedExceptionName : @"any exception", 21 | exceptionCaught ? [exceptionCaught name] : @"no exception"]; 22 | }); 23 | 24 | failureMessageForNotTo(^NSString *{ 25 | return [NSString stringWithFormat:@"expected: %@, got: %@", 26 | expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception", 27 | exceptionCaught ? [exceptionCaught name] : @"no exception"]; 28 | }); 29 | } 30 | EXPMatcherImplementationEnd 31 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+raiseWithReason.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+raiseWithReason.h" 2 | #import "EXPDefines.h" 3 | 4 | EXPMatcherImplementationBegin(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)) { 5 | __block NSException *exceptionCaught = nil; 6 | 7 | match(^BOOL{ 8 | BOOL expectedExceptionCaught = NO; 9 | @try { 10 | ((EXPBasicBlock)actual)(); 11 | } @catch(NSException *e) { 12 | exceptionCaught = e; 13 | expectedExceptionCaught = (((expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]) && 14 | ((expectedReason == nil) || ([[exceptionCaught reason] isEqualToString:expectedReason]))); 15 | } 16 | return expectedExceptionCaught; 17 | }); 18 | 19 | failureMessageForTo(^NSString *{ 20 | return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", 21 | expectedExceptionName ?: @"any exception", 22 | expectedReason ?: @"any reason", 23 | exceptionCaught ? [exceptionCaught name] : @"no exception", 24 | exceptionCaught ? [exceptionCaught reason] : @""]; 25 | }); 26 | 27 | failureMessageForNotTo(^NSString *{ 28 | return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", 29 | expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception", 30 | expectedReason ? [NSString stringWithFormat:@"not '%@'", expectedReason] : @"no reason", 31 | exceptionCaught ? [exceptionCaught name] : @"no exception", 32 | exceptionCaught ? [exceptionCaught reason] : @"no reason"]; 33 | }); 34 | } 35 | EXPMatcherImplementationEnd 36 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+respondTo.h: -------------------------------------------------------------------------------- 1 | #import "Expecta.h" 2 | 3 | EXPMatcherInterface(respondTo, (SEL expected)); 4 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers+respondTo.m: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+respondTo.h" 2 | #import "EXPMatcherHelpers.h" 3 | 4 | EXPMatcherImplementationBegin(respondTo, (SEL expected)) { 5 | BOOL actualIsNil = (actual == nil); 6 | BOOL expectedIsNull = (expected == NULL); 7 | 8 | prerequisite (^BOOL { 9 | return !(actualIsNil || expectedIsNull); 10 | }); 11 | 12 | match(^BOOL { 13 | if ([actual respondsToSelector:@selector(instancesRespondToSelector:)] && 14 | [actual instancesRespondToSelector:expected]) { 15 | return YES; 16 | } 17 | return [actual respondsToSelector:expected]; 18 | }); 19 | 20 | failureMessageForTo(^NSString *{ 21 | if (actualIsNil) return @"the object is nil/null"; 22 | if (expectedIsNull) return @"the selector is null"; 23 | return [NSString stringWithFormat:@"expected: %@ to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)]; 24 | }); 25 | 26 | failureMessageForNotTo(^NSString *{ 27 | if (actualIsNil) return @"the object is nil/null"; 28 | if (expectedIsNull) return @"the selector is null"; 29 | return [NSString stringWithFormat:@"expected: %@ not to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)]; 30 | }); 31 | } 32 | EXPMatcherImplementationEnd 33 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/Matchers/EXPMatchers.h: -------------------------------------------------------------------------------- 1 | #import "EXPMatchers+beNil.h" 2 | #import "EXPMatchers+equal.h" 3 | #import "EXPMatchers+beInstanceOf.h" 4 | #import "EXPMatchers+beKindOf.h" 5 | #import "EXPMatchers+beSubclassOf.h" 6 | #import "EXPMatchers+conformTo.h" 7 | #import "EXPMatchers+beTruthy.h" 8 | #import "EXPMatchers+beFalsy.h" 9 | #import "EXPMatchers+contain.h" 10 | #import "EXPMatchers+beSupersetOf.h" 11 | #import "EXPMatchers+haveCountOf.h" 12 | #import "EXPMatchers+beIdenticalTo.h" 13 | #import "EXPMatchers+beGreaterThan.h" 14 | #import "EXPMatchers+beGreaterThanOrEqualTo.h" 15 | #import "EXPMatchers+beLessThan.h" 16 | #import "EXPMatchers+beLessThanOrEqualTo.h" 17 | #import "EXPMatchers+beInTheRangeOf.h" 18 | #import "EXPMatchers+beCloseTo.h" 19 | #import "EXPMatchers+raise.h" 20 | #import "EXPMatchers+raiseWithReason.h" 21 | #import "EXPMatchers+respondTo.h" 22 | #import "EXPMatchers+postNotification.h" 23 | #import "EXPMatchers+beginWith.h" 24 | #import "EXPMatchers+endWith.h" 25 | #import "EXPMatchers+match.h" 26 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/NSObject+Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSObject (Expecta) 4 | 5 | - (void)recordFailureWithDescription:(NSString *)description 6 | inFile:(NSString *)filename 7 | atLine:(NSUInteger)lineNumber 8 | expected:(BOOL)expected; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/NSValue+Expecta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSValue (Expecta) 4 | 5 | @property (nonatomic) const char *_EXP_objCType; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/Expecta/NSValue+Expecta.m: -------------------------------------------------------------------------------- 1 | #import "NSValue+Expecta.h" 2 | #import 3 | #import "Expecta.h" 4 | 5 | EXPFixCategoriesBug(NSValue_Expecta); 6 | 7 | @implementation NSValue (Expecta) 8 | 9 | static char _EXP_typeKey; 10 | 11 | - (const char *)_EXP_objCType { 12 | return [(NSString *)objc_getAssociatedObject(self, &_EXP_typeKey) cStringUsingEncoding:NSASCIIStringEncoding]; 13 | } 14 | 15 | - (void)set_EXP_objCType:(const char *)_EXP_objCType { 16 | objc_setAssociatedObject(self, &_EXP_typeKey, 17 | @(_EXP_objCType), 18 | OBJC_ASSOCIATION_COPY_NONATOMIC); 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/Pods/Expecta/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/GHApplicationMediator.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GHApplicationMediator", 3 | "version": "0.1.0", 4 | "summary": "A short description of GHApplicationMediator.", 5 | "description": "TODO: Add long description of the pod here.", 6 | "homepage": "https://github.com/ginhoor/GHApplicationMediator", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "ginhoor": "ginhoor@gmail.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/ginhoor/GHApplicationMediator.git", 16 | "tag": "0.1.0" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "GHApplicationMediator/Classes/**/*" 22 | } 23 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Expecta (1.0.6) 3 | - GHApplicationMediator (0.1.0) 4 | - Specta (1.0.7) 5 | 6 | DEPENDENCIES: 7 | - Expecta 8 | - GHApplicationMediator (from `../`) 9 | - Specta 10 | 11 | SPEC REPOS: 12 | https://github.com/cocoapods/specs.git: 13 | - Expecta 14 | - Specta 15 | 16 | EXTERNAL SOURCES: 17 | GHApplicationMediator: 18 | :path: "../" 19 | 20 | SPEC CHECKSUMS: 21 | Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5 22 | GHApplicationMediator: d71428f10f1212f7533c5d1bab7d54fe3f08b6c3 23 | Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 24 | 25 | PODFILE CHECKSUM: d0fc96c34780fbef0eed138097fb818dd1b3c7a9 26 | 27 | COCOAPODS: 1.6.0 28 | -------------------------------------------------------------------------------- /Example/Pods/Specta/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2014 Specta Team. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /Example/Pods/Specta/README.md: -------------------------------------------------------------------------------- 1 | # Specta [![Build Status](https://travis-ci.org/specta/specta.svg)](https://travis-ci.org/specta/specta) [![Coverage Status](https://coveralls.io/repos/specta/specta/badge.svg)](https://coveralls.io/r/specta/specta) 2 | 3 | A light-weight TDD / BDD framework for Objective-C. 4 | 5 | ## FEATURES 6 | 7 | * An Objective-C RSpec-like BDD DSL 8 | * Quick and easy set up 9 | * Built on top of XCTest 10 | * Excellent Xcode integration 11 | 12 | ## SCREENSHOT 13 | 14 | 15 | 16 | ## EXAMPLE 17 | 18 | ```objective-c 19 | #import // #import "Specta.h" if you're using libSpecta.a 20 | 21 | SharedExamplesBegin(MySharedExamples) 22 | // Global shared examples are shared across all spec files. 23 | 24 | sharedExamplesFor(@"foo", ^(NSDictionary *data) { 25 | __block id bar = nil; 26 | beforeEach(^{ 27 | bar = data[@"bar"]; 28 | }); 29 | it(@"should not be nil", ^{ 30 | XCTAssertNotNil(bar); 31 | }); 32 | }); 33 | 34 | SharedExamplesEnd 35 | 36 | SpecBegin(Thing) 37 | 38 | describe(@"Thing", ^{ 39 | sharedExamplesFor(@"another shared behavior", ^(NSDictionary *data) { 40 | // Locally defined shared examples can override global shared examples within its scope. 41 | }); 42 | 43 | beforeAll(^{ 44 | // This is run once and only once before all of the examples 45 | // in this group and before any beforeEach blocks. 46 | }); 47 | 48 | beforeEach(^{ 49 | // This is run before each example. 50 | }); 51 | 52 | it(@"should do stuff", ^{ 53 | // This is an example block. Place your assertions here. 54 | }); 55 | 56 | it(@"should do some stuff asynchronously", ^{ 57 | waitUntil(^(DoneCallback done) { 58 | // Async example blocks need to invoke done() callback. 59 | done(); 60 | }); 61 | }); 62 | 63 | itShouldBehaveLike(@"a shared behavior", @{@"key" : @"obj"}); 64 | 65 | itShouldBehaveLike(@"another shared behavior", ^{ 66 | // Use a block that returns a dictionary if you need the context to be evaluated lazily, 67 | // e.g. to use an object prepared in a beforeEach block. 68 | return @{@"key" : @"obj"}; 69 | }); 70 | 71 | describe(@"Nested examples", ^{ 72 | it(@"should do even more stuff", ^{ 73 | // ... 74 | }); 75 | }); 76 | 77 | pending(@"pending example"); 78 | 79 | pending(@"another pending example", ^{ 80 | // ... 81 | }); 82 | 83 | afterEach(^{ 84 | // This is run after each example. 85 | }); 86 | 87 | afterAll(^{ 88 | // This is run once and only once after all of the examples 89 | // in this group and after any afterEach blocks. 90 | }); 91 | }); 92 | 93 | SpecEnd 94 | ``` 95 | 96 | * `beforeEach` and `afterEach` are also aliased as `before` and `after` respectively. 97 | * `describe` is also aliased as `context`. 98 | * `it` is also aliased as `example` and `specify`. 99 | * `itShouldBehaveLike` is also aliased as `itBehavesLike`. 100 | * Use `pending` or prepend `x` to `describe`, `context`, `example`, `it`, and `specify` to mark examples or groups as pending. 101 | * Use `^(DoneCallback done)` as shown in the example above to make examples wait for completion. `done()` callback needs to be invoked to let Specta know that your test is complete. The default timeout is 10.0 seconds but this can be changed by calling the function `setAsyncSpecTimeout(NSTimeInterval timeout)`. 102 | * `(before|after)(Each/All)` also accept `^(DoneCallback done)`s. 103 | * Do `#define SPT_CEDAR_SYNTAX` before importing Specta if you prefer to write `SPEC_BEGIN` and `SPEC_END` instead of `SpecBegin` and `SpecEnd`. 104 | * Prepend `f` to your `describe`, `context`, `example`, `it`, and `specify` to set focus on examples or groups. When specs are focused, all unfocused specs are skipped. 105 | * To use original XCTest reporter, set an environment variable named `SPECTA_REPORTER_CLASS` to `SPTXCTestReporter` in your test scheme. 106 | * Set an environment variable `SPECTA_SHUFFLE` with value `1` to enable test shuffling. 107 | * Set an environment variable `SPECTA_SEED` to specify the random seed for test shuffling. 108 | 109 | Standard XCTest matchers such as `XCTAssertEqualObjects` and `XCTAssertNil` work, but you probably want to add a nicer matcher framework - [Expecta](https://github.com/specta/expecta/) to your setup. Or if you really prefer, [OCHamcrest](https://github.com/hamcrest/OCHamcrest) works fine too. Also, add a mocking framework: [OCMock](http://ocmock.org/). 110 | 111 | ## STATUS 112 | 113 | Specta is considered a done project, there are no plans for _active_ development on the project at the moment aside from ensuring future Xcode compatability. 114 | Therefore it is a stable dependency, but will not be moving into the Swift world. If you are looking for that, we recommend you consider [Quick](https://github.com/quick/quick). 115 | 116 | ## RUNNING SPECTA'S TESTS IN COMMAND LINE 117 | 118 | * Run `rake test` in the cloned folder. 119 | 120 | ## CONTRIBUTION GUIDELINES 121 | 122 | * Please use only spaces and indent 2 spaces at a time. 123 | * Please prefix instance variable names with a single underscore (`_`). 124 | * Please prefix custom classes and functions defined in the global scope with `SPT`. 125 | 126 | ## Installation 127 | 128 | Use [CocoaPods](https://github.com/CocoaPods/CocoaPods), [Carthage](https://github.com/carthage/carthage) or [Set up manually](#setting-up-manually) 129 | 130 | ### CocoaPods 131 | 132 | 1. Add Specta to your project's `Podfile`: 133 | 134 | ```ruby 135 | target :MyApp do 136 | # your app dependencies 137 | 138 | target :MyAppTests do 139 | inherit! :search_paths 140 | 141 | pod 'Specta', '~> 1.0' 142 | # pod 'Expecta', '~> 1.0' # expecta matchers 143 | # pod 'OCMock', '~> 2.2' # OCMock 144 | # pod 'OCHamcrest', '~> 3.0' # hamcrest matchers 145 | # pod 'OCMockito', '~> 1.0' # OCMock 146 | # pod 'LRMocky', '~> 0.9' # LRMocky 147 | end 148 | end 149 | ``` 150 | 151 | 2. Run `pod install` in your project directory. 152 | 153 | ### Carthage 154 | 155 | 1. Add Specta to your project's `Cartfile.private` 156 | 157 | ``` 158 | github "specta/specta" ~> 1.0 159 | ``` 160 | 161 | 2. Run `carthage update` in your project directory 162 | 3. Drag the appropriate `Specta.framework` for your platform (located in Carthage/Build/) into your application’s Xcode project, and add it to your test target(s). 163 | 4. If you are building for iOS, a new `Run Script Phase` must be added to copy the framework. The instructions can be found on [Carthage's getting started instructions](https://github.com/carthage/carthage#getting-started) 164 | 165 | ### SETTING UP MANUALLY 166 | 167 | 1. Clone from Github. 168 | 2. Run `rake` in project root to build. 169 | 3. Add a "Cocoa/Cocoa Touch Unit Testing Bundle" target if you don't already have one. 170 | 4. Copy and add all header files in `Products` folder to the Test target in your Xcode project. 171 | 5. For **OS X projects**, copy and add `Specta.framework` in `Products/osx` folder to the test target in your Xcode project. 172 | For **iOS projects**, copy and add `Specta.framework` in `Products/ios` folder to the test target in your Xcode project. 173 | You can alternatively use `libSpecta.a`, if you prefer to add it as a static library for your project. (iOS 7 and below require this) 174 | 6. Add `-ObjC` and `-all_load` to the "Other Linker Flags" build setting for the test target in your Xcode project. 175 | 7. If you encounter linking issues with `_llvm_*` symbols, ensure your target's "Generate Test Coverage Files" and "Instrument Program Flow" build settings are set to `Yes`. 176 | 177 | ## LICENSE 178 | 179 | Copyright (c) 2012-2016 [Specta Team](https://github.com/orgs/specta/people). This software is licensed under the [MIT License](http://github.com/specta/specta/raw/master/LICENSE). 180 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTCallSite.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface SPTCallSite : NSObject 4 | 5 | @property (nonatomic, copy, readonly) NSString *file; 6 | @property (nonatomic, readonly) NSUInteger line; 7 | 8 | + (instancetype)callSiteWithFile:(NSString *)file line:(NSUInteger)line; 9 | 10 | - (instancetype)initWithFile:(NSString *)file line:(NSUInteger)line; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTCallSite.m: -------------------------------------------------------------------------------- 1 | #import "SPTCallSite.h" 2 | 3 | @implementation SPTCallSite 4 | 5 | + (instancetype)callSiteWithFile:(NSString *)file line:(NSUInteger)line { 6 | return [[self alloc] initWithFile:file line:line]; 7 | } 8 | 9 | - (instancetype)initWithFile:(NSString *)file line:(NSUInteger)line { 10 | self = [super init]; 11 | if (self) { 12 | _file = file; 13 | _line = line; 14 | } 15 | return self; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTCompiledExample.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "SpectaTypes.h" 3 | 4 | @interface SPTCompiledExample : NSObject 5 | 6 | @property (nonatomic, copy) NSString *name; 7 | @property (nonatomic, copy) NSString *testCaseName; 8 | @property (nonatomic, copy) SPTSpecBlock block; 9 | 10 | @property (nonatomic) BOOL pending; 11 | @property (nonatomic, getter=isFocused) BOOL focused; 12 | 13 | @property (nonatomic) SEL testMethodSelector; 14 | 15 | - (id)initWithName:(NSString *)name testCaseName:(NSString *)testCaseName block:(SPTSpecBlock)block pending:(BOOL)pending focused:(BOOL)focused; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTCompiledExample.m: -------------------------------------------------------------------------------- 1 | #import "SPTCompiledExample.h" 2 | 3 | @implementation SPTCompiledExample 4 | 5 | - (id)initWithName:(NSString *)name testCaseName:(NSString *)testCaseName block:(SPTSpecBlock)block pending:(BOOL)pending focused:(BOOL)focused { 6 | self = [super init]; 7 | if (self) { 8 | self.name = name; 9 | self.testCaseName = testCaseName; 10 | self.block = block; 11 | self.pending = pending; 12 | self.focused = focused; 13 | } 14 | return self; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTExample.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "SpectaTypes.h" 3 | 4 | @class SPTCallSite; 5 | 6 | @interface SPTExample : NSObject 7 | 8 | @property (nonatomic, copy) NSString *name; 9 | @property (nonatomic, retain) SPTCallSite *callSite; 10 | @property (nonatomic, copy) SPTVoidBlock block; 11 | 12 | @property (nonatomic) BOOL pending; 13 | @property (nonatomic, getter=isFocused) BOOL focused; 14 | 15 | - (id)initWithName:(NSString *)name callSite:(SPTCallSite *)callSite focused:(BOOL)focused block:(SPTVoidBlock)block; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTExample.m: -------------------------------------------------------------------------------- 1 | #import "SPTExample.h" 2 | 3 | @implementation SPTExample 4 | 5 | - (id)initWithName:(NSString *)name callSite:(SPTCallSite *)callSite focused:(BOOL)focused block:(SPTVoidBlock)block { 6 | self = [super init]; 7 | if (self) { 8 | self.name = name; 9 | self.callSite = callSite; 10 | self.block = block; 11 | self.focused = focused; 12 | self.pending = block == nil; 13 | } 14 | return self; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTExampleGroup.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "SpectaTypes.h" 4 | 5 | @class SPTExample; 6 | @class SPTCallSite; 7 | 8 | @interface SPTExampleGroup : NSObject 9 | 10 | @property (nonatomic, copy) NSString *name; 11 | @property (nonatomic, weak) SPTExampleGroup *root; 12 | @property (nonatomic, weak) SPTExampleGroup *parent; 13 | @property (nonatomic, strong) NSMutableArray *children; 14 | @property (nonatomic, strong) NSMutableArray *beforeAllArray; 15 | @property (nonatomic, strong) NSMutableArray *afterAllArray; 16 | @property (nonatomic, strong) NSMutableArray *beforeEachArray; 17 | @property (nonatomic, strong) NSMutableArray *afterEachArray; 18 | @property (nonatomic, strong) NSMutableDictionary *sharedExamples; 19 | @property (nonatomic) unsigned int exampleCount; 20 | @property (nonatomic) unsigned int ranExampleCount; 21 | @property (nonatomic) unsigned int pendingExampleCount; 22 | @property (nonatomic, getter=isFocused) BOOL focused; 23 | 24 | - (id)initWithName:(NSString *)name parent:(SPTExampleGroup *)parent root:(SPTExampleGroup *)root; 25 | 26 | - (SPTExampleGroup *)addExampleGroupWithName:(NSString *)name focused:(BOOL)focused; 27 | - (SPTExample *)addExampleWithName:(NSString *)name callSite:(SPTCallSite *)callSite focused:(BOOL)focused block:(SPTVoidBlock)block; 28 | 29 | - (void)addBeforeAllBlock:(SPTVoidBlock)block; 30 | - (void)addAfterAllBlock:(SPTVoidBlock)block; 31 | - (void)addBeforeEachBlock:(SPTVoidBlock)block; 32 | - (void)addAfterEachBlock:(SPTVoidBlock)block; 33 | 34 | - (NSArray *)compileExamplesWithStack:(NSArray *)stack; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTExcludeGlobalBeforeAfterEach.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Specta Team. All rights reserved. 3 | */ 4 | #import 5 | 6 | // This protocol was used for blacklisting classes for global beforeEach and afterEach blocks. 7 | // Now, instead, classes are whitelisted by implementing the SPTGlobalBeforeAfterEach protocol. 8 | __deprecated_msg("Please whitelist classes instead with the SPTGlobalBeforeAfterEach protocol") 9 | @protocol SPTExcludeGlobalBeforeAfterEach 10 | @end 11 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTGlobalBeforeAfterEach.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Specta Team. All rights reserved. 3 | */ 4 | #import 5 | 6 | // This protocol is used for whitelisting classes for global beforeEach and afterEach blocks. 7 | // If you want a class to participate in those just add this protocol to a category and it will be 8 | // included. 9 | @protocol SPTGlobalBeforeAfterEach 10 | 11 | @optional 12 | + (void)beforeEach; 13 | + (void)afterEach; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTSharedExampleGroups.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @class _XCTestCaseImplementation; 6 | 7 | @class SPTExampleGroup; 8 | 9 | @interface SPTSharedExampleGroups : XCTestCase 10 | 11 | + (void)addSharedExampleGroupWithName:(NSString *)name block:(SPTDictionaryBlock)block exampleGroup:(SPTExampleGroup *)exampleGroup; 12 | + (SPTDictionaryBlock)sharedExampleGroupWithName:(NSString *)name exampleGroup:(SPTExampleGroup *)exampleGroup; 13 | 14 | - (void)sharedExampleGroups; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTSharedExampleGroups.m: -------------------------------------------------------------------------------- 1 | #import "SPTSharedExampleGroups.h" 2 | #import "SPTExampleGroup.h" 3 | #import "SPTSpec.h" 4 | #import "SpectaUtility.h" 5 | #import 6 | 7 | NSMutableDictionary *globalSharedExampleGroups = nil; 8 | BOOL initialized = NO; 9 | 10 | @implementation SPTSharedExampleGroups 11 | 12 | + (void)initialize { 13 | Class SPTSharedExampleGroupsClass = [SPTSharedExampleGroups class]; 14 | if ([self class] == SPTSharedExampleGroupsClass) { 15 | if (!initialized) { 16 | initialized = YES; 17 | globalSharedExampleGroups = [[NSMutableDictionary alloc] init]; 18 | 19 | Class *classes = NULL; 20 | int numClasses = objc_getClassList(NULL, 0); 21 | 22 | if (numClasses > 0) { 23 | classes = (Class *)malloc(sizeof(Class) * numClasses); 24 | numClasses = objc_getClassList(classes, numClasses); 25 | 26 | Class klass, superClass; 27 | for(uint i = 0; i < numClasses; i++) { 28 | klass = classes[i]; 29 | superClass = class_getSuperclass(klass); 30 | if (superClass == SPTSharedExampleGroupsClass) { 31 | [[[klass alloc] init] sharedExampleGroups]; 32 | } 33 | } 34 | 35 | free(classes); 36 | } 37 | } 38 | } 39 | } 40 | 41 | + (void)addSharedExampleGroupWithName:(NSString *)name block:(SPTDictionaryBlock)block exampleGroup:(SPTExampleGroup *)exampleGroup { 42 | (exampleGroup == nil ? globalSharedExampleGroups : exampleGroup.sharedExamples)[name] = [block copy]; 43 | } 44 | 45 | + (SPTDictionaryBlock)sharedExampleGroupWithName:(NSString *)name exampleGroup:(SPTExampleGroup *)exampleGroup { 46 | SPTDictionaryBlock sharedExampleGroup = nil; 47 | while (exampleGroup != nil) { 48 | if ((sharedExampleGroup = exampleGroup.sharedExamples[name])) { 49 | return sharedExampleGroup; 50 | } 51 | exampleGroup = exampleGroup.parent; 52 | } 53 | return globalSharedExampleGroups[name]; 54 | } 55 | 56 | - (void)sharedExampleGroups {} 57 | 58 | - (void)spt_handleException:(NSException *)exception { 59 | [SPTCurrentSpec spt_handleException:exception]; 60 | } 61 | 62 | - (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filename atLine:(NSUInteger)lineNumber expected:(BOOL)expected { 63 | [SPTCurrentSpec recordFailureWithDescription:description inFile:filename atLine:lineNumber expected:expected]; 64 | } 65 | 66 | - (void)_recordUnexpectedFailureWithDescription:(NSString *)description exception:(NSException *)exception { 67 | [SPTCurrentSpec _recordUnexpectedFailureWithDescription:description exception:exception]; 68 | } 69 | 70 | - (_XCTestCaseImplementation *)internalImplementation { 71 | return [SPTCurrentSpec internalImplementation]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTSpec.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class 5 | SPTTestSuite 6 | , SPTCompiledExample 7 | ; 8 | 9 | @interface SPTSpec : XCTestCase 10 | 11 | @property (strong) XCTestCaseRun *spt_run; 12 | @property (nonatomic) BOOL spt_pending; 13 | @property (nonatomic) BOOL spt_skipped; 14 | 15 | + (BOOL)spt_isDisabled; 16 | + (void)spt_setDisabled:(BOOL)disabled; 17 | + (BOOL)spt_focusedExamplesExist; 18 | + (SEL)spt_convertToTestMethod:(SPTCompiledExample *)example; 19 | + (SPTTestSuite *)spt_testSuite; 20 | + (void)spt_setCurrentTestSuite; 21 | + (void)spt_unsetCurrentTestSuite; 22 | + (void)spt_setCurrentTestSuiteFileName:(NSString *)fileName lineNumber:(NSUInteger)lineNumber; 23 | 24 | - (void)spec; 25 | - (BOOL)spt_shouldRunExample:(SPTCompiledExample *)example; 26 | - (void)spt_runExample:(SPTCompiledExample *)example; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTSpec.m: -------------------------------------------------------------------------------- 1 | #import "SPTSpec.h" 2 | #import "SPTTestSuite.h" 3 | #import "SPTCompiledExample.h" 4 | #import "SPTSharedExampleGroups.h" 5 | #import "SpectaUtility.h" 6 | #import 7 | #import "XCTest+Private.h" 8 | 9 | @implementation SPTSpec 10 | 11 | + (void)initialize { 12 | [SPTSharedExampleGroups initialize]; 13 | SPTTestSuite *testSuite = [[SPTTestSuite alloc] init]; 14 | SPTSpec *spec = [[[self class] alloc] init]; 15 | NSString *specName = NSStringFromClass([self class]); 16 | objc_setAssociatedObject(self, "spt_testSuite", testSuite, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 17 | [self spt_setCurrentTestSuite]; 18 | @try { 19 | [spec spec]; 20 | } 21 | @catch (NSException *exception) { 22 | fprintf(stderr, "%s: An exception has occurred outside of tests, aborting.\n\n%s (%s) \n", [specName UTF8String], [[exception name] UTF8String], [[exception reason] UTF8String]); 23 | if ([exception respondsToSelector:@selector(callStackSymbols)]) { 24 | NSArray *callStackSymbols = [exception callStackSymbols]; 25 | if (callStackSymbols) { 26 | NSString *callStack = [NSString stringWithFormat:@"\n Call Stack:\n %@\n", [callStackSymbols componentsJoinedByString:@"\n "]]; 27 | fprintf(stderr, "%s", [callStack UTF8String]); 28 | } 29 | } 30 | exit(1); 31 | } 32 | @finally { 33 | [self spt_unsetCurrentTestSuite]; 34 | } 35 | [testSuite compile]; 36 | [[self class] testInvocations]; 37 | [super initialize]; 38 | } 39 | 40 | + (SPTTestSuite *)spt_testSuite { 41 | return objc_getAssociatedObject(self, "spt_testSuite"); 42 | } 43 | 44 | + (BOOL)spt_isDisabled { 45 | return [self spt_testSuite].disabled; 46 | } 47 | 48 | + (void)spt_setDisabled:(BOOL)disabled { 49 | [self spt_testSuite].disabled = disabled; 50 | } 51 | 52 | + (NSArray *)spt_allSpecClasses { 53 | static NSArray *allSpecClasses = nil; 54 | static dispatch_once_t onceToken; 55 | dispatch_once(&onceToken, ^{ 56 | 57 | NSMutableArray *specClasses = [[NSMutableArray alloc] init]; 58 | 59 | int numberOfClasses = objc_getClassList(NULL, 0); 60 | if (numberOfClasses > 0) { 61 | Class *classes = (Class *)malloc(sizeof(Class) * numberOfClasses); 62 | numberOfClasses = objc_getClassList(classes, numberOfClasses); 63 | 64 | for (int classIndex = 0; classIndex < numberOfClasses; classIndex++) { 65 | Class aClass = classes[classIndex]; 66 | if (spt_isSpecClass(aClass)) { 67 | [specClasses addObject:aClass]; 68 | } 69 | } 70 | 71 | free(classes); 72 | } 73 | 74 | allSpecClasses = [specClasses copy]; 75 | }); 76 | 77 | return allSpecClasses; 78 | } 79 | 80 | + (BOOL)spt_focusedExamplesExist { 81 | for (Class specClass in [self spt_allSpecClasses]) { 82 | SPTTestSuite *testSuite = [specClass spt_testSuite]; 83 | if (testSuite.disabled == NO && [testSuite hasFocusedExamples]) { 84 | return YES; 85 | } 86 | } 87 | 88 | return NO; 89 | } 90 | 91 | + (SEL)spt_convertToTestMethod:(SPTCompiledExample *)example { 92 | @synchronized(example) { 93 | if (!example.testMethodSelector) { 94 | IMP imp = imp_implementationWithBlock(^(SPTSpec *self) { 95 | [self spt_runExample:example]; 96 | }); 97 | 98 | SEL sel; 99 | unsigned int i = 0; 100 | 101 | do { 102 | i++; 103 | if (i == 1) { 104 | sel = NSSelectorFromString([NSString stringWithFormat:@"test_%@", example.testCaseName]); 105 | } else { 106 | sel = NSSelectorFromString([NSString stringWithFormat:@"test_%@_%u", example.testCaseName, i]); 107 | } 108 | } while([self instancesRespondToSelector:sel]); 109 | 110 | class_addMethod(self, sel, imp, "@@:"); 111 | example.testMethodSelector = sel; 112 | } 113 | } 114 | 115 | return example.testMethodSelector; 116 | } 117 | 118 | + (void)spt_setCurrentTestSuite { 119 | SPTTestSuite *testSuite = [self spt_testSuite]; 120 | [[NSThread currentThread] threadDictionary][spt_kCurrentTestSuiteKey] = testSuite; 121 | } 122 | 123 | + (void)spt_unsetCurrentTestSuite { 124 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:spt_kCurrentTestSuiteKey]; 125 | } 126 | 127 | + (void)spt_setCurrentTestSuiteFileName:(NSString *)fileName lineNumber:(NSUInteger)lineNumber { 128 | SPTTestSuite *testSuite = [self spt_testSuite]; 129 | testSuite.fileName = fileName; 130 | testSuite.lineNumber = lineNumber; 131 | } 132 | 133 | - (void)spec {} 134 | 135 | - (BOOL)spt_shouldRunExample:(SPTCompiledExample *)example { 136 | return [[self class] spt_isDisabled] == NO && 137 | (example.focused || [[self class] spt_focusedExamplesExist] == NO); 138 | } 139 | 140 | - (void)spt_runExample:(SPTCompiledExample *)example { 141 | [[NSThread currentThread] threadDictionary][spt_kCurrentSpecKey] = self; 142 | 143 | if ([self spt_shouldRunExample:example]) { 144 | self.spt_pending = example.pending; 145 | example.block(self); 146 | } else if (!example.pending) { 147 | self.spt_skipped = YES; 148 | NSLog(@"Skipping '%@'", example.name); 149 | } 150 | 151 | [[[NSThread currentThread] threadDictionary] removeObjectForKey:spt_kCurrentSpecKey]; 152 | } 153 | 154 | #pragma mark - XCTestCase overrides 155 | 156 | + (NSArray *)testInvocations { 157 | NSArray *compiledExamples = [self spt_testSuite].compiledExamples; 158 | [NSMutableArray arrayWithCapacity:[compiledExamples count]]; 159 | 160 | NSMutableSet *addedSelectors = [NSMutableSet setWithCapacity:[compiledExamples count]]; 161 | NSMutableArray *selectors = [NSMutableArray arrayWithCapacity:[compiledExamples count]]; 162 | 163 | // dynamically generate test methods with compiled examples 164 | for (SPTCompiledExample *example in compiledExamples) { 165 | SEL sel = [self spt_convertToTestMethod:example]; 166 | NSString *selName = NSStringFromSelector(sel); 167 | [selectors addObject: selName]; 168 | [addedSelectors addObject: selName]; 169 | } 170 | 171 | // look for any other test methods that may be present in class. 172 | unsigned int n; 173 | Method *imethods = class_copyMethodList(self, &n); 174 | 175 | for (NSUInteger i = 0; i < n; i++) { 176 | struct objc_method_description *desc = method_getDescription(imethods[i]); 177 | 178 | char *types = desc->types; 179 | SEL sel = desc->name; 180 | NSString *selName = NSStringFromSelector(sel); 181 | 182 | if (strcmp(types, "@@:") == 0 && [selName hasPrefix:@"test"] && ![addedSelectors containsObject:selName]) { 183 | [selectors addObject:NSStringFromSelector(sel)]; 184 | } 185 | } 186 | 187 | free(imethods); 188 | 189 | // create invocations from test method selectors 190 | NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:[selectors count]]; 191 | for (NSString *selName in selectors) { 192 | SEL sel = NSSelectorFromString(selName); 193 | NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[self instanceMethodSignatureForSelector:sel]]; 194 | [inv setSelector:sel]; 195 | [invocations addObject:inv]; 196 | } 197 | 198 | return spt_shuffle(invocations); 199 | } 200 | 201 | - (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filename atLine:(NSUInteger)lineNumber expected:(BOOL)expected { 202 | SPTSpec *currentSpec = SPTCurrentSpec; 203 | [currentSpec.spt_run recordFailureWithDescription:description inFile:filename atLine:lineNumber expected:expected]; 204 | } 205 | 206 | - (void)performTest:(XCTestRun *)run { 207 | self.spt_run = (XCTestCaseRun *)run; 208 | [super performTest:run]; 209 | } 210 | 211 | @end 212 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTTestSuite.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class 4 | SPTExample 5 | , SPTExampleGroup 6 | ; 7 | 8 | @interface SPTTestSuite : NSObject 9 | 10 | @property (nonatomic, strong) SPTExampleGroup *rootGroup; 11 | @property (nonatomic, strong) NSMutableArray *groupStack; 12 | @property (nonatomic, strong) NSArray *compiledExamples; 13 | @property (nonatomic, copy) NSString *fileName; 14 | @property (nonatomic) NSUInteger lineNumber; 15 | @property (nonatomic, getter = isDisabled) BOOL disabled; 16 | @property (nonatomic) BOOL hasFocusedExamples; 17 | 18 | - (SPTExampleGroup *)currentGroup; 19 | - (void)compile; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SPTTestSuite.m: -------------------------------------------------------------------------------- 1 | #import "SPTTestSuite.h" 2 | #import "SPTExampleGroup.h" 3 | #import "SPTCompiledExample.h" 4 | 5 | @implementation SPTTestSuite 6 | 7 | - (id)init { 8 | self = [super init]; 9 | if (self) { 10 | self.rootGroup = [[SPTExampleGroup alloc] init]; 11 | self.rootGroup.root = self.rootGroup; 12 | self.groupStack = [NSMutableArray arrayWithObject:self.rootGroup]; 13 | } 14 | return self; 15 | } 16 | 17 | - (SPTExampleGroup *)currentGroup { 18 | return [self.groupStack lastObject]; 19 | } 20 | 21 | - (void)compile { 22 | self.compiledExamples = [self.rootGroup compileExamplesWithStack:@[]]; 23 | for (SPTCompiledExample *example in self.compiledExamples) { 24 | if (example.focused) { 25 | self.hasFocusedExamples = YES; 26 | break; 27 | } 28 | } 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/Specta.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | //! Project version number for Specta. 5 | FOUNDATION_EXPORT double SpectaVersionNumber; 6 | 7 | //! Project version string for Specta. 8 | FOUNDATION_EXPORT const unsigned char SpectaVersionString[]; 9 | 10 | // In this header, you should import all the public headers of your framework using statements like #import 11 | 12 | #import 13 | #import 14 | #import 15 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SpectaDSL.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #define SpecBegin(name) _SPTSpecBegin(name, __FILE__, __LINE__) 4 | #define SpecEnd _SPTSpecEnd 5 | 6 | #define SharedExamplesBegin(name) _SPTSharedExampleGroupsBegin(name) 7 | #define SharedExamplesEnd _SPTSharedExampleGroupsEnd 8 | #define SharedExampleGroupsBegin(name) _SPTSharedExampleGroupsBegin(name) 9 | #define SharedExampleGroupsEnd _SPTSharedExampleGroupsEnd 10 | 11 | typedef void (^DoneCallback)(void); 12 | 13 | OBJC_EXTERN void describe(NSString *name, void (^block)(void)); 14 | OBJC_EXTERN void fdescribe(NSString *name, void (^block)(void)); 15 | 16 | OBJC_EXTERN void context(NSString *name, void (^block)(void)); 17 | OBJC_EXTERN void fcontext(NSString *name, void (^block)(void)); 18 | 19 | OBJC_EXTERN void it(NSString *name, void (^block)(void)); 20 | OBJC_EXTERN void fit(NSString *name, void (^block)(void)); 21 | 22 | OBJC_EXTERN void example(NSString *name, void (^block)(void)); 23 | OBJC_EXTERN void fexample(NSString *name, void (^block)(void)); 24 | 25 | OBJC_EXTERN void specify(NSString *name, void (^block)(void)); 26 | OBJC_EXTERN void fspecify(NSString *name, void (^block)(void)); 27 | 28 | #define pending(...) spt_pending_(__VA_ARGS__, nil) 29 | #define xdescribe(...) spt_pending_(__VA_ARGS__, nil) 30 | #define xcontext(...) spt_pending_(__VA_ARGS__, nil) 31 | #define xexample(...) spt_pending_(__VA_ARGS__, nil) 32 | #define xit(...) spt_pending_(__VA_ARGS__, nil) 33 | #define xspecify(...) spt_pending_(__VA_ARGS__, nil) 34 | 35 | OBJC_EXTERN void beforeAll(void (^block)(void)); 36 | OBJC_EXTERN void afterAll(void (^block)(void)); 37 | 38 | OBJC_EXTERN void beforeEach(void (^block)(void)); 39 | OBJC_EXTERN void afterEach(void (^block)(void)); 40 | 41 | OBJC_EXTERN void before(void (^block)(void)); 42 | OBJC_EXTERN void after(void (^block)(void)); 43 | 44 | OBJC_EXTERN void sharedExamplesFor(NSString *name, void (^block)(NSDictionary *data)); 45 | OBJC_EXTERN void sharedExamples(NSString *name, void (^block)(NSDictionary *data)); 46 | 47 | #define itShouldBehaveLike(...) spt_itShouldBehaveLike_(@(__FILE__), __LINE__, __VA_ARGS__) 48 | #define itBehavesLike(...) spt_itShouldBehaveLike_(@(__FILE__), __LINE__, __VA_ARGS__) 49 | 50 | OBJC_EXTERN void waitUntil(void (^block)(DoneCallback done)); 51 | /** 52 | * Runs the @c block and waits until the @c done block is called or the 53 | * @c timeout has passed. 54 | * 55 | * @param timeout timeout for this @c block only; does not affect the global 56 | * timeout, as @c setAsyncSpecTimeout() does. 57 | * @param block runs test code 58 | */ 59 | OBJC_EXTERN void waitUntilTimeout(NSTimeInterval timeout, void (^block)(DoneCallback done)); 60 | 61 | OBJC_EXTERN void setAsyncSpecTimeout(NSTimeInterval timeout); 62 | 63 | // ---------------------------------------------------------------------------- 64 | 65 | #define _SPTSpecBegin(name, file, line) \ 66 | @interface name##Spec : SPTSpec \ 67 | @end \ 68 | @implementation name##Spec \ 69 | - (void)spec { \ 70 | [[self class] spt_setCurrentTestSuiteFileName:(@(file)) lineNumber:(line)]; 71 | 72 | #define _SPTSpecEnd \ 73 | } \ 74 | @end 75 | 76 | #define _SPTSharedExampleGroupsBegin(name) \ 77 | @interface name##SharedExampleGroups : SPTSharedExampleGroups \ 78 | @end \ 79 | @implementation name##SharedExampleGroups \ 80 | - (void)sharedExampleGroups { 81 | 82 | #define _SPTSharedExampleGroupsEnd \ 83 | } \ 84 | @end 85 | 86 | OBJC_EXTERN void spt_it_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)(void)); 87 | OBJC_EXTERN void spt_fit_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)(void)); 88 | OBJC_EXTERN void spt_pending_(NSString *name, ...); 89 | OBJC_EXTERN void spt_itShouldBehaveLike_(NSString *fileName, NSUInteger lineNumber, NSString *name, id dictionaryOrBlock); 90 | OBJC_EXTERN void spt_itShouldBehaveLike_block(NSString *fileName, NSUInteger lineNumber, NSString *name, NSDictionary *(^block)(void)); 91 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SpectaDSL.m: -------------------------------------------------------------------------------- 1 | #import "SpectaDSL.h" 2 | #import "SpectaTypes.h" 3 | #import "SpectaUtility.h" 4 | #import "SPTTestSuite.h" 5 | #import "SPTExampleGroup.h" 6 | #import "SPTSharedExampleGroups.h" 7 | #import "SPTSpec.h" 8 | #import "SPTCallSite.h" 9 | #import 10 | 11 | static NSTimeInterval asyncSpecTimeout = 10.0; 12 | 13 | static void spt_defineItBlock(NSString *name, NSString *fileName, NSUInteger lineNumber, BOOL focused, void (^block)()) { 14 | SPTReturnUnlessBlockOrNil(block); 15 | SPTCallSite *site = nil; 16 | if (lineNumber && fileName) { 17 | site = [SPTCallSite callSiteWithFile:fileName line:lineNumber]; 18 | } 19 | [SPTCurrentGroup addExampleWithName:name callSite:site focused:focused block:block]; 20 | } 21 | 22 | static void spt_defineDescribeBlock(NSString *name, BOOL focused, void (^block)()) { 23 | if (block) { 24 | [SPTGroupStack addObject:[SPTCurrentGroup addExampleGroupWithName:name focused:focused]]; 25 | block(); 26 | [SPTGroupStack removeLastObject]; 27 | } else { 28 | spt_defineItBlock(name, nil, 0, focused, nil); 29 | } 30 | } 31 | 32 | void spt_it_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)()) { 33 | spt_defineItBlock(name, fileName, lineNumber, NO, block); 34 | } 35 | 36 | void spt_fit_(NSString *name, NSString *fileName, NSUInteger lineNumber, void (^block)()) { 37 | spt_defineItBlock(name, fileName, lineNumber, YES, block); 38 | } 39 | 40 | void spt_pending_(NSString *name, ...) { 41 | spt_defineItBlock(name, nil, 0, NO, nil); 42 | } 43 | 44 | void spt_itShouldBehaveLike_(NSString *fileName, NSUInteger lineNumber, NSString *name, id dictionaryOrBlock) { 45 | SPTDictionaryBlock block = [SPTSharedExampleGroups sharedExampleGroupWithName:name exampleGroup:SPTCurrentGroup]; 46 | if (block) { 47 | if (SPTIsBlock(dictionaryOrBlock)) { 48 | id (^dataBlock)(void) = [dictionaryOrBlock copy]; 49 | 50 | describe(name, ^{ 51 | __block NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] init]; 52 | 53 | beforeEach(^{ 54 | NSDictionary *blockData = dataBlock(); 55 | [dataDict addEntriesFromDictionary:blockData]; 56 | }); 57 | 58 | block(dataDict); 59 | 60 | afterEach(^{ 61 | [dataDict removeAllObjects]; 62 | }); 63 | 64 | afterAll(^{ 65 | dataDict = nil; 66 | }); 67 | }); 68 | } else { 69 | NSDictionary *data = dictionaryOrBlock; 70 | 71 | describe(name, ^{ 72 | block(data); 73 | }); 74 | } 75 | } else { 76 | SPTSpec *currentSpec = SPTCurrentSpec; 77 | if (currentSpec) { 78 | [currentSpec recordFailureWithDescription:@"itShouldBehaveLike should not be invoked inside an example block!" inFile:fileName atLine:lineNumber expected:NO]; 79 | } else { 80 | it(name, ^{ 81 | [SPTCurrentSpec recordFailureWithDescription:[NSString stringWithFormat:@"Shared example group \"%@\" does not exist.", name] inFile:fileName atLine:lineNumber expected:NO]; 82 | }); 83 | } 84 | } 85 | } 86 | 87 | void spt_itShouldBehaveLike_block(NSString *fileName, NSUInteger lineNumber, NSString *name, NSDictionary *(^block)()) { 88 | spt_itShouldBehaveLike_(fileName, lineNumber, name, (id)block); 89 | } 90 | 91 | void describe(NSString *name, void (^block)()) { 92 | spt_defineDescribeBlock(name, NO, block); 93 | } 94 | 95 | void fdescribe(NSString *name, void (^block)()) { 96 | spt_defineDescribeBlock(name, YES, block); 97 | } 98 | 99 | void context(NSString *name, void (^block)()) { 100 | describe(name, block); 101 | } 102 | 103 | void fcontext(NSString *name, void (^block)()) { 104 | fdescribe(name, block); 105 | } 106 | 107 | void it(NSString *name, void (^block)()) { 108 | spt_defineItBlock(name, nil, 0, NO, block); 109 | } 110 | 111 | void fit(NSString *name, void (^block)()) { 112 | spt_defineItBlock(name, nil, 0, YES, block); 113 | } 114 | 115 | void example(NSString *name, void (^block)()) { 116 | it(name, block); 117 | } 118 | 119 | void fexample(NSString *name, void (^block)()) { 120 | fit(name, block); 121 | } 122 | 123 | void specify(NSString *name, void (^block)()) { 124 | it(name, block); 125 | } 126 | 127 | void fspecify(NSString *name, void (^block)()) { 128 | fit(name, block); 129 | } 130 | 131 | void beforeAll(void (^block)()) { 132 | SPTReturnUnlessBlockOrNil(block); 133 | [SPTCurrentGroup addBeforeAllBlock:block]; 134 | } 135 | 136 | void afterAll(void (^block)()) { 137 | SPTReturnUnlessBlockOrNil(block); 138 | [SPTCurrentGroup addAfterAllBlock:block]; 139 | } 140 | 141 | void beforeEach(void (^block)()) { 142 | SPTReturnUnlessBlockOrNil(block); 143 | [SPTCurrentGroup addBeforeEachBlock:block]; 144 | } 145 | 146 | void afterEach(void (^block)()) { 147 | SPTReturnUnlessBlockOrNil(block); 148 | [SPTCurrentGroup addAfterEachBlock:block]; 149 | } 150 | 151 | void before(void (^block)()) { 152 | beforeEach(block); 153 | } 154 | 155 | void after(void (^block)()) { 156 | afterEach(block); 157 | } 158 | 159 | void sharedExamplesFor(NSString *name, void (^block)(NSDictionary *data)) { 160 | [SPTSharedExampleGroups addSharedExampleGroupWithName:name block:block exampleGroup:SPTCurrentGroup]; 161 | } 162 | 163 | void sharedExamples(NSString *name, void (^block)(NSDictionary *data)) { 164 | sharedExamplesFor(name, block); 165 | } 166 | 167 | void waitUntil(void (^block)(DoneCallback done)) { 168 | waitUntilTimeout(asyncSpecTimeout, block); 169 | } 170 | 171 | void waitUntilTimeout(NSTimeInterval timeout, void (^block)(DoneCallback done)) { 172 | __block uint32_t complete = 0; 173 | dispatch_async(dispatch_get_main_queue(), ^{ 174 | block(^{ 175 | OSAtomicOr32Barrier(1, &complete); 176 | }); 177 | }); 178 | NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:timeout]; 179 | while (!complete && [timeoutDate timeIntervalSinceNow] > 0) { 180 | [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; 181 | } 182 | if (!complete) { 183 | NSString *message = [NSString stringWithFormat:@"failed to invoke done() callback before timeout (%f seconds)", timeout]; 184 | SPTSpec *currentSpec = SPTCurrentSpec; 185 | SPTTestSuite *testSuite = [[currentSpec class] spt_testSuite]; 186 | [currentSpec recordFailureWithDescription:message inFile:testSuite.fileName atLine:testSuite.lineNumber expected:YES]; 187 | } 188 | } 189 | 190 | void setAsyncSpecTimeout(NSTimeInterval timeout) { 191 | asyncSpecTimeout = timeout; 192 | } 193 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SpectaTypes.h: -------------------------------------------------------------------------------- 1 | @class SPTSpec; 2 | 3 | typedef void (^SPTVoidBlock)(void); 4 | typedef void (^SPTSpecBlock)(SPTSpec *spec); 5 | typedef void (^SPTDictionaryBlock)(NSDictionary *dictionary); 6 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SpectaUtility.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | extern NSString * const spt_kCurrentTestSuiteKey; 4 | extern NSString * const spt_kCurrentSpecKey; 5 | 6 | #define SPTCurrentTestSuite [[NSThread mainThread] threadDictionary][spt_kCurrentTestSuiteKey] 7 | #define SPTCurrentSpec [[NSThread mainThread] threadDictionary][spt_kCurrentSpecKey] 8 | #define SPTCurrentGroup [SPTCurrentTestSuite currentGroup] 9 | #define SPTGroupStack [SPTCurrentTestSuite groupStack] 10 | 11 | #define SPTReturnUnlessBlockOrNil(block) if ((block) && !SPTIsBlock((block))) return; 12 | #define SPTIsBlock(obj) [(obj) isKindOfClass:NSClassFromString(@"NSBlock")] 13 | 14 | BOOL spt_isSpecClass(Class aClass); 15 | NSString *spt_underscorize(NSString *string); 16 | NSArray *spt_map(NSArray *array, id (^block)(id obj, NSUInteger idx)); 17 | NSArray *spt_shuffle(NSArray *array); 18 | unsigned int spt_seed(void); 19 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/SpectaUtility.m: -------------------------------------------------------------------------------- 1 | #import "SpectaUtility.h" 2 | #import "SPTSpec.h" 3 | #import 4 | 5 | NSString * const spt_kCurrentTestSuiteKey = @"SPTCurrentTestSuite"; 6 | NSString * const spt_kCurrentSpecKey = @"SPTCurrentSpec"; 7 | 8 | static unsigned int seed = 0; 9 | 10 | BOOL spt_isSpecClass(Class aClass) { 11 | Class superclass = class_getSuperclass(aClass); 12 | while (superclass != Nil) { 13 | if (superclass == [SPTSpec class]) { 14 | return YES; 15 | } else { 16 | superclass = class_getSuperclass(superclass); 17 | } 18 | } 19 | return NO; 20 | } 21 | 22 | NSString *spt_underscorize(NSString *string) { 23 | static NSMutableCharacterSet *invalidCharSet; 24 | static dispatch_once_t onceToken; 25 | dispatch_once(&onceToken, ^{ 26 | invalidCharSet = [[NSMutableCharacterSet alloc] init]; 27 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet controlCharacterSet]]; 28 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet illegalCharacterSet]]; 29 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet newlineCharacterSet]]; 30 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet nonBaseCharacterSet]]; 31 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]]; 32 | [invalidCharSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]]; 33 | }); 34 | NSString *stripped = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 35 | stripped = [[stripped componentsSeparatedByCharactersInSet:invalidCharSet] componentsJoinedByString:@""]; 36 | 37 | NSArray *components = [stripped componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 38 | stripped = [[components objectsAtIndexes:[components indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { 39 | return ![obj isEqualToString:@""]; 40 | }]] componentsJoinedByString:@"_"]; 41 | return stripped; 42 | } 43 | 44 | NSArray *spt_map(NSArray *array, id (^block)(id obj, NSUInteger idx)) { 45 | NSMutableArray *mapped = [NSMutableArray arrayWithCapacity:[array count]]; 46 | [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 47 | [mapped addObject:block(obj, idx)]; 48 | }]; 49 | return mapped; 50 | } 51 | 52 | NSArray *spt_shuffle(NSArray *array) { 53 | if (![[[[NSProcessInfo processInfo] environment] objectForKey:@"SPECTA_SHUFFLE"] isEqualToString:@"1"]) { 54 | return array; 55 | } 56 | spt_seed(); 57 | NSMutableArray *shuffled = [array mutableCopy]; 58 | NSUInteger count = [shuffled count]; 59 | for (NSUInteger i = 0; i < count; i++) { 60 | NSUInteger r = random() % count; 61 | [shuffled exchangeObjectAtIndex:i withObjectAtIndex:r]; 62 | } 63 | return shuffled; 64 | } 65 | 66 | unsigned int spt_seed() { 67 | static dispatch_once_t onceToken; 68 | dispatch_once(&onceToken, ^{ 69 | NSString *envSeed = [[[NSProcessInfo processInfo] environment] objectForKey:@"SPECTA_SEED"]; 70 | if (envSeed) { 71 | sscanf([envSeed UTF8String], "%u", &seed); 72 | } else { 73 | seed = arc4random(); 74 | } 75 | srandom(seed); 76 | printf("Test Seed: %u\n", seed); 77 | }); 78 | return seed; 79 | } 80 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/XCTest+Private.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 4 | 5 | @interface XCTestObservationCenter (SPTTestSuspention) 6 | 7 | - (void)_suspendObservationForBlock:(void (^)(void))block; 8 | 9 | @end 10 | 11 | #else 12 | 13 | @interface XCTestObservationCenter : NSObject 14 | 15 | + (id)sharedObservationCenter; 16 | - (void)_suspendObservationForBlock:(void (^)(void))block; 17 | 18 | @end 19 | 20 | @protocol XCTestObservation 21 | @end 22 | 23 | 24 | #endif 25 | 26 | @interface _XCTestDriverTestObserver : NSObject 27 | 28 | - (void)stopObserving; 29 | - (void)startObserving; 30 | 31 | @end 32 | 33 | @interface _XCTestCaseImplementation : NSObject 34 | @end 35 | 36 | @interface XCTestCase () 37 | 38 | - (_XCTestCaseImplementation *)internalImplementation; 39 | - (void)_recordUnexpectedFailureWithDescription:(NSString *)description exception:(NSException *)exception; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/XCTestCase+Specta.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface XCTestCase (Specta) 4 | 5 | - (void)spt_handleException:(NSException *)exception; 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Example/Pods/Specta/Specta/Specta/XCTestCase+Specta.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "XCTestCase+Specta.h" 3 | #import "SPTSpec.h" 4 | #import "SPTExample.h" 5 | #import "SPTSharedExampleGroups.h" 6 | #import "SpectaUtility.h" 7 | #import "XCTest+Private.h" 8 | 9 | @interface XCTestCase (xct_allSubclasses) 10 | 11 | - (NSArray *)allSubclasses; 12 | - (void)_dequeueFailures; 13 | 14 | @end 15 | 16 | @implementation XCTestCase (Specta) 17 | 18 | + (void)load { 19 | Method allSubclasses = class_getClassMethod(self, @selector(allSubclasses)); 20 | Method allSubclasses_swizzle = class_getClassMethod(self , @selector(spt_allSubclasses_swizzle)); 21 | method_exchangeImplementations(allSubclasses, allSubclasses_swizzle); 22 | 23 | Method dequeueFailures = class_getInstanceMethod(self, @selector(_dequeueFailures)); 24 | Method dequeueFailures_swizzle = class_getInstanceMethod(self, @selector(spt_dequeueFailures)); 25 | method_exchangeImplementations(dequeueFailures, dequeueFailures_swizzle); 26 | } 27 | 28 | + (NSArray *)spt_allSubclasses_swizzle { 29 | NSArray *subclasses = [self spt_allSubclasses_swizzle]; // call original 30 | NSMutableArray *filtered = [NSMutableArray arrayWithCapacity:[subclasses count]]; 31 | // exclude SPTSpec base class and all subclasses of SPTSharedExampleGroups 32 | for (id subclass in subclasses) { 33 | if (subclass != [SPTSpec class] && ![subclass isKindOfClass:[SPTSharedExampleGroups class]]) { 34 | [filtered addObject:subclass]; 35 | } 36 | } 37 | return spt_shuffle(filtered); 38 | } 39 | 40 | - (void)spt_dequeueFailures { 41 | void(^dequeueFailures)() = ^() { 42 | [self spt_dequeueFailures]; 43 | }; 44 | 45 | BOOL isMainThread = [NSThread isMainThread]; 46 | BOOL isSpectaTest = [self isKindOfClass:[SPTSpec class]]; 47 | 48 | if (!isSpectaTest || isMainThread) { 49 | dequeueFailures(); 50 | } else { 51 | dispatch_sync(dispatch_get_main_queue(), dequeueFailures); 52 | } 53 | } 54 | 55 | - (void)spt_handleException:(NSException *)exception { 56 | NSString *description = [exception reason]; 57 | if ([exception userInfo]) { 58 | id line = [exception userInfo][@"line"]; 59 | id file = [exception userInfo][@"file"]; 60 | if ([line isKindOfClass:[NSNumber class]] && [file isKindOfClass:[NSString class]]) { 61 | [self recordFailureWithDescription:description inFile:file atLine:[line unsignedIntegerValue] expected:YES]; 62 | return; 63 | } 64 | } 65 | [self _recordUnexpectedFailureWithDescription:description exception:exception]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.6 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Expecta : NSObject 3 | @end 4 | @implementation PodsDummy_Expecta 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "EXPBlockDefinedMatcher.h" 14 | #import "EXPDefines.h" 15 | #import "EXPDoubleTuple.h" 16 | #import "Expecta.h" 17 | #import "ExpectaObject.h" 18 | #import "ExpectaSupport.h" 19 | #import "EXPExpect.h" 20 | #import "EXPFloatTuple.h" 21 | #import "EXPMatcher.h" 22 | #import "EXPUnsupportedObject.h" 23 | #import "EXPMatcherHelpers.h" 24 | #import "EXPMatchers+beCloseTo.h" 25 | #import "EXPMatchers+beFalsy.h" 26 | #import "EXPMatchers+beginWith.h" 27 | #import "EXPMatchers+beGreaterThan.h" 28 | #import "EXPMatchers+beGreaterThanOrEqualTo.h" 29 | #import "EXPMatchers+beIdenticalTo.h" 30 | #import "EXPMatchers+beInstanceOf.h" 31 | #import "EXPMatchers+beInTheRangeOf.h" 32 | #import "EXPMatchers+beKindOf.h" 33 | #import "EXPMatchers+beLessThan.h" 34 | #import "EXPMatchers+beLessThanOrEqualTo.h" 35 | #import "EXPMatchers+beNil.h" 36 | #import "EXPMatchers+beSubclassOf.h" 37 | #import "EXPMatchers+beSupersetOf.h" 38 | #import "EXPMatchers+beTruthy.h" 39 | #import "EXPMatchers+conformTo.h" 40 | #import "EXPMatchers+contain.h" 41 | #import "EXPMatchers+endWith.h" 42 | #import "EXPMatchers+equal.h" 43 | #import "EXPMatchers+haveCountOf.h" 44 | #import "EXPMatchers+match.h" 45 | #import "EXPMatchers+postNotification.h" 46 | #import "EXPMatchers+raise.h" 47 | #import "EXPMatchers+raiseWithReason.h" 48 | #import "EXPMatchers+respondTo.h" 49 | #import "EXPMatchers.h" 50 | #import "NSObject+Expecta.h" 51 | #import "NSValue+Expecta.h" 52 | 53 | FOUNDATION_EXPORT double ExpectaVersionNumber; 54 | FOUNDATION_EXPORT const unsigned char ExpectaVersionString[]; 55 | 56 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta.modulemap: -------------------------------------------------------------------------------- 1 | framework module Expecta { 2 | umbrella header "Expecta-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Expecta/Expecta.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Expecta 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Expecta 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_GHApplicationMediator : NSObject 3 | @end 4 | @implementation PodsDummy_GHApplicationMediator 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "GHApplicationMediator.h" 14 | 15 | FOUNDATION_EXPORT double GHApplicationMediatorVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char GHApplicationMediatorVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator.modulemap: -------------------------------------------------------------------------------- 1 | framework module GHApplicationMediator { 2 | umbrella header "GHApplicationMediator-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/GHApplicationMediator/GHApplicationMediator.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## GHApplicationMediator 5 | 6 | Copyright (c) 2019 ginhoor 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | Generated by CocoaPods - https://cocoapods.org 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2019 ginhoor <ginhoor@gmail.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | GHApplicationMediator 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Generated by CocoaPods - https://cocoapods.org 47 | Title 48 | 49 | Type 50 | PSGroupSpecifier 51 | 52 | 53 | StringsTable 54 | Acknowledgements 55 | Title 56 | Acknowledgements 57 | 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_GHApplicationMediator_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_GHApplicationMediator_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | 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}\"" 90 | 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}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # 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. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Signs a framework with the provided identity 113 | code_sign_if_enabled() { 114 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 115 | # Use the current code_sign_identity 116 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 117 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 118 | 119 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 120 | code_sign_cmd="$code_sign_cmd &" 121 | fi 122 | echo "$code_sign_cmd" 123 | eval "$code_sign_cmd" 124 | fi 125 | } 126 | 127 | # Strip invalid architectures 128 | strip_invalid_archs() { 129 | binary="$1" 130 | # Get architectures for current target binary 131 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 132 | # Intersect them with the architectures we are building for 133 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 134 | # If there are no archs supported by this binary then warn the user 135 | if [[ -z "$intersected_archs" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | STRIP_BINARY_RETVAL=0 138 | return 139 | fi 140 | stripped="" 141 | for arch in $binary_archs; do 142 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 143 | # Strip non-valid architectures in-place 144 | lipo -remove "$arch" -output "$binary" "$binary" 145 | stripped="$stripped $arch" 146 | fi 147 | done 148 | if [[ "$stripped" ]]; then 149 | echo "Stripped $binary of architectures:$stripped" 150 | fi 151 | STRIP_BINARY_RETVAL=1 152 | } 153 | 154 | 155 | if [[ "$CONFIGURATION" == "Debug" ]]; then 156 | install_framework "${BUILT_PRODUCTS_DIR}/GHApplicationMediator/GHApplicationMediator.framework" 157 | fi 158 | if [[ "$CONFIGURATION" == "Release" ]]; then 159 | install_framework "${BUILT_PRODUCTS_DIR}/GHApplicationMediator/GHApplicationMediator.framework" 160 | fi 161 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 162 | wait 163 | fi 164 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_GHApplicationMediator_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_GHApplicationMediator_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator/GHApplicationMediator.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "GHApplicationMediator" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_GHApplicationMediator_Example { 2 | umbrella header "Pods-GHApplicationMediator_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Example/Pods-GHApplicationMediator_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator/GHApplicationMediator.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "GHApplicationMediator" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Expecta 5 | 6 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## Specta 28 | 29 | Copyright (c) 2012-2014 Specta Team. 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in 39 | all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | 50 | Generated by CocoaPods - https://cocoapods.org 51 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2011-2015 Specta Team - https://github.com/specta 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | Expecta 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2012-2014 Specta Team. 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | 66 | 67 | License 68 | MIT 69 | Title 70 | Specta 71 | Type 72 | PSGroupSpecifier 73 | 74 | 75 | FooterText 76 | Generated by CocoaPods - https://cocoapods.org 77 | Title 78 | 79 | Type 80 | PSGroupSpecifier 81 | 82 | 83 | StringsTable 84 | Acknowledgements 85 | Title 86 | Acknowledgements 87 | 88 | 89 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_GHApplicationMediator_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_GHApplicationMediator_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | 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}\"" 90 | 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}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # 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. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Signs a framework with the provided identity 113 | code_sign_if_enabled() { 114 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 115 | # Use the current code_sign_identity 116 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 117 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 118 | 119 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 120 | code_sign_cmd="$code_sign_cmd &" 121 | fi 122 | echo "$code_sign_cmd" 123 | eval "$code_sign_cmd" 124 | fi 125 | } 126 | 127 | # Strip invalid architectures 128 | strip_invalid_archs() { 129 | binary="$1" 130 | # Get architectures for current target binary 131 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 132 | # Intersect them with the architectures we are building for 133 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 134 | # If there are no archs supported by this binary then warn the user 135 | if [[ -z "$intersected_archs" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | STRIP_BINARY_RETVAL=0 138 | return 139 | fi 140 | stripped="" 141 | for arch in $binary_archs; do 142 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 143 | # Strip non-valid architectures in-place 144 | lipo -remove "$arch" -output "$binary" "$binary" 145 | stripped="$stripped $arch" 146 | fi 147 | done 148 | if [[ "$stripped" ]]; then 149 | echo "Stripped $binary of architectures:$stripped" 150 | fi 151 | STRIP_BINARY_RETVAL=1 152 | } 153 | 154 | 155 | if [[ "$CONFIGURATION" == "Debug" ]]; then 156 | install_framework "${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework" 157 | install_framework "${BUILT_PRODUCTS_DIR}/Specta/Specta.framework" 158 | fi 159 | if [[ "$CONFIGURATION" == "Release" ]]; then 160 | install_framework "${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework" 161 | install_framework "${BUILT_PRODUCTS_DIR}/Specta/Specta.framework" 162 | fi 163 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 164 | wait 165 | fi 166 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_GHApplicationMediator_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_GHApplicationMediator_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/Expecta" "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator" "${PODS_CONFIGURATION_BUILD_DIR}/Specta" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Expecta/Expecta.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator/GHApplicationMediator.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Specta/Specta.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Foundation" -framework "GHApplicationMediator" -framework "Specta" -framework "XCTest" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_GHApplicationMediator_Tests { 2 | umbrella header "Pods-GHApplicationMediator_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-GHApplicationMediator_Tests/Pods-GHApplicationMediator_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/Expecta" "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator" "${PODS_CONFIGURATION_BUILD_DIR}/Specta" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Expecta/Expecta.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/GHApplicationMediator/GHApplicationMediator.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Specta/Specta.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Foundation" -framework "GHApplicationMediator" -framework "Specta" -framework "XCTest" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.7 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Specta : NSObject 3 | @end 4 | @implementation PodsDummy_Specta 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Specta.h" 14 | #import "SpectaDSL.h" 15 | #import "SpectaTypes.h" 16 | #import "SpectaUtility.h" 17 | #import "SPTCallSite.h" 18 | #import "SPTCompiledExample.h" 19 | #import "SPTExample.h" 20 | #import "SPTExampleGroup.h" 21 | #import "SPTExcludeGlobalBeforeAfterEach.h" 22 | #import "SPTGlobalBeforeAfterEach.h" 23 | #import "SPTSharedExampleGroups.h" 24 | #import "SPTSpec.h" 25 | #import "SPTTestSuite.h" 26 | #import "XCTest+Private.h" 27 | #import "XCTestCase+Specta.h" 28 | 29 | FOUNDATION_EXPORT double SpectaVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char SpectaVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta.modulemap: -------------------------------------------------------------------------------- 1 | framework module Specta { 2 | umbrella header "Specta-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Specta/Specta.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Specta 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Specta 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | @import Specta; 6 | @import Expecta; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // GHApplicationMediatorTests.m 3 | // GHApplicationMediatorTests 4 | // 5 | // Created by ginhoor on 03/15/2019. 6 | // Copyright (c) 2019 ginhoor. All rights reserved. 7 | // 8 | 9 | // https://github.com/Specta/Specta 10 | 11 | SpecBegin(InitialSpecs) 12 | 13 | describe(@"these will fail", ^{ 14 | 15 | it(@"can do maths", ^{ 16 | expect(1).to.equal(2); 17 | }); 18 | 19 | it(@"can read", ^{ 20 | expect(@"number").to.equal(@"string"); 21 | }); 22 | 23 | it(@"will wait for 10 seconds and fail", ^{ 24 | waitUntil(^(DoneCallback done) { 25 | 26 | }); 27 | }); 28 | }); 29 | 30 | describe(@"these will pass", ^{ 31 | 32 | it(@"can do maths", ^{ 33 | expect(1).beLessThan(23); 34 | }); 35 | 36 | it(@"can read", ^{ 37 | expect(@"team").toNot.contain(@"I"); 38 | }); 39 | 40 | it(@"will wait and succeed", ^{ 41 | waitUntil(^(DoneCallback done) { 42 | done(); 43 | }); 44 | }); 45 | }); 46 | 47 | SpecEnd 48 | 49 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /GHApplicationMediator.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | # 组件库名称 3 | s.name = 'GHApplicationMediator' 4 | # 组件库当前版本,也就是tag指定的 5 | s.version = '0.1.1' 6 | # 简介 7 | s.summary = 'make AppDelegate lighter.' 8 | # 详细描述 9 | s.description = <<-DESC 10 | manage appDelegate modules easier 11 | DESC 12 | # 组件库首页 13 | s.homepage = 'https://github.com/ginhoor/GHApplicationMediator' 14 | # 组件库开源协议 15 | s.license = { :type => 'Apache License', :file => 'LICENSE' } 16 | # 作者 17 | s.author = { 'ginhoor' => 'ginhoor@gmail.com' } 18 | # Git仓库地址 19 | s.source = { :git => 'https://github.com/ginhoor/GHApplicationMediator.git', :tag => s.version.to_s } 20 | # 依赖的iOS版本 21 | s.ios.deployment_target = '10.0' 22 | # 源文件地址 23 | s.source_files = 'GHApplicationMediator/Classes/**/*' 24 | # 依赖资源地址 25 | # s.resource_bundles = { 26 | # 'GHApplicationMediator' => ['GHApplicationMediator/Assets/*.png'] 27 | # } 28 | # 头文件地址 29 | # s.public_header_files = 'Pod/Classes/**/*.h' 30 | # 依赖系统库 31 | # s.frameworks = 'UIKit', 'MapKit' 32 | # 依赖的第三方库 33 | # s.dependency 'AFNetworking', '~> 2.3' 34 | 35 | end 36 | -------------------------------------------------------------------------------- /GHApplicationMediator/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ginhoor/GHApplicationMediator/44577b4db25f5b13f867b2d2e27ca0c01132af9e/GHApplicationMediator/Assets/.gitkeep -------------------------------------------------------------------------------- /GHApplicationMediator/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ginhoor/GHApplicationMediator/44577b4db25f5b13f867b2d2e27ca0c01132af9e/GHApplicationMediator/Classes/.gitkeep -------------------------------------------------------------------------------- /GHApplicationMediator/Classes/GHApplicationMediator.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHApplicationMediator.h 3 | // GinhoorFramework 4 | // 5 | // Created by JunhuaShao on 2019/3/4. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define GHAPPLICATIONMEDIATOR_DEBUG_MODE 0 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface GHApplicationMediator : UIResponder 17 | 18 | + (instancetype)sharedInstance; 19 | 20 | + (NSArray *)applicationModuleDelegates; 21 | 22 | + (void)registerAppilgationModuleDelegate:(id)moduleDelegate; 23 | + (BOOL)removeModuleDelegateByClass:(Class)moduleClass; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | 29 | -------------------------------------------------------------------------------- /GHApplicationMediator/Classes/GHApplicationMediator.m: -------------------------------------------------------------------------------- 1 | // 2 | // GHApplicationMediator.m 3 | // GinhoorFramework 4 | // 5 | // Created by JunhuaShao on 2019/3/4. 6 | // Copyright © 2019 JunhuaShao. All rights reserved. 7 | // 8 | 9 | #import "GHApplicationMediator.h" 10 | 11 | @interface GHApplicationMediator() 12 | @property (nonatomic, strong) NSMutableArray *applicationModuleDelegates; 13 | @end 14 | 15 | @implementation GHApplicationMediator 16 | 17 | + (instancetype)sharedInstance 18 | { 19 | static dispatch_once_t onceToken; 20 | static id sharedInstance = nil; 21 | 22 | dispatch_once(&onceToken, ^{ 23 | sharedInstance = [[self alloc] init]; 24 | }); 25 | return sharedInstance; 26 | } 27 | 28 | + (NSArray *)applicationModuleDelegates 29 | { 30 | return [GHApplicationMediator sharedInstance].applicationModuleDelegates; 31 | } 32 | 33 | + (void)registerAppilgationModuleDelegate:(id)moduleDelegate 34 | { 35 | NSAssert(moduleDelegate, @"ERROR:添加的AppDelegate为空", [moduleDelegate class]); 36 | NSAssert([moduleDelegate conformsToProtocol:@protocol(UIApplicationDelegate)], @"ERROR:添加的AppDelegate未实现", [moduleDelegate class]); 37 | [self addModuleDelegate:moduleDelegate]; 38 | } 39 | 40 | + (void)addModuleDelegate:(id)moduleDelegate 41 | { 42 | GHApplicationMediator *mediator = [GHApplicationMediator sharedInstance]; 43 | #if GHAPPLICATIONMEDIATOR_DEBUG_MODE 44 | [mediator.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 45 | 46 | NSAssert(![obj isKindOfClass:[moduleDelegate class]], @"ERROR:重复添加的delegate:%@", [moduleDelegate class]); 47 | }]; 48 | #endif 49 | [mediator.applicationModuleDelegates addObject:moduleDelegate]; 50 | #if GHAPPLICATIONMEDIATOR_DEBUG_MODE 51 | NSLog(@"applicationModuleDelegates:\n%@",mediator.applicationModuleDelegates); 52 | #endif 53 | } 54 | 55 | + (BOOL)removeModuleDelegateByClass:(Class)moduleClass 56 | { 57 | GHApplicationMediator *mediator = [GHApplicationMediator sharedInstance]; 58 | __block BOOL result = NO; 59 | [mediator.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull delegate, NSUInteger idx, BOOL * _Nonnull stop) { 60 | if ([delegate isMemberOfClass:moduleClass]) { 61 | [mediator.applicationModuleDelegates removeObject:delegate]; 62 | result = YES; 63 | *stop = YES; 64 | } 65 | }]; 66 | return result; 67 | } 68 | 69 | - (instancetype)init 70 | { 71 | self = [super init]; 72 | if (self) { 73 | [self setup]; 74 | } 75 | return self; 76 | } 77 | 78 | - (void)setup 79 | { 80 | _applicationModuleDelegates = [NSMutableArray array]; 81 | } 82 | 83 | #pragma mark- Handle Method 84 | /** 85 | 无法通过[super respondsToSelector:aSelector]来检测对象是否从super继承了方法。 86 | 因此调用[super respondsToSelector:aSelector],相当于调用了[self respondsToSelector:aSelector] 87 | **/ 88 | - (BOOL)respondsToSelector:(SEL)aSelector 89 | { 90 | BOOL result = [super respondsToSelector:aSelector]; 91 | if (!result) { 92 | result = [self hasDelegateRespondsToSelector:aSelector]; 93 | } 94 | return result; 95 | } 96 | 97 | /** 98 | 此方法还被用于当NSInvocation被创建的时候,比如在消息传递的时候。 99 | 如果当前Classf可以处理未被直接实现的方法,则必须覆写此方法。 100 | */ 101 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 102 | { 103 | id delegate = [self delegateRespondsToSelector:aSelector]; 104 | if (delegate) { 105 | return [delegate methodSignatureForSelector:aSelector]; 106 | } 107 | return [super methodSignatureForSelector:aSelector]; 108 | } 109 | 110 | /** 111 | 无法识别的消息处理 112 | */ 113 | - (void)forwardInvocation:(NSInvocation *)anInvocation 114 | { 115 | __block BOOL isExec = NO; 116 | 117 | NSMethodSignature *methodSignature = anInvocation.methodSignature; 118 | const char *returnType = methodSignature.methodReturnType; 119 | // 没有返回值,或者默认返回YES 120 | if (0 == strcmp(returnType, @encode(void)) || 121 | anInvocation.selector == @selector(application:didFinishLaunchingWithOptions:)) { 122 | [self notifySelectorOfAllDelegates:anInvocation.selector nofityHandler:^(id delegate) { 123 | [anInvocation invokeWithTarget:delegate]; 124 | isExec = YES; 125 | }]; 126 | } else if (0 == strcmp(returnType, @encode(BOOL))) { 127 | // 返回值为BOOL 128 | [self notifySelectorOfAllDelegateUntilSuccessed:anInvocation.selector defaultReturnValue:NO nofityHandler:^BOOL(id delegate) { 129 | 130 | [anInvocation invokeWithTarget:delegate]; 131 | // 获得返回值 132 | NSUInteger returnValueLenth = anInvocation.methodSignature.methodReturnLength; 133 | BOOL *retValue = (BOOL *)malloc(returnValueLenth); 134 | [anInvocation getReturnValue:retValue]; 135 | 136 | BOOL result = *retValue; 137 | return result; 138 | }]; 139 | } else { 140 | // 等同于[self doesNotRecognizeSelector:anInvocation.selector]; 141 | [super forwardInvocation:anInvocation]; 142 | } 143 | } 144 | 145 | 146 | #pragma mark- Private Method 147 | 148 | - (BOOL)hasDelegateRespondsToSelector:(SEL)selector 149 | { 150 | __block BOOL result = NO; 151 | 152 | [self.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull delegate, NSUInteger idx, BOOL * _Nonnull stop) { 153 | if ([delegate respondsToSelector:selector]) { 154 | result = YES; 155 | *stop = YES; 156 | } 157 | }]; 158 | return result; 159 | } 160 | 161 | - (id)delegateRespondsToSelector:(SEL)selector 162 | { 163 | __block id resultDelegate; 164 | [self.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull delegate, NSUInteger idx, BOOL * _Nonnull stop) { 165 | if ([delegate respondsToSelector:selector]) { 166 | resultDelegate = delegate; 167 | *stop = YES; 168 | } 169 | }]; 170 | return resultDelegate; 171 | } 172 | 173 | /** 174 | 通知所有delegate响应方法 175 | 176 | @param selector 响应方法 177 | @param nofityHandler delegated处理调用事件 178 | */ 179 | - (void)notifySelectorOfAllDelegates:(SEL)selector nofityHandler:(void(^)(id delegate))nofityHandler 180 | { 181 | if (_applicationModuleDelegates.count == 0) { 182 | return; 183 | } 184 | 185 | [self.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull delegate, NSUInteger idx, BOOL * _Nonnull stop) { 186 | if ([delegate respondsToSelector:selector]) { 187 | if (nofityHandler) { 188 | nofityHandler(delegate); 189 | } 190 | } 191 | }]; 192 | } 193 | 194 | /** 195 | 通知所有的delegate,当有delegate响应为成功后,中断通知。 196 | 197 | @param selector 响应方法 198 | @param defaultReturnValue 默认返回值(当设置为YES时,即使没有响应对象也会返回YES。) 199 | @param nofityHandler delegate处理调用事件 200 | @return delegate处理结果 201 | */ 202 | - (BOOL)notifySelectorOfAllDelegateUntilSuccessed:(SEL)selector defaultReturnValue:(BOOL)defaultReturnValue nofityHandler:(BOOL(^)(id delegate))nofityHandler 203 | { 204 | __block BOOL success = defaultReturnValue; 205 | if (_applicationModuleDelegates.count == 0) { 206 | return success; 207 | } 208 | [self.applicationModuleDelegates enumerateObjectsUsingBlock:^(id _Nonnull delegate, NSUInteger idx, BOOL * _Nonnull stop) { 209 | if ([delegate respondsToSelector:selector]) { 210 | if (nofityHandler) { 211 | success = nofityHandler(delegate); 212 | if (success) { 213 | *stop = YES; 214 | } 215 | } 216 | } 217 | }]; 218 | return success; 219 | } 220 | 221 | @end 222 | 223 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /repo.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash 2 | pod repo push GinhoorSpecs GHApplicationMediator.podspec 3 | echo "push finished!" --------------------------------------------------------------------------------