diff --git a/.gitignore b/.gitignore index 6727b4fd..22a74856 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ output xcodebuild.log xcodebuild_error.log +.swiftpm diff --git a/.travis.yml b/.travis.yml index 62769a51..3a5a455b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: objective-c -osx_image: xcode9.2 +osx_image: xcode11.3 script: make ci diff --git a/Cartfile.resolved b/Cartfile.resolved index 9012d6e8..9d47dd5a 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "Quick/Nimble" "v7.0.3" +github "Quick/Nimble" "v8.0.5" github "specta/expecta" "v1.0.6" diff --git a/Kiwi.podspec b/Kiwi.podspec index 39a1c979..28e1aefb 100644 --- a/Kiwi.podspec +++ b/Kiwi.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.8' s.framework = 'XCTest' - s.source_files = 'Classes/**/*.{h,m}' + s.source_files = 'Sources/Kiwi/**/*.{h,m}' s.requires_arc = true s.prefix_header_contents = '#import ' diff --git a/Kiwi.xcodeproj/project.pbxproj b/Kiwi.xcodeproj/project.pbxproj index 90e8797f..1392b8d6 100755 --- a/Kiwi.xcodeproj/project.pbxproj +++ b/Kiwi.xcodeproj/project.pbxproj @@ -247,6 +247,10 @@ 4AE030C81AEB494400556381 /* KWValueTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C6FD2311782A290068BBC8 /* KWValueTest.m */; }; 4AE030C91AEB494400556381 /* NSNumber_KiwiAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9C69F7190CA6EE002C4DC0 /* NSNumber_KiwiAdditionsTests.m */; }; 4AE030CA1AEB4DCF00556381 /* NSObject+KiwiSpyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F982CD916A802920030A0B1 /* NSObject+KiwiSpyAdditions.m */; }; + 4B9314A523D0E83C007A295C /* KWNotificationMatcherTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B9314A423D0E83C007A295C /* KWNotificationMatcherTest.m */; }; + 4B9314A623D0E83C007A295C /* KWNotificationMatcherTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B9314A423D0E83C007A295C /* KWNotificationMatcherTest.m */; }; + 4B9314A823D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B9314A723D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m */; }; + 4B9314A923D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B9314A723D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m */; }; 50ACAF651BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; }; 50ACAF661BBA28D000F29B0F /* DoNotUseMe.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ACAF641BBA28D000F29B0F /* DoNotUseMe.m */; }; CE0736B41B8577140023EBEA /* Expecta.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE0736B31B8577140023EBEA /* Expecta.framework */; }; @@ -588,6 +592,8 @@ 4AE02FD81AEB46D000556381 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4AE33458195820DC00CDE895 /* KWMessagePattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMessagePattern.h; sourceTree = ""; }; 4AE33459195820DC00CDE895 /* KWMessagePattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMessagePattern.m; sourceTree = ""; }; + 4B9314A423D0E83C007A295C /* KWNotificationMatcherTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWNotificationMatcherTest.m; sourceTree = ""; }; + 4B9314A723D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWNotificationMatcherFunctionalTests.m; sourceTree = ""; }; 4BA52D0015487F0C00FC957B /* KWCaptureTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWCaptureTest.m; sourceTree = ""; }; 4E3C5DB01716C34900835B62 /* KWRegularExpressionPatternMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWRegularExpressionPatternMatcher.h; sourceTree = ""; }; 4E3C5DB11716C34900835B62 /* KWRegularExpressionPatternMatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWRegularExpressionPatternMatcher.m; sourceTree = ""; }; @@ -1222,6 +1228,7 @@ CE0736B71B8577490023EBEA /* KWExpectaTests.m */, 89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */, 4A4AA324195B7C4E00423CD6 /* KWMessagePatternFunctionalTests.m */, + 4B9314A723D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m */, CE39E6171B857CE000736C33 /* KWObjCNimbleTests.m */, CE7EFF9B1B847AD700FFE6D6 /* KWObjCXCTestAssertionTests.m */, CE39E61A1B857DE300736C33 /* KWSwiftNimbleTests.swift */, @@ -1343,6 +1350,7 @@ F553B29D11755A00004FCA2E /* KWInequalityMatcherTest.m */, F5C36E91115C9F0700425FDA /* KWReceiveMatcherTest.m */, 4E3C5DB71716C68000835B62 /* KWRegularExpressionPatternMatcherTest.m */, + 4B9314A423D0E83C007A295C /* KWNotificationMatcherTest.m */, F553B6641175D48C004FCA2E /* KWRespondToSelectorMatcherTest.m */, A385CAE713AA7EA200DCA951 /* KWUserDefinedMatcherTest.m */, C931D36D18AB2DEB005BC184 /* KWBeZeroMatcherTest.m */, @@ -1665,7 +1673,7 @@ attributes = { LastSwiftUpdateCheck = 0700; LastTestingUpgradeCheck = 0600; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1030; ORGANIZATIONNAME = "Allen Ding"; TargetAttributes = { 4AE02FBC1AEB45EB00556381 = { @@ -1673,25 +1681,27 @@ }; 4AE02FC61AEB45EB00556381 = { CreatedOnToolsVersion = 6.3; + LastSwiftMigration = 1030; }; CE87C4221AF194E900310C07 = { CreatedOnToolsVersion = 6.3.1; }; CE87C42C1AF194EA00310C07 = { CreatedOnToolsVersion = 6.3.1; + LastSwiftMigration = 1130; }; }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Kiwi" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, en, + de, + ja, + fr, + Base, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -1844,6 +1854,7 @@ 4AE030951AEB494400556381 /* KWBeTrueMatcherTest.m in Sources */, 4AE030961AEB494400556381 /* KWBeWithinMatcherTest.m in Sources */, 4AE030971AEB494400556381 /* KWBlockRaiseMatcherTest.m in Sources */, + 4B9314A623D0E83C007A295C /* KWNotificationMatcherTest.m in Sources */, 4AE030981AEB494400556381 /* KWChangeMatcherTest.m in Sources */, 4AE030991AEB494400556381 /* KWConformToProtocolMatcherTest.m in Sources */, CE39E61C1B857DE300736C33 /* KWSwiftNimbleTests.swift in Sources */, @@ -1876,6 +1887,7 @@ 4AE030B11AEB494400556381 /* Carrier.m in Sources */, 4AE030B21AEB494400556381 /* Cruiser.m in Sources */, 4AE030B31AEB494400556381 /* Engine.m in Sources */, + 4B9314A923D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m in Sources */, CE7EFF9D1B847AD700FFE6D6 /* KWObjCXCTestAssertionTests.m in Sources */, 4AE030B41AEB494400556381 /* Fighter.m in Sources */, 4AE030B51AEB494400556381 /* Galaxy.m in Sources */, @@ -2009,6 +2021,7 @@ CE87C4FB1AF1994100310C07 /* KWBeWithinMatcherTest.m in Sources */, CE87C4FC1AF1994100310C07 /* KWBlockRaiseMatcherTest.m in Sources */, CE87C4FD1AF1994100310C07 /* KWChangeMatcherTest.m in Sources */, + 4B9314A523D0E83C007A295C /* KWNotificationMatcherTest.m in Sources */, CE87C4FE1AF1994100310C07 /* KWConformToProtocolMatcherTest.m in Sources */, CE87C4FF1AF1994100310C07 /* KWContainMatcherTest.m in Sources */, CE39E61B1B857DE300736C33 /* KWSwiftNimbleTests.swift in Sources */, @@ -2041,6 +2054,7 @@ CE87C5171AF1994200310C07 /* Cruiser.m in Sources */, CE87C5181AF1994200310C07 /* Engine.m in Sources */, CE87C5191AF1994200310C07 /* Fighter.m in Sources */, + 4B9314A823D0F4C6007A295C /* KWNotificationMatcherFunctionalTests.m in Sources */, CE7EFF9C1B847AD700FFE6D6 /* KWObjCXCTestAssertionTests.m in Sources */, CE87C51A1AF1994200310C07 /* Galaxy.m in Sources */, CE87C51D1AF1994200310C07 /* Robot.m in Sources */, @@ -2211,7 +2225,7 @@ PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -2244,7 +2258,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SDKROOT = macosx; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -2256,11 +2270,13 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; @@ -2303,11 +2319,13 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; @@ -2456,7 +2474,7 @@ MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -2486,7 +2504,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(KIWI_TESTS_PRODUCT_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme index 357eca07..33633528 100644 --- a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme +++ b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-OSX.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -56,7 +66,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-iOS.xcscheme b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-iOS.xcscheme index 05764027..5abcd4b6 100644 --- a/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-iOS.xcscheme +++ b/Kiwi.xcodeproj/xcshareddata/xcschemes/Kiwi-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -56,7 +66,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 00000000..08c43e45 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "nimble", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Quick/Nimble", + "state" : { + "revision" : "7a46a5fc86cb917f69e3daf79fcb045283d8f008", + "version" : "8.1.2" + } + } + ], + "version" : 2 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..51a99998 --- /dev/null +++ b/Package.swift @@ -0,0 +1,69 @@ +// swift-tools-version: 5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "Kiwi", + platforms: [ + .iOS(.v9), + .macOS(.v10_10) + ], + products: [ + .library(name: "Kiwi", targets: ["Kiwi"]) + ], + dependencies: [ + .package( + url: "https://github.com/Quick/Nimble", "8.0.0"..<"9.0.0" + ) + ], + targets: [ + .target( + name: "Kiwi", + cSettings: [ + .headerSearchPath("./**") + ] + ), + .target( + name: "Test Classes", + dependencies: [ + "Kiwi" + ], + publicHeadersPath: "./", + cSettings: [ + .headerSearchPath("./../Kiwi/**") + ] + ), + .testTarget( + name: "KiwiTests", + dependencies: [ + "Kiwi", + "Nimble", + "Test Classes" + ], + cSettings: [ + .headerSearchPath("./**"), + .headerSearchPath("../../Sources/Kiwi/**") + ] + ), + .testTarget( + name: "KiwiTestsNoArc", + dependencies: [ + "Kiwi", + "Test Classes" + ], + cSettings: [ + .headerSearchPath("../KiwiTests/**"), + .headerSearchPath("../../Sources/Kiwi/**"), + .unsafeFlags(["-fno-objc-arc"]) + ] + ), + .testTarget( + name: "KiwiTestsSwift", + dependencies: [ + "Kiwi", + "Nimble" + ] + ) + ] +) diff --git a/Classes/Config/KWAllTestsSuite.m b/Sources/Kiwi/Config/KWAllTestsSuite.m similarity index 100% rename from Classes/Config/KWAllTestsSuite.m rename to Sources/Kiwi/Config/KWAllTestsSuite.m diff --git a/Classes/Config/KWSuiteConfigurationBase.m b/Sources/Kiwi/Config/KWSuiteConfigurationBase.m similarity index 100% rename from Classes/Config/KWSuiteConfigurationBase.m rename to Sources/Kiwi/Config/KWSuiteConfigurationBase.m diff --git a/Classes/Core/KWAny.m b/Sources/Kiwi/Core/KWAny.m similarity index 100% rename from Classes/Core/KWAny.m rename to Sources/Kiwi/Core/KWAny.m diff --git a/Classes/Core/KWBackgroundTask.h b/Sources/Kiwi/Core/KWBackgroundTask.h similarity index 100% rename from Classes/Core/KWBackgroundTask.h rename to Sources/Kiwi/Core/KWBackgroundTask.h diff --git a/Classes/Core/KWBackgroundTask.m b/Sources/Kiwi/Core/KWBackgroundTask.m similarity index 100% rename from Classes/Core/KWBackgroundTask.m rename to Sources/Kiwi/Core/KWBackgroundTask.m diff --git a/Classes/Core/KWBlock.m b/Sources/Kiwi/Core/KWBlock.m similarity index 100% rename from Classes/Core/KWBlock.m rename to Sources/Kiwi/Core/KWBlock.m diff --git a/Classes/Core/KWCallSite.m b/Sources/Kiwi/Core/KWCallSite.m similarity index 100% rename from Classes/Core/KWCallSite.m rename to Sources/Kiwi/Core/KWCallSite.m diff --git a/Classes/Core/KWCaptureSpy.m b/Sources/Kiwi/Core/KWCaptureSpy.m similarity index 100% rename from Classes/Core/KWCaptureSpy.m rename to Sources/Kiwi/Core/KWCaptureSpy.m diff --git a/Classes/Core/KWDeviceInfo.m b/Sources/Kiwi/Core/KWDeviceInfo.m similarity index 100% rename from Classes/Core/KWDeviceInfo.m rename to Sources/Kiwi/Core/KWDeviceInfo.m diff --git a/Classes/Core/KWExample.m b/Sources/Kiwi/Core/KWExample.m similarity index 100% rename from Classes/Core/KWExample.m rename to Sources/Kiwi/Core/KWExample.m diff --git a/Classes/Core/KWExampleSuite.h b/Sources/Kiwi/Core/KWExampleSuite.h similarity index 100% rename from Classes/Core/KWExampleSuite.h rename to Sources/Kiwi/Core/KWExampleSuite.h diff --git a/Classes/Core/KWExampleSuite.m b/Sources/Kiwi/Core/KWExampleSuite.m similarity index 100% rename from Classes/Core/KWExampleSuite.m rename to Sources/Kiwi/Core/KWExampleSuite.m diff --git a/Classes/Core/KWExampleSuiteBuilder.m b/Sources/Kiwi/Core/KWExampleSuiteBuilder.m similarity index 100% rename from Classes/Core/KWExampleSuiteBuilder.m rename to Sources/Kiwi/Core/KWExampleSuiteBuilder.m diff --git a/Classes/Core/KWFailure.m b/Sources/Kiwi/Core/KWFailure.m similarity index 100% rename from Classes/Core/KWFailure.m rename to Sources/Kiwi/Core/KWFailure.m diff --git a/Classes/Core/KWFormatter.m b/Sources/Kiwi/Core/KWFormatter.m similarity index 100% rename from Classes/Core/KWFormatter.m rename to Sources/Kiwi/Core/KWFormatter.m diff --git a/Classes/Core/KWFutureObject.m b/Sources/Kiwi/Core/KWFutureObject.m similarity index 100% rename from Classes/Core/KWFutureObject.m rename to Sources/Kiwi/Core/KWFutureObject.m diff --git a/Classes/Core/KWInvocationCapturer.m b/Sources/Kiwi/Core/KWInvocationCapturer.m similarity index 100% rename from Classes/Core/KWInvocationCapturer.m rename to Sources/Kiwi/Core/KWInvocationCapturer.m diff --git a/Classes/Core/KWMatcher.m b/Sources/Kiwi/Core/KWMatcher.m similarity index 100% rename from Classes/Core/KWMatcher.m rename to Sources/Kiwi/Core/KWMatcher.m diff --git a/Classes/Core/KWMatcherFactory.m b/Sources/Kiwi/Core/KWMatcherFactory.m similarity index 100% rename from Classes/Core/KWMatcherFactory.m rename to Sources/Kiwi/Core/KWMatcherFactory.m diff --git a/Classes/Core/KWMatchers.m b/Sources/Kiwi/Core/KWMatchers.m similarity index 100% rename from Classes/Core/KWMatchers.m rename to Sources/Kiwi/Core/KWMatchers.m diff --git a/Classes/Core/KWMessagePattern.m b/Sources/Kiwi/Core/KWMessagePattern.m similarity index 100% rename from Classes/Core/KWMessagePattern.m rename to Sources/Kiwi/Core/KWMessagePattern.m diff --git a/Classes/Core/KWMessageTracker.h b/Sources/Kiwi/Core/KWMessageTracker.h similarity index 100% rename from Classes/Core/KWMessageTracker.h rename to Sources/Kiwi/Core/KWMessageTracker.h diff --git a/Classes/Core/KWMessageTracker.m b/Sources/Kiwi/Core/KWMessageTracker.m similarity index 100% rename from Classes/Core/KWMessageTracker.m rename to Sources/Kiwi/Core/KWMessageTracker.m diff --git a/Classes/Core/KWNull.m b/Sources/Kiwi/Core/KWNull.m similarity index 100% rename from Classes/Core/KWNull.m rename to Sources/Kiwi/Core/KWNull.m diff --git a/Classes/Core/KWObjCUtilities.m b/Sources/Kiwi/Core/KWObjCUtilities.m similarity index 100% rename from Classes/Core/KWObjCUtilities.m rename to Sources/Kiwi/Core/KWObjCUtilities.m diff --git a/Classes/Core/KWProbePoller.h b/Sources/Kiwi/Core/KWProbePoller.h similarity index 100% rename from Classes/Core/KWProbePoller.h rename to Sources/Kiwi/Core/KWProbePoller.h diff --git a/Classes/Core/KWProbePoller.m b/Sources/Kiwi/Core/KWProbePoller.m similarity index 100% rename from Classes/Core/KWProbePoller.m rename to Sources/Kiwi/Core/KWProbePoller.m diff --git a/Classes/Core/KWSpec.m b/Sources/Kiwi/Core/KWSpec.m similarity index 100% rename from Classes/Core/KWSpec.m rename to Sources/Kiwi/Core/KWSpec.m diff --git a/Classes/Core/KWStringUtilities.m b/Sources/Kiwi/Core/KWStringUtilities.m similarity index 100% rename from Classes/Core/KWStringUtilities.m rename to Sources/Kiwi/Core/KWStringUtilities.m diff --git a/Classes/Core/KWSymbolicator.h b/Sources/Kiwi/Core/KWSymbolicator.h similarity index 100% rename from Classes/Core/KWSymbolicator.h rename to Sources/Kiwi/Core/KWSymbolicator.h diff --git a/Classes/Core/KWSymbolicator.m b/Sources/Kiwi/Core/KWSymbolicator.m similarity index 100% rename from Classes/Core/KWSymbolicator.m rename to Sources/Kiwi/Core/KWSymbolicator.m diff --git a/Classes/Core/KWValue.m b/Sources/Kiwi/Core/KWValue.m similarity index 100% rename from Classes/Core/KWValue.m rename to Sources/Kiwi/Core/KWValue.m diff --git a/Classes/Core/KWWorkarounds.h b/Sources/Kiwi/Core/KWWorkarounds.h similarity index 100% rename from Classes/Core/KWWorkarounds.h rename to Sources/Kiwi/Core/KWWorkarounds.h diff --git a/Classes/Core/KWWorkarounds.m b/Sources/Kiwi/Core/KWWorkarounds.m similarity index 100% rename from Classes/Core/KWWorkarounds.m rename to Sources/Kiwi/Core/KWWorkarounds.m diff --git a/Classes/Core/NSInvocation+KiwiAdditions.h b/Sources/Kiwi/Core/NSInvocation+KiwiAdditions.h similarity index 100% rename from Classes/Core/NSInvocation+KiwiAdditions.h rename to Sources/Kiwi/Core/NSInvocation+KiwiAdditions.h diff --git a/Classes/Core/NSInvocation+KiwiAdditions.m b/Sources/Kiwi/Core/NSInvocation+KiwiAdditions.m similarity index 100% rename from Classes/Core/NSInvocation+KiwiAdditions.m rename to Sources/Kiwi/Core/NSInvocation+KiwiAdditions.m diff --git a/Classes/Core/NSInvocation+OCMAdditions.h b/Sources/Kiwi/Core/NSInvocation+OCMAdditions.h similarity index 100% rename from Classes/Core/NSInvocation+OCMAdditions.h rename to Sources/Kiwi/Core/NSInvocation+OCMAdditions.h diff --git a/Classes/Core/NSInvocation+OCMAdditions.m b/Sources/Kiwi/Core/NSInvocation+OCMAdditions.m similarity index 100% rename from Classes/Core/NSInvocation+OCMAdditions.m rename to Sources/Kiwi/Core/NSInvocation+OCMAdditions.m diff --git a/Classes/Core/NSMethodSignature+KiwiAdditions.h b/Sources/Kiwi/Core/NSMethodSignature+KiwiAdditions.h similarity index 100% rename from Classes/Core/NSMethodSignature+KiwiAdditions.h rename to Sources/Kiwi/Core/NSMethodSignature+KiwiAdditions.h diff --git a/Classes/Core/NSMethodSignature+KiwiAdditions.m b/Sources/Kiwi/Core/NSMethodSignature+KiwiAdditions.m similarity index 100% rename from Classes/Core/NSMethodSignature+KiwiAdditions.m rename to Sources/Kiwi/Core/NSMethodSignature+KiwiAdditions.m diff --git a/Classes/Core/NSNumber+KiwiAdditions.h b/Sources/Kiwi/Core/NSNumber+KiwiAdditions.h similarity index 100% rename from Classes/Core/NSNumber+KiwiAdditions.h rename to Sources/Kiwi/Core/NSNumber+KiwiAdditions.h diff --git a/Classes/Core/NSNumber+KiwiAdditions.m b/Sources/Kiwi/Core/NSNumber+KiwiAdditions.m similarity index 100% rename from Classes/Core/NSNumber+KiwiAdditions.m rename to Sources/Kiwi/Core/NSNumber+KiwiAdditions.m diff --git a/Classes/Core/NSObject+KiwiSpyAdditions.m b/Sources/Kiwi/Core/NSObject+KiwiSpyAdditions.m similarity index 100% rename from Classes/Core/NSObject+KiwiSpyAdditions.m rename to Sources/Kiwi/Core/NSObject+KiwiSpyAdditions.m diff --git a/Classes/Core/NSObject+KiwiVerifierAdditions.m b/Sources/Kiwi/Core/NSObject+KiwiVerifierAdditions.m similarity index 100% rename from Classes/Core/NSObject+KiwiVerifierAdditions.m rename to Sources/Kiwi/Core/NSObject+KiwiVerifierAdditions.m diff --git a/Classes/Core/NSProxy+KiwiVerifierAdditions.m b/Sources/Kiwi/Core/NSProxy+KiwiVerifierAdditions.m similarity index 100% rename from Classes/Core/NSProxy+KiwiVerifierAdditions.m rename to Sources/Kiwi/Core/NSProxy+KiwiVerifierAdditions.m diff --git a/Classes/Core/NSValue+KiwiAdditions.h b/Sources/Kiwi/Core/NSValue+KiwiAdditions.h similarity index 100% rename from Classes/Core/NSValue+KiwiAdditions.h rename to Sources/Kiwi/Core/NSValue+KiwiAdditions.h diff --git a/Classes/Core/NSValue+KiwiAdditions.m b/Sources/Kiwi/Core/NSValue+KiwiAdditions.m similarity index 100% rename from Classes/Core/NSValue+KiwiAdditions.m rename to Sources/Kiwi/Core/NSValue+KiwiAdditions.m diff --git a/Classes/Matchers/KWBeBetweenMatcher.m b/Sources/Kiwi/Matchers/KWBeBetweenMatcher.m similarity index 100% rename from Classes/Matchers/KWBeBetweenMatcher.m rename to Sources/Kiwi/Matchers/KWBeBetweenMatcher.m diff --git a/Classes/Matchers/KWBeEmptyMatcher.m b/Sources/Kiwi/Matchers/KWBeEmptyMatcher.m similarity index 100% rename from Classes/Matchers/KWBeEmptyMatcher.m rename to Sources/Kiwi/Matchers/KWBeEmptyMatcher.m diff --git a/Classes/Matchers/KWBeIdenticalToMatcher.m b/Sources/Kiwi/Matchers/KWBeIdenticalToMatcher.m similarity index 100% rename from Classes/Matchers/KWBeIdenticalToMatcher.m rename to Sources/Kiwi/Matchers/KWBeIdenticalToMatcher.m diff --git a/Classes/Matchers/KWBeKindOfClassMatcher.m b/Sources/Kiwi/Matchers/KWBeKindOfClassMatcher.m similarity index 100% rename from Classes/Matchers/KWBeKindOfClassMatcher.m rename to Sources/Kiwi/Matchers/KWBeKindOfClassMatcher.m diff --git a/Classes/Matchers/KWBeMemberOfClassMatcher.m b/Sources/Kiwi/Matchers/KWBeMemberOfClassMatcher.m similarity index 100% rename from Classes/Matchers/KWBeMemberOfClassMatcher.m rename to Sources/Kiwi/Matchers/KWBeMemberOfClassMatcher.m diff --git a/Classes/Matchers/KWBeSubclassOfClassMatcher.m b/Sources/Kiwi/Matchers/KWBeSubclassOfClassMatcher.m similarity index 100% rename from Classes/Matchers/KWBeSubclassOfClassMatcher.m rename to Sources/Kiwi/Matchers/KWBeSubclassOfClassMatcher.m diff --git a/Classes/Matchers/KWBeTrueMatcher.m b/Sources/Kiwi/Matchers/KWBeTrueMatcher.m similarity index 100% rename from Classes/Matchers/KWBeTrueMatcher.m rename to Sources/Kiwi/Matchers/KWBeTrueMatcher.m diff --git a/Classes/Matchers/KWBeWithinMatcher.m b/Sources/Kiwi/Matchers/KWBeWithinMatcher.m similarity index 100% rename from Classes/Matchers/KWBeWithinMatcher.m rename to Sources/Kiwi/Matchers/KWBeWithinMatcher.m diff --git a/Classes/Matchers/KWBeZeroMatcher.m b/Sources/Kiwi/Matchers/KWBeZeroMatcher.m similarity index 100% rename from Classes/Matchers/KWBeZeroMatcher.m rename to Sources/Kiwi/Matchers/KWBeZeroMatcher.m diff --git a/Classes/Matchers/KWBlockRaiseMatcher.m b/Sources/Kiwi/Matchers/KWBlockRaiseMatcher.m similarity index 100% rename from Classes/Matchers/KWBlockRaiseMatcher.m rename to Sources/Kiwi/Matchers/KWBlockRaiseMatcher.m diff --git a/Classes/Matchers/KWChangeMatcher.m b/Sources/Kiwi/Matchers/KWChangeMatcher.m similarity index 100% rename from Classes/Matchers/KWChangeMatcher.m rename to Sources/Kiwi/Matchers/KWChangeMatcher.m diff --git a/Classes/Matchers/KWConformToProtocolMatcher.m b/Sources/Kiwi/Matchers/KWConformToProtocolMatcher.m similarity index 100% rename from Classes/Matchers/KWConformToProtocolMatcher.m rename to Sources/Kiwi/Matchers/KWConformToProtocolMatcher.m diff --git a/Classes/Matchers/KWContainMatcher.m b/Sources/Kiwi/Matchers/KWContainMatcher.m similarity index 100% rename from Classes/Matchers/KWContainMatcher.m rename to Sources/Kiwi/Matchers/KWContainMatcher.m diff --git a/Classes/Matchers/KWContainStringMatcher.m b/Sources/Kiwi/Matchers/KWContainStringMatcher.m similarity index 100% rename from Classes/Matchers/KWContainStringMatcher.m rename to Sources/Kiwi/Matchers/KWContainStringMatcher.m diff --git a/Classes/Matchers/KWEqualMatcher.m b/Sources/Kiwi/Matchers/KWEqualMatcher.m similarity index 100% rename from Classes/Matchers/KWEqualMatcher.m rename to Sources/Kiwi/Matchers/KWEqualMatcher.m diff --git a/Classes/Matchers/KWGenericMatchEvaluator.h b/Sources/Kiwi/Matchers/KWGenericMatchEvaluator.h similarity index 100% rename from Classes/Matchers/KWGenericMatchEvaluator.h rename to Sources/Kiwi/Matchers/KWGenericMatchEvaluator.h diff --git a/Classes/Matchers/KWGenericMatchEvaluator.m b/Sources/Kiwi/Matchers/KWGenericMatchEvaluator.m similarity index 100% rename from Classes/Matchers/KWGenericMatchEvaluator.m rename to Sources/Kiwi/Matchers/KWGenericMatchEvaluator.m diff --git a/Classes/Matchers/KWGenericMatcher.m b/Sources/Kiwi/Matchers/KWGenericMatcher.m similarity index 100% rename from Classes/Matchers/KWGenericMatcher.m rename to Sources/Kiwi/Matchers/KWGenericMatcher.m diff --git a/Classes/Matchers/KWGenericMatchingAdditions.h b/Sources/Kiwi/Matchers/KWGenericMatchingAdditions.h similarity index 100% rename from Classes/Matchers/KWGenericMatchingAdditions.h rename to Sources/Kiwi/Matchers/KWGenericMatchingAdditions.h diff --git a/Classes/Matchers/KWGenericMatchingAdditions.m b/Sources/Kiwi/Matchers/KWGenericMatchingAdditions.m similarity index 100% rename from Classes/Matchers/KWGenericMatchingAdditions.m rename to Sources/Kiwi/Matchers/KWGenericMatchingAdditions.m diff --git a/Classes/Matchers/KWHaveMatcher.m b/Sources/Kiwi/Matchers/KWHaveMatcher.m similarity index 100% rename from Classes/Matchers/KWHaveMatcher.m rename to Sources/Kiwi/Matchers/KWHaveMatcher.m diff --git a/Classes/Matchers/KWHaveValueMatcher.m b/Sources/Kiwi/Matchers/KWHaveValueMatcher.m similarity index 100% rename from Classes/Matchers/KWHaveValueMatcher.m rename to Sources/Kiwi/Matchers/KWHaveValueMatcher.m diff --git a/Classes/Matchers/KWInequalityMatcher.m b/Sources/Kiwi/Matchers/KWInequalityMatcher.m similarity index 100% rename from Classes/Matchers/KWInequalityMatcher.m rename to Sources/Kiwi/Matchers/KWInequalityMatcher.m diff --git a/Classes/Matchers/KWNilMatcher.m b/Sources/Kiwi/Matchers/KWNilMatcher.m similarity index 100% rename from Classes/Matchers/KWNilMatcher.m rename to Sources/Kiwi/Matchers/KWNilMatcher.m diff --git a/Classes/Matchers/KWNotificationMatcher.m b/Sources/Kiwi/Matchers/KWNotificationMatcher.m similarity index 89% rename from Classes/Matchers/KWNotificationMatcher.m rename to Sources/Kiwi/Matchers/KWNotificationMatcher.m index 2494d303..e1920763 100644 --- a/Classes/Matchers/KWNotificationMatcher.m +++ b/Sources/Kiwi/Matchers/KWNotificationMatcher.m @@ -45,16 +45,32 @@ - (void)addObserver { if (self.evaluationBlock) { self.evaluationBlock(note); } + if (self.didReceiveNotification) { + [self removeObserver]; + } }]; } +- (void)removeObserver { + if (self.observer) { + [[NSNotificationCenter defaultCenter] removeObserver:self.observer]; + self.observer = nil; + } +} + #pragma mark - Matching - (BOOL)evaluate { - [[NSNotificationCenter defaultCenter] removeObserver:self.observer]; + if (!self.willEvaluateMultipleTimes) { + [self removeObserver]; + } return self.didReceiveNotification; } +- (void)dealloc { + [self removeObserver]; +} + - (BOOL)shouldBeEvaluatedAtEndOfExample { return YES; } diff --git a/Classes/Matchers/KWReceiveMatcher.m b/Sources/Kiwi/Matchers/KWReceiveMatcher.m similarity index 100% rename from Classes/Matchers/KWReceiveMatcher.m rename to Sources/Kiwi/Matchers/KWReceiveMatcher.m diff --git a/Classes/Matchers/KWRegularExpressionPatternMatcher.m b/Sources/Kiwi/Matchers/KWRegularExpressionPatternMatcher.m similarity index 100% rename from Classes/Matchers/KWRegularExpressionPatternMatcher.m rename to Sources/Kiwi/Matchers/KWRegularExpressionPatternMatcher.m diff --git a/Classes/Matchers/KWRespondToSelectorMatcher.m b/Sources/Kiwi/Matchers/KWRespondToSelectorMatcher.m similarity index 100% rename from Classes/Matchers/KWRespondToSelectorMatcher.m rename to Sources/Kiwi/Matchers/KWRespondToSelectorMatcher.m diff --git a/Classes/Matchers/KWStringContainsMatcher.m b/Sources/Kiwi/Matchers/KWStringContainsMatcher.m similarity index 100% rename from Classes/Matchers/KWStringContainsMatcher.m rename to Sources/Kiwi/Matchers/KWStringContainsMatcher.m diff --git a/Classes/Matchers/KWStringPrefixMatcher.m b/Sources/Kiwi/Matchers/KWStringPrefixMatcher.m similarity index 100% rename from Classes/Matchers/KWStringPrefixMatcher.m rename to Sources/Kiwi/Matchers/KWStringPrefixMatcher.m diff --git a/Classes/Matchers/KWUserDefinedMatcher.m b/Sources/Kiwi/Matchers/KWUserDefinedMatcher.m similarity index 100% rename from Classes/Matchers/KWUserDefinedMatcher.m rename to Sources/Kiwi/Matchers/KWUserDefinedMatcher.m diff --git a/Classes/Mocking/KWMock.m b/Sources/Kiwi/Mocking/KWMock.m similarity index 100% rename from Classes/Mocking/KWMock.m rename to Sources/Kiwi/Mocking/KWMock.m diff --git a/Classes/Mocking/NSObject+KiwiMockAdditions.m b/Sources/Kiwi/Mocking/NSObject+KiwiMockAdditions.m similarity index 100% rename from Classes/Mocking/NSObject+KiwiMockAdditions.m rename to Sources/Kiwi/Mocking/NSObject+KiwiMockAdditions.m diff --git a/Classes/Nodes/KWAfterAllNode.m b/Sources/Kiwi/Nodes/KWAfterAllNode.m similarity index 100% rename from Classes/Nodes/KWAfterAllNode.m rename to Sources/Kiwi/Nodes/KWAfterAllNode.m diff --git a/Classes/Nodes/KWAfterEachNode.m b/Sources/Kiwi/Nodes/KWAfterEachNode.m similarity index 100% rename from Classes/Nodes/KWAfterEachNode.m rename to Sources/Kiwi/Nodes/KWAfterEachNode.m diff --git a/Classes/Nodes/KWBeforeAllNode.m b/Sources/Kiwi/Nodes/KWBeforeAllNode.m similarity index 100% rename from Classes/Nodes/KWBeforeAllNode.m rename to Sources/Kiwi/Nodes/KWBeforeAllNode.m diff --git a/Classes/Nodes/KWBeforeEachNode.m b/Sources/Kiwi/Nodes/KWBeforeEachNode.m similarity index 100% rename from Classes/Nodes/KWBeforeEachNode.m rename to Sources/Kiwi/Nodes/KWBeforeEachNode.m diff --git a/Classes/Nodes/KWBlockNode.m b/Sources/Kiwi/Nodes/KWBlockNode.m similarity index 100% rename from Classes/Nodes/KWBlockNode.m rename to Sources/Kiwi/Nodes/KWBlockNode.m diff --git a/Classes/Nodes/KWContextNode.m b/Sources/Kiwi/Nodes/KWContextNode.m similarity index 100% rename from Classes/Nodes/KWContextNode.m rename to Sources/Kiwi/Nodes/KWContextNode.m diff --git a/Classes/Nodes/KWItNode.m b/Sources/Kiwi/Nodes/KWItNode.m similarity index 100% rename from Classes/Nodes/KWItNode.m rename to Sources/Kiwi/Nodes/KWItNode.m diff --git a/Classes/Nodes/KWLetNode.h b/Sources/Kiwi/Nodes/KWLetNode.h similarity index 100% rename from Classes/Nodes/KWLetNode.h rename to Sources/Kiwi/Nodes/KWLetNode.h diff --git a/Classes/Nodes/KWLetNode.m b/Sources/Kiwi/Nodes/KWLetNode.m similarity index 100% rename from Classes/Nodes/KWLetNode.m rename to Sources/Kiwi/Nodes/KWLetNode.m diff --git a/Classes/Nodes/KWPendingNode.m b/Sources/Kiwi/Nodes/KWPendingNode.m similarity index 100% rename from Classes/Nodes/KWPendingNode.m rename to Sources/Kiwi/Nodes/KWPendingNode.m diff --git a/Classes/Nodes/KWRegisterMatchersNode.m b/Sources/Kiwi/Nodes/KWRegisterMatchersNode.m similarity index 100% rename from Classes/Nodes/KWRegisterMatchersNode.m rename to Sources/Kiwi/Nodes/KWRegisterMatchersNode.m diff --git a/Classes/Shared Examples/KWSharedExample.m b/Sources/Kiwi/Shared Examples/KWSharedExample.m similarity index 100% rename from Classes/Shared Examples/KWSharedExample.m rename to Sources/Kiwi/Shared Examples/KWSharedExample.m diff --git a/Classes/Shared Examples/KWSharedExampleRegistry.h b/Sources/Kiwi/Shared Examples/KWSharedExampleRegistry.h similarity index 100% rename from Classes/Shared Examples/KWSharedExampleRegistry.h rename to Sources/Kiwi/Shared Examples/KWSharedExampleRegistry.h diff --git a/Classes/Shared Examples/KWSharedExampleRegistry.m b/Sources/Kiwi/Shared Examples/KWSharedExampleRegistry.m similarity index 100% rename from Classes/Shared Examples/KWSharedExampleRegistry.m rename to Sources/Kiwi/Shared Examples/KWSharedExampleRegistry.m diff --git a/Classes/Stubbing/KWIntercept.h b/Sources/Kiwi/Stubbing/KWIntercept.h similarity index 100% rename from Classes/Stubbing/KWIntercept.h rename to Sources/Kiwi/Stubbing/KWIntercept.h diff --git a/Classes/Stubbing/KWIntercept.m b/Sources/Kiwi/Stubbing/KWIntercept.m similarity index 90% rename from Classes/Stubbing/KWIntercept.m rename to Sources/Kiwi/Stubbing/KWIntercept.m index 2e300e0e..9e4d817e 100644 --- a/Classes/Stubbing/KWIntercept.m +++ b/Sources/Kiwi/Stubbing/KWIntercept.m @@ -37,6 +37,8 @@ void KWInterceptedDealloc(id anObject, SEL aSelector); Class KWInterceptedClass(id anObject, SEL aSelector); Class KWInterceptedSuperclass(id anObject, SEL aSelector); +BOOL KWInterceptedSupportsSecureCodingTrue(id anObject, SEL aSelector); +BOOL KWInterceptedSupportsSecureCodingFalse(id anObject, SEL aSelector); #pragma mark - Getting Forwarding Implementations @@ -120,6 +122,22 @@ Class KWInterceptClassForCanonicalClass(Class canonicalClass) { Class interceptMetaClass = object_getClass(interceptClass); class_addMethod(interceptMetaClass, @selector(forwardInvocation:), (IMP)KWInterceptedForwardInvocation, "v@:@"); + // The code above intercepts secure coding (`+ (BOOL)supportsSecureCoding`) for the class. + // Why do we need a special interception for this method? + // Because there is a verification in Foundation that ensures secure coding support in many ways and + // without this interception you can face exceptions during mockings some system classes like NSDate. + SEL supportsSecureCodingSelector = @selector(supportsSecureCoding); + Method supportsSecureCodingMethod = class_getClassMethod(canonicalClass, supportsSecureCodingSelector); + if (supportsSecureCodingMethod != NULL) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + BOOL support = (BOOL)[(id)canonicalClass performSelector:supportsSecureCodingSelector]; +#pragma clang diagnostic pop + IMP supportsSecureCodingIMP = support ? (IMP)KWInterceptedSupportsSecureCodingTrue + : (IMP)KWInterceptedSupportsSecureCodingFalse; + class_addMethod(interceptMetaClass, supportsSecureCodingSelector, supportsSecureCodingIMP, "B@:"); + } + return interceptClass; } @@ -223,6 +241,14 @@ Class KWInterceptedSuperclass(id anObject, SEL aSelector) { return originalSuperclass; } +BOOL KWInterceptedSupportsSecureCodingTrue(id anObject, SEL aSelector) { + return YES; +} + +BOOL KWInterceptedSupportsSecureCodingFalse(id anObject, SEL aSelector) { + return NO; +} + #pragma mark - Managing Objects Stubs void KWAssociateObjectStub(id anObject, KWStub *aStub, BOOL overrideExisting) { diff --git a/Classes/Stubbing/KWStub.m b/Sources/Kiwi/Stubbing/KWStub.m similarity index 100% rename from Classes/Stubbing/KWStub.m rename to Sources/Kiwi/Stubbing/KWStub.m diff --git a/Classes/Stubbing/NSObject+KiwiStubAdditions.m b/Sources/Kiwi/Stubbing/NSObject+KiwiStubAdditions.m similarity index 91% rename from Classes/Stubbing/NSObject+KiwiStubAdditions.m rename to Sources/Kiwi/Stubbing/NSObject+KiwiStubAdditions.m index bf0e0358..8124687a 100644 --- a/Classes/Stubbing/NSObject+KiwiStubAdditions.m +++ b/Sources/Kiwi/Stubbing/NSObject+KiwiStubAdditions.m @@ -113,20 +113,6 @@ + (void)stub:(SEL)aSelector andReturn:(id)aValue times:(NSNumber *)times afterTh [self stubMessagePattern:messagePattern andReturn:aValue times:times afterThatReturn:aSecondValue]; } -- (id)stub { - return [KWInvocationCapturer invocationCapturerWithDelegate:self]; -} - -- (id)stubAndReturn:(id)aValue { - NSDictionary *userInfo = @{StubValueKey: aValue}; - return [KWInvocationCapturer invocationCapturerWithDelegate:self userInfo:userInfo]; -} - -- (id)stubAndReturn:(id)aValue times:(id)times afterThatReturn:(id)aSecondValue { - NSDictionary *userInfo = @{StubValueKey: aValue, ChangeStubValueAfterTimesKey: times, StubSecondValueKey: aSecondValue}; - return [KWInvocationCapturer invocationCapturerWithDelegate:self userInfo:userInfo]; -} - - (void)stubMessagePattern:(KWMessagePattern *)aMessagePattern andReturn:(id)aValue { [self stubMessagePattern:aMessagePattern andReturn:aValue overrideExisting:YES]; } @@ -236,12 +222,6 @@ - (void)removeMessageSpy:(id)aSpy forMessagePattern:(KWMessageP KWClearObjectSpy(self, aSpy, aMessagePattern); } -- (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index { - KWCaptureSpy *spy = [[KWCaptureSpy alloc] initWithArgumentIndex:index]; - [self addMessageSpy:spy forMessagePattern:[KWMessagePattern messagePatternWithSelector:selector]]; - return spy; -} - + (void)addMessageSpy:(id)aSpy forMessagePattern:(KWMessagePattern *)aMessagePattern { if ([self methodSignatureForSelector:aMessagePattern.selector] == nil) { [NSException raise:@"KWSpyException" format:@"cannot add spy for -%@ because no such method exists", @@ -257,10 +237,4 @@ + (void)removeMessageSpy:(id)aSpy forMessagePattern:(KWMessageP KWClearObjectSpy(self, aSpy, aMessagePattern); } -+ (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index { - KWCaptureSpy *spy = [[KWCaptureSpy alloc] initWithArgumentIndex:index]; - [self addMessageSpy:spy forMessagePattern:[KWMessagePattern messagePatternWithSelector:selector]]; - return spy; -} - @end diff --git a/Classes/Verifiers/KWAsyncVerifier.m b/Sources/Kiwi/Verifiers/KWAsyncVerifier.m similarity index 100% rename from Classes/Verifiers/KWAsyncVerifier.m rename to Sources/Kiwi/Verifiers/KWAsyncVerifier.m diff --git a/Classes/Verifiers/KWExistVerifier.m b/Sources/Kiwi/Verifiers/KWExistVerifier.m similarity index 100% rename from Classes/Verifiers/KWExistVerifier.m rename to Sources/Kiwi/Verifiers/KWExistVerifier.m diff --git a/Classes/Verifiers/KWMatchVerifier.m b/Sources/Kiwi/Verifiers/KWMatchVerifier.m similarity index 100% rename from Classes/Verifiers/KWMatchVerifier.m rename to Sources/Kiwi/Verifiers/KWMatchVerifier.m diff --git a/Classes/Nodes/KWAfterAllNode.h b/Sources/Kiwi/include/Kiwi/KWAfterAllNode.h similarity index 100% rename from Classes/Nodes/KWAfterAllNode.h rename to Sources/Kiwi/include/Kiwi/KWAfterAllNode.h diff --git a/Classes/Nodes/KWAfterEachNode.h b/Sources/Kiwi/include/Kiwi/KWAfterEachNode.h similarity index 100% rename from Classes/Nodes/KWAfterEachNode.h rename to Sources/Kiwi/include/Kiwi/KWAfterEachNode.h diff --git a/Classes/Core/KWAny.h b/Sources/Kiwi/include/Kiwi/KWAny.h similarity index 100% rename from Classes/Core/KWAny.h rename to Sources/Kiwi/include/Kiwi/KWAny.h diff --git a/Classes/Verifiers/KWAsyncVerifier.h b/Sources/Kiwi/include/Kiwi/KWAsyncVerifier.h similarity index 100% rename from Classes/Verifiers/KWAsyncVerifier.h rename to Sources/Kiwi/include/Kiwi/KWAsyncVerifier.h diff --git a/Classes/Matchers/KWBeBetweenMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeBetweenMatcher.h similarity index 100% rename from Classes/Matchers/KWBeBetweenMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeBetweenMatcher.h diff --git a/Classes/Matchers/KWBeEmptyMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeEmptyMatcher.h similarity index 100% rename from Classes/Matchers/KWBeEmptyMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeEmptyMatcher.h diff --git a/Classes/Matchers/KWBeIdenticalToMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeIdenticalToMatcher.h similarity index 100% rename from Classes/Matchers/KWBeIdenticalToMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeIdenticalToMatcher.h diff --git a/Classes/Matchers/KWBeKindOfClassMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeKindOfClassMatcher.h similarity index 100% rename from Classes/Matchers/KWBeKindOfClassMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeKindOfClassMatcher.h diff --git a/Classes/Matchers/KWBeMemberOfClassMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeMemberOfClassMatcher.h similarity index 100% rename from Classes/Matchers/KWBeMemberOfClassMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeMemberOfClassMatcher.h diff --git a/Classes/Matchers/KWBeSubclassOfClassMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeSubclassOfClassMatcher.h similarity index 100% rename from Classes/Matchers/KWBeSubclassOfClassMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeSubclassOfClassMatcher.h diff --git a/Classes/Matchers/KWBeTrueMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeTrueMatcher.h similarity index 100% rename from Classes/Matchers/KWBeTrueMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeTrueMatcher.h diff --git a/Classes/Matchers/KWBeWithinMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeWithinMatcher.h similarity index 100% rename from Classes/Matchers/KWBeWithinMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeWithinMatcher.h diff --git a/Classes/Matchers/KWBeZeroMatcher.h b/Sources/Kiwi/include/Kiwi/KWBeZeroMatcher.h similarity index 100% rename from Classes/Matchers/KWBeZeroMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBeZeroMatcher.h diff --git a/Classes/Nodes/KWBeforeAllNode.h b/Sources/Kiwi/include/Kiwi/KWBeforeAllNode.h similarity index 100% rename from Classes/Nodes/KWBeforeAllNode.h rename to Sources/Kiwi/include/Kiwi/KWBeforeAllNode.h diff --git a/Classes/Nodes/KWBeforeEachNode.h b/Sources/Kiwi/include/Kiwi/KWBeforeEachNode.h similarity index 100% rename from Classes/Nodes/KWBeforeEachNode.h rename to Sources/Kiwi/include/Kiwi/KWBeforeEachNode.h diff --git a/Classes/Core/KWBlock.h b/Sources/Kiwi/include/Kiwi/KWBlock.h similarity index 100% rename from Classes/Core/KWBlock.h rename to Sources/Kiwi/include/Kiwi/KWBlock.h diff --git a/Classes/Nodes/KWBlockNode.h b/Sources/Kiwi/include/Kiwi/KWBlockNode.h similarity index 100% rename from Classes/Nodes/KWBlockNode.h rename to Sources/Kiwi/include/Kiwi/KWBlockNode.h diff --git a/Classes/Matchers/KWBlockRaiseMatcher.h b/Sources/Kiwi/include/Kiwi/KWBlockRaiseMatcher.h similarity index 100% rename from Classes/Matchers/KWBlockRaiseMatcher.h rename to Sources/Kiwi/include/Kiwi/KWBlockRaiseMatcher.h diff --git a/Classes/Core/KWCallSite.h b/Sources/Kiwi/include/Kiwi/KWCallSite.h similarity index 100% rename from Classes/Core/KWCallSite.h rename to Sources/Kiwi/include/Kiwi/KWCallSite.h diff --git a/Classes/Core/KWCaptureSpy.h b/Sources/Kiwi/include/Kiwi/KWCaptureSpy.h similarity index 100% rename from Classes/Core/KWCaptureSpy.h rename to Sources/Kiwi/include/Kiwi/KWCaptureSpy.h diff --git a/Classes/Matchers/KWChangeMatcher.h b/Sources/Kiwi/include/Kiwi/KWChangeMatcher.h similarity index 100% rename from Classes/Matchers/KWChangeMatcher.h rename to Sources/Kiwi/include/Kiwi/KWChangeMatcher.h diff --git a/Classes/Matchers/KWConformToProtocolMatcher.h b/Sources/Kiwi/include/Kiwi/KWConformToProtocolMatcher.h similarity index 100% rename from Classes/Matchers/KWConformToProtocolMatcher.h rename to Sources/Kiwi/include/Kiwi/KWConformToProtocolMatcher.h diff --git a/Classes/Matchers/KWContainMatcher.h b/Sources/Kiwi/include/Kiwi/KWContainMatcher.h similarity index 100% rename from Classes/Matchers/KWContainMatcher.h rename to Sources/Kiwi/include/Kiwi/KWContainMatcher.h diff --git a/Classes/Matchers/KWContainStringMatcher.h b/Sources/Kiwi/include/Kiwi/KWContainStringMatcher.h similarity index 100% rename from Classes/Matchers/KWContainStringMatcher.h rename to Sources/Kiwi/include/Kiwi/KWContainStringMatcher.h diff --git a/Classes/Nodes/KWContextNode.h b/Sources/Kiwi/include/Kiwi/KWContextNode.h similarity index 100% rename from Classes/Nodes/KWContextNode.h rename to Sources/Kiwi/include/Kiwi/KWContextNode.h diff --git a/Classes/Core/KWCountType.h b/Sources/Kiwi/include/Kiwi/KWCountType.h similarity index 100% rename from Classes/Core/KWCountType.h rename to Sources/Kiwi/include/Kiwi/KWCountType.h diff --git a/Classes/Core/KWDeviceInfo.h b/Sources/Kiwi/include/Kiwi/KWDeviceInfo.h similarity index 100% rename from Classes/Core/KWDeviceInfo.h rename to Sources/Kiwi/include/Kiwi/KWDeviceInfo.h diff --git a/Classes/Matchers/KWEqualMatcher.h b/Sources/Kiwi/include/Kiwi/KWEqualMatcher.h similarity index 100% rename from Classes/Matchers/KWEqualMatcher.h rename to Sources/Kiwi/include/Kiwi/KWEqualMatcher.h diff --git a/Classes/Core/KWExample.h b/Sources/Kiwi/include/Kiwi/KWExample.h similarity index 100% rename from Classes/Core/KWExample.h rename to Sources/Kiwi/include/Kiwi/KWExample.h diff --git a/Classes/Core/KWExampleDelegate.h b/Sources/Kiwi/include/Kiwi/KWExampleDelegate.h similarity index 100% rename from Classes/Core/KWExampleDelegate.h rename to Sources/Kiwi/include/Kiwi/KWExampleDelegate.h diff --git a/Classes/Nodes/KWExampleNode.h b/Sources/Kiwi/include/Kiwi/KWExampleNode.h similarity index 100% rename from Classes/Nodes/KWExampleNode.h rename to Sources/Kiwi/include/Kiwi/KWExampleNode.h diff --git a/Classes/Core/KWExampleNodeVisitor.h b/Sources/Kiwi/include/Kiwi/KWExampleNodeVisitor.h similarity index 100% rename from Classes/Core/KWExampleNodeVisitor.h rename to Sources/Kiwi/include/Kiwi/KWExampleNodeVisitor.h diff --git a/Classes/Core/KWExampleSuiteBuilder.h b/Sources/Kiwi/include/Kiwi/KWExampleSuiteBuilder.h similarity index 100% rename from Classes/Core/KWExampleSuiteBuilder.h rename to Sources/Kiwi/include/Kiwi/KWExampleSuiteBuilder.h diff --git a/Classes/Verifiers/KWExistVerifier.h b/Sources/Kiwi/include/Kiwi/KWExistVerifier.h similarity index 100% rename from Classes/Verifiers/KWExistVerifier.h rename to Sources/Kiwi/include/Kiwi/KWExistVerifier.h diff --git a/Classes/Core/KWExpectationType.h b/Sources/Kiwi/include/Kiwi/KWExpectationType.h similarity index 100% rename from Classes/Core/KWExpectationType.h rename to Sources/Kiwi/include/Kiwi/KWExpectationType.h diff --git a/Classes/Core/KWFailure.h b/Sources/Kiwi/include/Kiwi/KWFailure.h similarity index 100% rename from Classes/Core/KWFailure.h rename to Sources/Kiwi/include/Kiwi/KWFailure.h diff --git a/Classes/Core/KWFormatter.h b/Sources/Kiwi/include/Kiwi/KWFormatter.h similarity index 100% rename from Classes/Core/KWFormatter.h rename to Sources/Kiwi/include/Kiwi/KWFormatter.h diff --git a/Classes/Core/KWFutureObject.h b/Sources/Kiwi/include/Kiwi/KWFutureObject.h similarity index 100% rename from Classes/Core/KWFutureObject.h rename to Sources/Kiwi/include/Kiwi/KWFutureObject.h diff --git a/Classes/Matchers/KWGenericMatcher.h b/Sources/Kiwi/include/Kiwi/KWGenericMatcher.h similarity index 100% rename from Classes/Matchers/KWGenericMatcher.h rename to Sources/Kiwi/include/Kiwi/KWGenericMatcher.h diff --git a/Classes/Matchers/KWHaveMatcher.h b/Sources/Kiwi/include/Kiwi/KWHaveMatcher.h similarity index 100% rename from Classes/Matchers/KWHaveMatcher.h rename to Sources/Kiwi/include/Kiwi/KWHaveMatcher.h diff --git a/Classes/Matchers/KWHaveValueMatcher.h b/Sources/Kiwi/include/Kiwi/KWHaveValueMatcher.h similarity index 100% rename from Classes/Matchers/KWHaveValueMatcher.h rename to Sources/Kiwi/include/Kiwi/KWHaveValueMatcher.h diff --git a/Classes/Matchers/KWInequalityMatcher.h b/Sources/Kiwi/include/Kiwi/KWInequalityMatcher.h similarity index 100% rename from Classes/Matchers/KWInequalityMatcher.h rename to Sources/Kiwi/include/Kiwi/KWInequalityMatcher.h diff --git a/Classes/Core/KWInvocationCapturer.h b/Sources/Kiwi/include/Kiwi/KWInvocationCapturer.h similarity index 100% rename from Classes/Core/KWInvocationCapturer.h rename to Sources/Kiwi/include/Kiwi/KWInvocationCapturer.h diff --git a/Classes/Nodes/KWItNode.h b/Sources/Kiwi/include/Kiwi/KWItNode.h similarity index 100% rename from Classes/Nodes/KWItNode.h rename to Sources/Kiwi/include/Kiwi/KWItNode.h diff --git a/Classes/Core/KWLet.h b/Sources/Kiwi/include/Kiwi/KWLet.h similarity index 100% rename from Classes/Core/KWLet.h rename to Sources/Kiwi/include/Kiwi/KWLet.h diff --git a/Classes/Verifiers/KWMatchVerifier.h b/Sources/Kiwi/include/Kiwi/KWMatchVerifier.h similarity index 100% rename from Classes/Verifiers/KWMatchVerifier.h rename to Sources/Kiwi/include/Kiwi/KWMatchVerifier.h diff --git a/Classes/Core/KWMatcher.h b/Sources/Kiwi/include/Kiwi/KWMatcher.h similarity index 100% rename from Classes/Core/KWMatcher.h rename to Sources/Kiwi/include/Kiwi/KWMatcher.h diff --git a/Classes/Core/KWMatcherFactory.h b/Sources/Kiwi/include/Kiwi/KWMatcherFactory.h similarity index 100% rename from Classes/Core/KWMatcherFactory.h rename to Sources/Kiwi/include/Kiwi/KWMatcherFactory.h diff --git a/Classes/Core/KWMatchers.h b/Sources/Kiwi/include/Kiwi/KWMatchers.h similarity index 100% rename from Classes/Core/KWMatchers.h rename to Sources/Kiwi/include/Kiwi/KWMatchers.h diff --git a/Classes/Core/KWMatching.h b/Sources/Kiwi/include/Kiwi/KWMatching.h similarity index 100% rename from Classes/Core/KWMatching.h rename to Sources/Kiwi/include/Kiwi/KWMatching.h diff --git a/Classes/Core/KWMessagePattern.h b/Sources/Kiwi/include/Kiwi/KWMessagePattern.h similarity index 100% rename from Classes/Core/KWMessagePattern.h rename to Sources/Kiwi/include/Kiwi/KWMessagePattern.h diff --git a/Classes/Core/KWMessageSpying.h b/Sources/Kiwi/include/Kiwi/KWMessageSpying.h similarity index 100% rename from Classes/Core/KWMessageSpying.h rename to Sources/Kiwi/include/Kiwi/KWMessageSpying.h diff --git a/Classes/Mocking/KWMock.h b/Sources/Kiwi/include/Kiwi/KWMock.h similarity index 100% rename from Classes/Mocking/KWMock.h rename to Sources/Kiwi/include/Kiwi/KWMock.h diff --git a/Classes/Matchers/KWNilMatcher.h b/Sources/Kiwi/include/Kiwi/KWNilMatcher.h similarity index 100% rename from Classes/Matchers/KWNilMatcher.h rename to Sources/Kiwi/include/Kiwi/KWNilMatcher.h diff --git a/Classes/Matchers/KWNotificationMatcher.h b/Sources/Kiwi/include/Kiwi/KWNotificationMatcher.h similarity index 88% rename from Classes/Matchers/KWNotificationMatcher.h rename to Sources/Kiwi/include/Kiwi/KWNotificationMatcher.h index fb48d73e..5bdc3778 100644 --- a/Classes/Matchers/KWNotificationMatcher.h +++ b/Sources/Kiwi/include/Kiwi/KWNotificationMatcher.h @@ -18,4 +18,6 @@ typedef void (^PostedNotificationBlock)(NSNotification* note); - (void)bePostedWithObject:(id)object userInfo:(NSDictionary *)userInfo; - (void)bePostedEvaluatingBlock:(PostedNotificationBlock)block; +#pragma mark - KWMatching +@property (nonatomic, assign) BOOL willEvaluateMultipleTimes; @end diff --git a/Classes/Core/KWNull.h b/Sources/Kiwi/include/Kiwi/KWNull.h similarity index 100% rename from Classes/Core/KWNull.h rename to Sources/Kiwi/include/Kiwi/KWNull.h diff --git a/Classes/Core/KWObjCUtilities.h b/Sources/Kiwi/include/Kiwi/KWObjCUtilities.h similarity index 100% rename from Classes/Core/KWObjCUtilities.h rename to Sources/Kiwi/include/Kiwi/KWObjCUtilities.h diff --git a/Classes/Nodes/KWPendingNode.h b/Sources/Kiwi/include/Kiwi/KWPendingNode.h similarity index 100% rename from Classes/Nodes/KWPendingNode.h rename to Sources/Kiwi/include/Kiwi/KWPendingNode.h diff --git a/Classes/Core/KWProbe.h b/Sources/Kiwi/include/Kiwi/KWProbe.h similarity index 100% rename from Classes/Core/KWProbe.h rename to Sources/Kiwi/include/Kiwi/KWProbe.h diff --git a/Classes/Matchers/KWReceiveMatcher.h b/Sources/Kiwi/include/Kiwi/KWReceiveMatcher.h similarity index 100% rename from Classes/Matchers/KWReceiveMatcher.h rename to Sources/Kiwi/include/Kiwi/KWReceiveMatcher.h diff --git a/Classes/Nodes/KWRegisterMatchersNode.h b/Sources/Kiwi/include/Kiwi/KWRegisterMatchersNode.h similarity index 100% rename from Classes/Nodes/KWRegisterMatchersNode.h rename to Sources/Kiwi/include/Kiwi/KWRegisterMatchersNode.h diff --git a/Classes/Matchers/KWRegularExpressionPatternMatcher.h b/Sources/Kiwi/include/Kiwi/KWRegularExpressionPatternMatcher.h similarity index 100% rename from Classes/Matchers/KWRegularExpressionPatternMatcher.h rename to Sources/Kiwi/include/Kiwi/KWRegularExpressionPatternMatcher.h diff --git a/Classes/Core/KWReporting.h b/Sources/Kiwi/include/Kiwi/KWReporting.h similarity index 100% rename from Classes/Core/KWReporting.h rename to Sources/Kiwi/include/Kiwi/KWReporting.h diff --git a/Classes/Matchers/KWRespondToSelectorMatcher.h b/Sources/Kiwi/include/Kiwi/KWRespondToSelectorMatcher.h similarity index 100% rename from Classes/Matchers/KWRespondToSelectorMatcher.h rename to Sources/Kiwi/include/Kiwi/KWRespondToSelectorMatcher.h diff --git a/Classes/Shared Examples/KWSharedExample.h b/Sources/Kiwi/include/Kiwi/KWSharedExample.h similarity index 100% rename from Classes/Shared Examples/KWSharedExample.h rename to Sources/Kiwi/include/Kiwi/KWSharedExample.h diff --git a/Classes/Core/KWSpec.h b/Sources/Kiwi/include/Kiwi/KWSpec.h similarity index 100% rename from Classes/Core/KWSpec.h rename to Sources/Kiwi/include/Kiwi/KWSpec.h diff --git a/Classes/Matchers/KWStringContainsMatcher.h b/Sources/Kiwi/include/Kiwi/KWStringContainsMatcher.h similarity index 100% rename from Classes/Matchers/KWStringContainsMatcher.h rename to Sources/Kiwi/include/Kiwi/KWStringContainsMatcher.h diff --git a/Classes/Matchers/KWStringPrefixMatcher.h b/Sources/Kiwi/include/Kiwi/KWStringPrefixMatcher.h similarity index 100% rename from Classes/Matchers/KWStringPrefixMatcher.h rename to Sources/Kiwi/include/Kiwi/KWStringPrefixMatcher.h diff --git a/Classes/Core/KWStringUtilities.h b/Sources/Kiwi/include/Kiwi/KWStringUtilities.h similarity index 100% rename from Classes/Core/KWStringUtilities.h rename to Sources/Kiwi/include/Kiwi/KWStringUtilities.h diff --git a/Classes/Stubbing/KWStub.h b/Sources/Kiwi/include/Kiwi/KWStub.h similarity index 100% rename from Classes/Stubbing/KWStub.h rename to Sources/Kiwi/include/Kiwi/KWStub.h diff --git a/Classes/Config/KWSuiteConfigurationBase.h b/Sources/Kiwi/include/Kiwi/KWSuiteConfigurationBase.h similarity index 100% rename from Classes/Config/KWSuiteConfigurationBase.h rename to Sources/Kiwi/include/Kiwi/KWSuiteConfigurationBase.h diff --git a/Classes/Matchers/KWUserDefinedMatcher.h b/Sources/Kiwi/include/Kiwi/KWUserDefinedMatcher.h similarity index 100% rename from Classes/Matchers/KWUserDefinedMatcher.h rename to Sources/Kiwi/include/Kiwi/KWUserDefinedMatcher.h diff --git a/Classes/Core/KWValue.h b/Sources/Kiwi/include/Kiwi/KWValue.h similarity index 100% rename from Classes/Core/KWValue.h rename to Sources/Kiwi/include/Kiwi/KWValue.h diff --git a/Classes/Verifiers/KWVerifying.h b/Sources/Kiwi/include/Kiwi/KWVerifying.h similarity index 100% rename from Classes/Verifiers/KWVerifying.h rename to Sources/Kiwi/include/Kiwi/KWVerifying.h diff --git a/Classes/Core/Kiwi.h b/Sources/Kiwi/include/Kiwi/Kiwi.h similarity index 100% rename from Classes/Core/Kiwi.h rename to Sources/Kiwi/include/Kiwi/Kiwi.h diff --git a/Classes/Core/KiwiBlockMacros.h b/Sources/Kiwi/include/Kiwi/KiwiBlockMacros.h similarity index 100% rename from Classes/Core/KiwiBlockMacros.h rename to Sources/Kiwi/include/Kiwi/KiwiBlockMacros.h diff --git a/Classes/Core/KiwiConfiguration.h b/Sources/Kiwi/include/Kiwi/KiwiConfiguration.h similarity index 100% rename from Classes/Core/KiwiConfiguration.h rename to Sources/Kiwi/include/Kiwi/KiwiConfiguration.h diff --git a/Classes/Core/KiwiMacros.h b/Sources/Kiwi/include/Kiwi/KiwiMacros.h similarity index 100% rename from Classes/Core/KiwiMacros.h rename to Sources/Kiwi/include/Kiwi/KiwiMacros.h diff --git a/Classes/Mocking/NSObject+KiwiMockAdditions.h b/Sources/Kiwi/include/Kiwi/NSObject+KiwiMockAdditions.h similarity index 100% rename from Classes/Mocking/NSObject+KiwiMockAdditions.h rename to Sources/Kiwi/include/Kiwi/NSObject+KiwiMockAdditions.h diff --git a/Classes/Core/NSObject+KiwiSpyAdditions.h b/Sources/Kiwi/include/Kiwi/NSObject+KiwiSpyAdditions.h similarity index 100% rename from Classes/Core/NSObject+KiwiSpyAdditions.h rename to Sources/Kiwi/include/Kiwi/NSObject+KiwiSpyAdditions.h diff --git a/Classes/Stubbing/NSObject+KiwiStubAdditions.h b/Sources/Kiwi/include/Kiwi/NSObject+KiwiStubAdditions.h similarity index 88% rename from Classes/Stubbing/NSObject+KiwiStubAdditions.h rename to Sources/Kiwi/include/Kiwi/NSObject+KiwiStubAdditions.h index 12775e99..69beda36 100644 --- a/Classes/Stubbing/NSObject+KiwiStubAdditions.h +++ b/Sources/Kiwi/include/Kiwi/NSObject+KiwiStubAdditions.h @@ -29,10 +29,6 @@ + (void)stub:(SEL)aSelector andReturn:(id)aValue withArguments:(id)firstArgument, ...; + (void)stub:(SEL)aSelector andReturn:(id)aValue times:(NSNumber *)times afterThatReturn:(id)aSecondValue; -- (id)stub DEPRECATED_ATTRIBUTE; -- (id)stubAndReturn:(id)aValue DEPRECATED_ATTRIBUTE; -- (id)stubAndReturn:(id)aValue times:(id)times afterThatReturn:(id)aSecondValue DEPRECATED_ATTRIBUTE; - // These methods will become private - (void)stubMessagePattern:(KWMessagePattern *)aMessagePattern andReturn:(id)aValue; - (void)stubMessagePattern:(KWMessagePattern *)aMessagePattern andReturn:(id)aValue overrideExisting:(BOOL)overrideExisting; @@ -50,11 +46,9 @@ - (void)addMessageSpy:(id)aSpy forMessagePattern:(KWMessagePattern *)aMessagePattern; - (void)removeMessageSpy:(id)aSpy forMessagePattern:(KWMessagePattern *)aMessagePattern; -- (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index; + (void)addMessageSpy:(id)aSpy forMessagePattern:(KWMessagePattern *)aMessagePattern; + (void)removeMessageSpy:(id)aSpy forMessagePattern:(KWMessagePattern *)aMessagePattern; -+ (KWCaptureSpy *)captureArgument:(SEL)selector atIndex:(NSUInteger)index; @end diff --git a/Classes/Core/NSObject+KiwiVerifierAdditions.h b/Sources/Kiwi/include/Kiwi/NSObject+KiwiVerifierAdditions.h similarity index 100% rename from Classes/Core/NSObject+KiwiVerifierAdditions.h rename to Sources/Kiwi/include/Kiwi/NSObject+KiwiVerifierAdditions.h diff --git a/Classes/Core/NSProxy+KiwiVerifierAdditions.h b/Sources/Kiwi/include/Kiwi/NSProxy+KiwiVerifierAdditions.h similarity index 100% rename from Classes/Core/NSProxy+KiwiVerifierAdditions.h rename to Sources/Kiwi/include/Kiwi/NSProxy+KiwiVerifierAdditions.h diff --git a/Tests/Test Classes/Carrier.h b/Sources/Test Classes/Carrier.h similarity index 100% rename from Tests/Test Classes/Carrier.h rename to Sources/Test Classes/Carrier.h diff --git a/Tests/Test Classes/Carrier.m b/Sources/Test Classes/Carrier.m similarity index 100% rename from Tests/Test Classes/Carrier.m rename to Sources/Test Classes/Carrier.m diff --git a/Tests/Test Classes/Cruiser.h b/Sources/Test Classes/Cruiser.h similarity index 100% rename from Tests/Test Classes/Cruiser.h rename to Sources/Test Classes/Cruiser.h diff --git a/Tests/Test Classes/Cruiser.m b/Sources/Test Classes/Cruiser.m similarity index 100% rename from Tests/Test Classes/Cruiser.m rename to Sources/Test Classes/Cruiser.m diff --git a/Tests/Test Classes/DoNotUseMe.h b/Sources/Test Classes/DoNotUseMe.h similarity index 100% rename from Tests/Test Classes/DoNotUseMe.h rename to Sources/Test Classes/DoNotUseMe.h diff --git a/Tests/Test Classes/DoNotUseMe.m b/Sources/Test Classes/DoNotUseMe.m similarity index 100% rename from Tests/Test Classes/DoNotUseMe.m rename to Sources/Test Classes/DoNotUseMe.m diff --git a/Tests/Test Classes/Engine.h b/Sources/Test Classes/Engine.h similarity index 100% rename from Tests/Test Classes/Engine.h rename to Sources/Test Classes/Engine.h diff --git a/Tests/Test Classes/Engine.m b/Sources/Test Classes/Engine.m similarity index 100% rename from Tests/Test Classes/Engine.m rename to Sources/Test Classes/Engine.m diff --git a/Tests/Test Classes/Fighter.h b/Sources/Test Classes/Fighter.h similarity index 100% rename from Tests/Test Classes/Fighter.h rename to Sources/Test Classes/Fighter.h diff --git a/Tests/Test Classes/Fighter.m b/Sources/Test Classes/Fighter.m similarity index 100% rename from Tests/Test Classes/Fighter.m rename to Sources/Test Classes/Fighter.m diff --git a/Tests/Test Classes/Galaxy.h b/Sources/Test Classes/Galaxy.h similarity index 100% rename from Tests/Test Classes/Galaxy.h rename to Sources/Test Classes/Galaxy.h diff --git a/Tests/Test Classes/Galaxy.m b/Sources/Test Classes/Galaxy.m similarity index 100% rename from Tests/Test Classes/Galaxy.m rename to Sources/Test Classes/Galaxy.m diff --git a/Tests/Test Classes/JumpCapable.h b/Sources/Test Classes/JumpCapable.h similarity index 100% rename from Tests/Test Classes/JumpCapable.h rename to Sources/Test Classes/JumpCapable.h diff --git a/Tests/Test Classes/OrbitCapable.h b/Sources/Test Classes/OrbitCapable.h similarity index 100% rename from Tests/Test Classes/OrbitCapable.h rename to Sources/Test Classes/OrbitCapable.h diff --git a/Tests/Test Classes/Robot.h b/Sources/Test Classes/Robot.h similarity index 100% rename from Tests/Test Classes/Robot.h rename to Sources/Test Classes/Robot.h diff --git a/Tests/Test Classes/Robot.m b/Sources/Test Classes/Robot.m similarity index 100% rename from Tests/Test Classes/Robot.m rename to Sources/Test Classes/Robot.m diff --git a/Tests/Test Classes/SpaceShip.h b/Sources/Test Classes/SpaceShip.h similarity index 100% rename from Tests/Test Classes/SpaceShip.h rename to Sources/Test Classes/SpaceShip.h diff --git a/Tests/Test Classes/SpaceShip.m b/Sources/Test Classes/SpaceShip.m similarity index 100% rename from Tests/Test Classes/SpaceShip.m rename to Sources/Test Classes/SpaceShip.m diff --git a/Tests/Test Classes/TestClasses.h b/Sources/Test Classes/TestClasses.h similarity index 100% rename from Tests/Test Classes/TestClasses.h rename to Sources/Test Classes/TestClasses.h diff --git a/Tests/Test Classes/TestReporter.h b/Sources/Test Classes/TestReporter.h similarity index 100% rename from Tests/Test Classes/TestReporter.h rename to Sources/Test Classes/TestReporter.h diff --git a/Tests/Test Classes/TestReporter.m b/Sources/Test Classes/TestReporter.m similarity index 100% rename from Tests/Test Classes/TestReporter.m rename to Sources/Test Classes/TestReporter.m diff --git a/Tests/Test Classes/TestSpy.h b/Sources/Test Classes/TestSpy.h similarity index 100% rename from Tests/Test Classes/TestSpy.h rename to Sources/Test Classes/TestSpy.h diff --git a/Tests/Test Classes/TestSpy.m b/Sources/Test Classes/TestSpy.m similarity index 100% rename from Tests/Test Classes/TestSpy.m rename to Sources/Test Classes/TestSpy.m diff --git a/Tests/Test Classes/TestVerifier.h b/Sources/Test Classes/TestVerifier.h similarity index 100% rename from Tests/Test Classes/TestVerifier.h rename to Sources/Test Classes/TestVerifier.h diff --git a/Tests/Test Classes/TestVerifier.m b/Sources/Test Classes/TestVerifier.m similarity index 100% rename from Tests/Test Classes/TestVerifier.m rename to Sources/Test Classes/TestVerifier.m diff --git a/Tests/KWNotificationMatcherTest.m b/Tests/KWNotificationMatcherTest.m deleted file mode 100644 index 4e64494b..00000000 --- a/Tests/KWNotificationMatcherTest.m +++ /dev/null @@ -1,135 +0,0 @@ -// -// Licensed under the terms in License.txt -// -// Copyright 2010 Allen Ding. All rights reserved. -// - -#import -#import "KiwiTestConfiguration.h" -#import "TestClasses.h" - -#if KW_TESTS_ENABLED - -@interface KWNotificatoinMatcherTest : SenTestCase - -@end - -@implementation KWNotificatoinMatcherTest - -- (void)testItShouldHaveTheRightMatcherStrings { - NSArray *matcherStrings = [KWNotificationMatcher matcherStrings]; - NSArray *expectedStrings = @[@"bePosted", @"bePostedWithObject:", @"bePostedWithUserInfo:", @"bePostedWithObject:andUserInfo:", @"bePostedEvaluatingBlock:"]; - STAssertEqualObjects([matcherStrings sortedArrayUsingSelector:@selector(compare:)], - [expectedStrings sortedArrayUsingSelector:@selector(compare:)], - @"expected specific matcher strings"); -} - -- (void)testEachMatcherStringIsANameOfAMatchingMethod { - NSArray *matcherStrings = [KWNotificationMatcher matcherStrings]; - for (NSString *string in matcherStrings) { - STAssertTrue([KWNotificationMatcher instancesRespondToSelector:NSSelectorFromString(string)], @"expect to find an instance method: %@", string); - } -} - -- (void)testItShouldMatchPostedNotificationWithAnyObject { - id object = [[[NSObject alloc] init] autorelease]; - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePosted]; - [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object]; - STAssertTrue([matcher evaluate], @"expected positive match"); -} - -- (void)testItShouldMatchPostedNotificationWithMatchingObject { - id object = [[[NSObject alloc] init] autorelease]; - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePostedWithObject:object]; - [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object]; - STAssertTrue([matcher evaluate], @"expected positive match"); -} - -- (void)testItShouldMatchPostedNotificationWithMatchingUserInfo { - id object = [[[NSObject alloc] init] autorelease]; - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePostedWithUserInfo:@{@"a":@"b", @1:@2}]; - [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:@{@"a":@"b", @1:@2}]; - STAssertTrue([matcher evaluate], @"expected positive match"); -} - -- (void)testItShouldMatchPostedNotificationWithMatchingObjectAndUserInfo { - id object = [[[NSObject alloc] init] autorelease]; - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePostedWithObject:object andUserInfo:@{@"a":@"b", @1:@2}]; - [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:@{@"a":@"b", @1:@2}]; - STAssertTrue([matcher evaluate], @"expected positive match"); -} - -- (void)testItShouldMatchPostedNotificationEvaluatingBlock { - id object = [[[NSObject alloc] init] autorelease]; - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePostedEvaluatingBlock:^(NSNotification *note) { - STAssertEquals(subject, [note name], @"expected notification name"); - STAssertEquals(object, [note object], @"expected notification object"); - STAssertNotNil([note userInfo][@"PATH"], @"expected notification user info to include environment PATH"); - }]; - [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:[[NSProcessInfo processInfo] environment]]; - STAssertTrue([matcher evaluate], @"expected positive match"); -} - -- (void)testItShouldNotMatchWhenNothingHaveBeenPosted { - id subject = @"MyNotification"; - id matcher = [KWNotificationMatcher matcherWithSubject:subject]; - [matcher bePosted]; - STAssertFalse([matcher evaluate], @"expected negative match"); -} - -- (void)testItShouldHaveHumanReadableDescription { - id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; - [matcher bePosted]; - STAssertEqualObjects(@"NSPortDidBecomeInvalidNotification be posted", [matcher description], @"description should match"); -} - -- (void)testItShouldHaveInformativeFailureMessageForShould { - id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; - [matcher bePosted]; - STAssertEqualObjects([matcher failureMessageForShould], @"expect to receive \"NSPortDidBecomeInvalidNotification\" notification", @"failure message should match"); -} - -- (void)testItShouldHaveInformativeFailureMessageForShouldWithObject { - id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; - [matcher bePostedWithObject:@"sender"]; - STAssertEqualObjects([matcher failureMessageForShould], @"expect to receive \"NSPortDidBecomeInvalidNotification\" " - "notification with object: sender", @"failure message should match"); -} - -- (void)testItShouldHaveInformativeFailureMessageForShouldWithUserInfo { - id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; - [matcher bePostedWithUserInfo:@{@"message":@"text"}]; - STAssertEqualObjects([matcher failureMessageForShould], @"expect to receive \"NSPortDidBecomeInvalidNotification\" " - "notification with user info: {\n message = text;\n}", @"failure message should match"); -} - -- (void)testItShouldHaveInformativeFailureMessageForShouldWithObjectAndUserInfo { - id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; - [matcher bePostedWithObject:@"sender" andUserInfo:@{@"message":@"text"}]; - STAssertEqualObjects([matcher failureMessageForShould], @"expect to receive \"NSPortDidBecomeInvalidNotification\" " - "notification with object: sender and user info: {\n message = text;\n}", @"failure message should match"); -} - -- (void)testItShouldHaveInformativeFailureMessageForShouldNot { - id matcher = [KWNotificationMatcher matcherWithSubject:@"MyNotification"]; - [matcher bePosted]; - NSNotification *notification = [[NSNotification alloc] initWithName:@"MyNotification" object:self userInfo:@{@"when":@"today"}]; - NSString *description = [notification description]; - [[NSNotificationCenter defaultCenter] postNotification:notification]; - NSString *expectedDescription = [NSString stringWithFormat:@"expect not to receive \"MyNotification\" notification, but received: %@", description]; - STAssertEqualObjects([matcher failureMessageForShouldNot], expectedDescription, @"failure message should match"); -} - -@end - -#endif // #if KW_TESTS_ENABLED diff --git a/Tests/Config.m b/Tests/KiwiTests/Config.m similarity index 100% rename from Tests/Config.m rename to Tests/KiwiTests/Config.m diff --git a/Tests/Info.plist b/Tests/KiwiTests/Info.plist similarity index 100% rename from Tests/Info.plist rename to Tests/KiwiTests/Info.plist diff --git a/Tests/KWBeBetweenMatcherTest.m b/Tests/KiwiTests/KWBeBetweenMatcherTest.m similarity index 100% rename from Tests/KWBeBetweenMatcherTest.m rename to Tests/KiwiTests/KWBeBetweenMatcherTest.m diff --git a/Tests/KWBeEmptyMatcherTest.m b/Tests/KiwiTests/KWBeEmptyMatcherTest.m similarity index 100% rename from Tests/KWBeEmptyMatcherTest.m rename to Tests/KiwiTests/KWBeEmptyMatcherTest.m diff --git a/Tests/KWBeIndenticalToMatcherTest.m b/Tests/KiwiTests/KWBeIndenticalToMatcherTest.m similarity index 100% rename from Tests/KWBeIndenticalToMatcherTest.m rename to Tests/KiwiTests/KWBeIndenticalToMatcherTest.m diff --git a/Tests/KWBeKindOfClassMatcherTest.m b/Tests/KiwiTests/KWBeKindOfClassMatcherTest.m similarity index 100% rename from Tests/KWBeKindOfClassMatcherTest.m rename to Tests/KiwiTests/KWBeKindOfClassMatcherTest.m diff --git a/Tests/KWBeMemberOfClassMatcherTest.m b/Tests/KiwiTests/KWBeMemberOfClassMatcherTest.m similarity index 100% rename from Tests/KWBeMemberOfClassMatcherTest.m rename to Tests/KiwiTests/KWBeMemberOfClassMatcherTest.m diff --git a/Tests/KWBeSubclassOfClassMatcherTest.m b/Tests/KiwiTests/KWBeSubclassOfClassMatcherTest.m similarity index 100% rename from Tests/KWBeSubclassOfClassMatcherTest.m rename to Tests/KiwiTests/KWBeSubclassOfClassMatcherTest.m diff --git a/Tests/KWBeTrueMatcherTest.m b/Tests/KiwiTests/KWBeTrueMatcherTest.m similarity index 100% rename from Tests/KWBeTrueMatcherTest.m rename to Tests/KiwiTests/KWBeTrueMatcherTest.m diff --git a/Tests/KWBeWithinMatcherTest.m b/Tests/KiwiTests/KWBeWithinMatcherTest.m similarity index 100% rename from Tests/KWBeWithinMatcherTest.m rename to Tests/KiwiTests/KWBeWithinMatcherTest.m diff --git a/Tests/KWBeZeroMatcherTest.m b/Tests/KiwiTests/KWBeZeroMatcherTest.m similarity index 100% rename from Tests/KWBeZeroMatcherTest.m rename to Tests/KiwiTests/KWBeZeroMatcherTest.m diff --git a/Tests/KWBlockNodeTest.m b/Tests/KiwiTests/KWBlockNodeTest.m similarity index 100% rename from Tests/KWBlockNodeTest.m rename to Tests/KiwiTests/KWBlockNodeTest.m diff --git a/Tests/KWBlockRaiseMatcherTest.m b/Tests/KiwiTests/KWBlockRaiseMatcherTest.m similarity index 100% rename from Tests/KWBlockRaiseMatcherTest.m rename to Tests/KiwiTests/KWBlockRaiseMatcherTest.m diff --git a/Tests/KWCaptureTest.m b/Tests/KiwiTests/KWCaptureTest.m similarity index 100% rename from Tests/KWCaptureTest.m rename to Tests/KiwiTests/KWCaptureTest.m diff --git a/Tests/KWChangeMatcherTest.m b/Tests/KiwiTests/KWChangeMatcherTest.m similarity index 100% rename from Tests/KWChangeMatcherTest.m rename to Tests/KiwiTests/KWChangeMatcherTest.m diff --git a/Tests/KWConformToProtocolMatcherTest.m b/Tests/KiwiTests/KWConformToProtocolMatcherTest.m similarity index 100% rename from Tests/KWConformToProtocolMatcherTest.m rename to Tests/KiwiTests/KWConformToProtocolMatcherTest.m diff --git a/Tests/KWContainMatcherTest.m b/Tests/KiwiTests/KWContainMatcherTest.m similarity index 100% rename from Tests/KWContainMatcherTest.m rename to Tests/KiwiTests/KWContainMatcherTest.m diff --git a/Tests/KWContainStringMatcherTest.m b/Tests/KiwiTests/KWContainStringMatcherTest.m similarity index 100% rename from Tests/KWContainStringMatcherTest.m rename to Tests/KiwiTests/KWContainStringMatcherTest.m diff --git a/Tests/KWContextNodeTest.m b/Tests/KiwiTests/KWContextNodeTest.m similarity index 100% rename from Tests/KWContextNodeTest.m rename to Tests/KiwiTests/KWContextNodeTest.m diff --git a/Tests/KWDeviceInfoTest.m b/Tests/KiwiTests/KWDeviceInfoTest.m similarity index 100% rename from Tests/KWDeviceInfoTest.m rename to Tests/KiwiTests/KWDeviceInfoTest.m diff --git a/Tests/KWEqualMatcherTest.m b/Tests/KiwiTests/KWEqualMatcherTest.m similarity index 100% rename from Tests/KWEqualMatcherTest.m rename to Tests/KiwiTests/KWEqualMatcherTest.m diff --git a/Tests/KWExampleSuiteBuilderTest.m b/Tests/KiwiTests/KWExampleSuiteBuilderTest.m similarity index 100% rename from Tests/KWExampleSuiteBuilderTest.m rename to Tests/KiwiTests/KWExampleSuiteBuilderTest.m diff --git a/Tests/KWExampleSuiteTest.m b/Tests/KiwiTests/KWExampleSuiteTest.m similarity index 100% rename from Tests/KWExampleSuiteTest.m rename to Tests/KiwiTests/KWExampleSuiteTest.m diff --git a/Tests/KWExampleTest.m b/Tests/KiwiTests/KWExampleTest.m similarity index 100% rename from Tests/KWExampleTest.m rename to Tests/KiwiTests/KWExampleTest.m diff --git a/Tests/KWExpectaTests.m b/Tests/KiwiTests/KWExpectaTests.m similarity index 93% rename from Tests/KWExpectaTests.m rename to Tests/KiwiTests/KWExpectaTests.m index 14833627..d1f73d1b 100644 --- a/Tests/KWExpectaTests.m +++ b/Tests/KiwiTests/KWExpectaTests.m @@ -1,3 +1,4 @@ +#if !SWIFT_PACKAGE #import #import #import "KWFailureInterceptingSpec.h" @@ -14,3 +15,4 @@ }); SPEC_END +#endif diff --git a/Tests/KWFailureInterceptingSpec.h b/Tests/KiwiTests/KWFailureInterceptingSpec.h similarity index 100% rename from Tests/KWFailureInterceptingSpec.h rename to Tests/KiwiTests/KWFailureInterceptingSpec.h diff --git a/Tests/KWFailureInterceptingSpec.m b/Tests/KiwiTests/KWFailureInterceptingSpec.m similarity index 100% rename from Tests/KWFailureInterceptingSpec.m rename to Tests/KiwiTests/KWFailureInterceptingSpec.m diff --git a/Tests/KWFormatterTest.m b/Tests/KiwiTests/KWFormatterTest.m similarity index 100% rename from Tests/KWFormatterTest.m rename to Tests/KiwiTests/KWFormatterTest.m diff --git a/Tests/KWFunctionalTests.m b/Tests/KiwiTests/KWFunctionalTests.m similarity index 100% rename from Tests/KWFunctionalTests.m rename to Tests/KiwiTests/KWFunctionalTests.m diff --git a/Tests/KWGenericMatcherTest.m b/Tests/KiwiTests/KWGenericMatcherTest.m similarity index 100% rename from Tests/KWGenericMatcherTest.m rename to Tests/KiwiTests/KWGenericMatcherTest.m diff --git a/Tests/KWHaveMatcherTest.m b/Tests/KiwiTests/KWHaveMatcherTest.m similarity index 100% rename from Tests/KWHaveMatcherTest.m rename to Tests/KiwiTests/KWHaveMatcherTest.m diff --git a/Tests/KWHaveValueMatcherTest.m b/Tests/KiwiTests/KWHaveValueMatcherTest.m similarity index 100% rename from Tests/KWHaveValueMatcherTest.m rename to Tests/KiwiTests/KWHaveValueMatcherTest.m diff --git a/Tests/KWInequalityMatcherTest.m b/Tests/KiwiTests/KWInequalityMatcherTest.m similarity index 100% rename from Tests/KWInequalityMatcherTest.m rename to Tests/KiwiTests/KWInequalityMatcherTest.m diff --git a/Tests/KWLetNodeTest.m b/Tests/KiwiTests/KWLetNodeTest.m similarity index 100% rename from Tests/KWLetNodeTest.m rename to Tests/KiwiTests/KWLetNodeTest.m diff --git a/Tests/KWMessagePatternFunctionalTests.m b/Tests/KiwiTests/KWMessagePatternFunctionalTests.m similarity index 100% rename from Tests/KWMessagePatternFunctionalTests.m rename to Tests/KiwiTests/KWMessagePatternFunctionalTests.m diff --git a/Tests/KWMessagePatternTest.m b/Tests/KiwiTests/KWMessagePatternTest.m similarity index 100% rename from Tests/KWMessagePatternTest.m rename to Tests/KiwiTests/KWMessagePatternTest.m diff --git a/Tests/KWMockTest.m b/Tests/KiwiTests/KWMockTest.m similarity index 100% rename from Tests/KWMockTest.m rename to Tests/KiwiTests/KWMockTest.m diff --git a/Tests/KiwiTests/KWNotificationMatcherFunctionalTests.m b/Tests/KiwiTests/KWNotificationMatcherFunctionalTests.m new file mode 100644 index 00000000..42a022b9 --- /dev/null +++ b/Tests/KiwiTests/KWNotificationMatcherFunctionalTests.m @@ -0,0 +1,75 @@ +#import +#import "KiwiTestConfiguration.h" +#import "TestClasses.h" + +SPEC_BEGIN(KWNotificationMatcherFunctionalTests) + +describe(@"KWNotificationMatcher", ^{ + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + + context(@"bePosted", ^{ + it(@"should match posted notification", ^{ + [[@"My Notification" should] bePosted]; + [center postNotificationName:@"My Notification" object:nil]; + }); + }); + + context(@"bePostedWithObject", ^{ + it(@"should match object", ^{ + NSObject *object = [NSObject new]; + [[@"My Notification" should] bePostedWithObject:object]; + [[@"My Notification" shouldNot] bePostedWithObject:@"not matching object"]; + [center postNotificationName:@"My Notification" object:object]; + }); + }); + + context(@"bePostedWithUserInfo", ^{ + it(@"should match user info", ^{ + [[@"My Notification" should] bePostedWithUserInfo:@{@"some key":@"some value"}]; + [[@"My Notification" shouldNot] bePostedWithUserInfo:@{@"some key":@"not matching value"}]; + [center postNotificationName:@"My Notification" object:nil userInfo:@{@"some key":@"some value"}]; + }); + }); + + context(@"bePostedWithObject:userInfo:", ^{ + it(@"should match both object and user info", ^{ + NSObject *object = [NSObject new]; + [[@"My Notification" should] bePostedWithObject:object userInfo:@{@"some key":@"some value"}]; + [[@"My Notification" shouldNot] bePostedWithObject:object userInfo:@{@"some key":@"not matching value"}]; + [[@"My Notification" shouldNot] bePostedWithObject:[NSObject new] userInfo:@{@"some key":@"some value"}]; + [center postNotificationName:@"My Notification" object:object userInfo:@{@"some key":@"some value"}]; + + }); + }); + + context(@"bePostedEvaluatingBlock", ^{ + it(@"should match and evaluate block", ^{ + __block BOOL blockWasEvaluated = NO; + [[@"My Notification" should] bePostedEvaluatingBlock:^(NSNotification *note) { + [[note shouldNot] beNil]; + [[note.name should] equal:@"My Notification"]; + blockWasEvaluated = TRUE; + }]; + [center postNotificationName:@"My Notification" object:nil]; + [[theValue(blockWasEvaluated) should] beTrue]; + }); + }); + + context(@"asynchronous notification", ^{ + void (^postDelayedNotification)(void) = ^{ + [center performSelector:@selector(postNotificationName:object:) withObject:@"My Notification" afterDelay:0]; + }; + + it(@"should not match syncronous expectation", ^{ + [[@"My Notification" shouldNot] bePosted]; + postDelayedNotification(); + }); + + it(@"should match eventually", ^{ + [[@"My Notification" shouldEventually] bePosted]; + postDelayedNotification(); + }); + }); +}); + +SPEC_END diff --git a/Tests/KiwiTests/KWNotificationMatcherTest.m b/Tests/KiwiTests/KWNotificationMatcherTest.m new file mode 100644 index 00000000..0c665d24 --- /dev/null +++ b/Tests/KiwiTests/KWNotificationMatcherTest.m @@ -0,0 +1,156 @@ +// +// Licensed under the terms in License.txt +// +// Copyright 2010 Allen Ding. All rights reserved. +// + +#import +#import "KiwiTestConfiguration.h" +#import "TestClasses.h" + +#if KW_TESTS_ENABLED + +@interface KWNotificatoinMatcherTest : XCTestCase + +@end + +@implementation KWNotificatoinMatcherTest + +- (void)testItShouldHaveTheRightMatcherStrings { + NSArray *matcherStrings = [KWNotificationMatcher matcherStrings]; + NSArray *expectedStrings = @[@"bePosted", + @"bePostedWithObject:", + @"bePostedWithUserInfo:", + @"bePostedWithObject:andUserInfo:", + @"bePostedWithObject:userInfo:", + @"bePostedEvaluatingBlock:"]; + XCTAssertEqualObjects([matcherStrings sortedArrayUsingSelector:@selector(compare:)], + [expectedStrings sortedArrayUsingSelector:@selector(compare:)], + @"expected specific matcher strings"); +} + +- (void)testEachMatcherStringIsANameOfAMatchingMethod { + NSArray *matcherStrings = [KWNotificationMatcher matcherStrings]; + for (NSString *string in matcherStrings) { + XCTAssertTrue([KWNotificationMatcher instancesRespondToSelector:NSSelectorFromString(string)], + @"expect to find an instance method: %@", string); + } +} + +- (void)testCanMatchSubjectWithStringAndNotObject { + XCTAssertTrue([KWNotificationMatcher canMatchSubject:NSPortDidBecomeInvalidNotification], @"should be able to match notification name"); + XCTAssertFalse([KWNotificationMatcher canMatchSubject:[NSObject new]], @"should not be able to match NSObject as a subject"); +} + +- (void)testShouldBeEvaluatedAtEndOfExample { + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + XCTAssertTrue([matcher shouldBeEvaluatedAtEndOfExample], @"should evaluate at the end of example to catch async notifications"); +} + +- (void)testItShouldMatchPostedNotificationWithAnyObject { + id object = [NSObject new]; + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePosted]; + [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object]; + XCTAssertTrue([matcher evaluate], @"expected positive match"); +} + +- (void)testItShouldMatchPostedNotificationWithMatchingObject { + id object = [NSObject new]; + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePostedWithObject:object]; + [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object]; + XCTAssertTrue([matcher evaluate], @"expected positive match"); +} + +- (void)testItShouldMatchPostedNotificationWithMatchingUserInfo { + id object = [NSObject new]; + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePostedWithUserInfo:@{@"a":@"b", @1:@2}]; + [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:@{@"a":@"b", @1:@2}]; + XCTAssertTrue([matcher evaluate], @"expected positive match"); +} + +- (void)testItShouldMatchPostedNotificationWithMatchingObjectAndUserInfo { + id object = [NSObject new]; + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePostedWithObject:object userInfo:@{@"a":@"b", @1:@2}]; + [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:@{@"a":@"b", @1:@2}]; + XCTAssertTrue([matcher evaluate], @"expected positive match"); +} + +- (void)testItShouldMatchPostedNotificationEvaluatingBlock { + id object = [NSObject new]; + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePostedEvaluatingBlock:^(NSNotification *note) { + XCTAssertEqual(subject, [note name], @"expected notification name"); + XCTAssertEqual(object, [note object], @"expected notification object"); + XCTAssertNotNil([note userInfo][@"PATH"], @"expected notification user info to include environment PATH"); + }]; + [[NSNotificationCenter defaultCenter] postNotificationName:subject object:object userInfo:[[NSProcessInfo processInfo] environment]]; + XCTAssertTrue([matcher evaluate], @"expected positive match"); +} + +- (void)testItShouldNotMatchWhenNothingHaveBeenPosted { + id subject = @"MyNotification"; + KWNotificationMatcher *matcher = [KWNotificationMatcher matcherWithSubject:subject]; + [matcher bePosted]; + XCTAssertFalse([matcher evaluate], @"expected negative match"); +} + +- (void)testItShouldHaveHumanReadableDescription { + id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + [matcher bePosted]; + XCTAssertEqualObjects(@"NSPortDidBecomeInvalidNotification be posted", [matcher description], @"description should match"); +} + +- (void)testItShouldHaveInformativeFailureMessageForShould { + id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + [matcher bePosted]; + XCTAssertEqualObjects([matcher failureMessageForShould], + @"expect to receive \"NSPortDidBecomeInvalidNotification\" notification", + @"failure message should match"); +} + +- (void)testItShouldHaveInformativeFailureMessageForShouldWithObject { + id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + [matcher bePostedWithObject:@"sender"]; + XCTAssertEqualObjects([matcher failureMessageForShould], + @"expect to receive \"NSPortDidBecomeInvalidNotification\" notification with object: sender", + @"failure message should match"); +} + +- (void)testItShouldHaveInformativeFailureMessageForShouldWithUserInfo { + id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + [matcher bePostedWithUserInfo:@{@"message":@"text"}]; + XCTAssertEqualObjects([matcher failureMessageForShould], + @"expect to receive \"NSPortDidBecomeInvalidNotification\" notification with user info: {\n message = text;\n}", + @"failure message should match"); +} + +- (void)testItShouldHaveInformativeFailureMessageForShouldWithObjectAndUserInfo { + id matcher = [KWNotificationMatcher matcherWithSubject:NSPortDidBecomeInvalidNotification]; + [matcher bePostedWithObject:@"sender" userInfo:@{@"message":@"text"}]; + XCTAssertEqualObjects([matcher failureMessageForShould], @"expect to receive \"NSPortDidBecomeInvalidNotification\" " + "notification with object: sender and user info: {\n message = text;\n}", + @"failure message should match"); +} + +- (void)testItShouldHaveInformativeFailureMessageForShouldNot { + id matcher = [KWNotificationMatcher matcherWithSubject:@"MyNotification"]; + [matcher bePosted]; + NSNotification *notification = [[NSNotification alloc] initWithName:@"MyNotification" object:self userInfo:@{@"when":@"today"}]; + NSString *description = [notification description]; + [[NSNotificationCenter defaultCenter] postNotification:notification]; + NSString *expectedDescription = [NSString stringWithFormat:@"expect not to receive \"MyNotification\" notification, but received: %@", description]; + XCTAssertEqualObjects([matcher failureMessageForShouldNot], expectedDescription, @"failure message should match"); +} + +@end + +#endif // #if KW_TESTS_ENABLED diff --git a/Tests/KWObjCNimbleTests.m b/Tests/KiwiTests/KWObjCNimbleTests.m similarity index 89% rename from Tests/KWObjCNimbleTests.m rename to Tests/KiwiTests/KWObjCNimbleTests.m index e7b3f586..84cca9a4 100644 --- a/Tests/KWObjCNimbleTests.m +++ b/Tests/KiwiTests/KWObjCNimbleTests.m @@ -1,5 +1,6 @@ +#if !SWIFT_PACKAGE +@import Nimble; #import -#import #import "KWFailureInterceptingSpec.h" #import "KiwiTestConfiguration.h" @@ -14,3 +15,4 @@ }); SPEC_END +#endif diff --git a/Tests/KWObjCUtilitiesTest.m b/Tests/KiwiTests/KWObjCUtilitiesTest.m similarity index 100% rename from Tests/KWObjCUtilitiesTest.m rename to Tests/KiwiTests/KWObjCUtilitiesTest.m diff --git a/Tests/KWObjCXCTestAssertionTests.m b/Tests/KiwiTests/KWObjCXCTestAssertionTests.m similarity index 100% rename from Tests/KWObjCXCTestAssertionTests.m rename to Tests/KiwiTests/KWObjCXCTestAssertionTests.m diff --git a/Tests/KWPendingNodeTest.m b/Tests/KiwiTests/KWPendingNodeTest.m similarity index 100% rename from Tests/KWPendingNodeTest.m rename to Tests/KiwiTests/KWPendingNodeTest.m diff --git a/Tests/KWRealObjectSpyTest.m b/Tests/KiwiTests/KWRealObjectSpyTest.m similarity index 100% rename from Tests/KWRealObjectSpyTest.m rename to Tests/KiwiTests/KWRealObjectSpyTest.m diff --git a/Tests/KWReceiveMatcherTest.m b/Tests/KiwiTests/KWReceiveMatcherTest.m similarity index 100% rename from Tests/KWReceiveMatcherTest.m rename to Tests/KiwiTests/KWReceiveMatcherTest.m diff --git a/Tests/KWRegularExpressionPatternMatcherTest.m b/Tests/KiwiTests/KWRegularExpressionPatternMatcherTest.m similarity index 100% rename from Tests/KWRegularExpressionPatternMatcherTest.m rename to Tests/KiwiTests/KWRegularExpressionPatternMatcherTest.m diff --git a/Tests/KWRespondToSelectorMatcherTest.m b/Tests/KiwiTests/KWRespondToSelectorMatcherTest.m similarity index 100% rename from Tests/KWRespondToSelectorMatcherTest.m rename to Tests/KiwiTests/KWRespondToSelectorMatcherTest.m diff --git a/Tests/KWStringUtilitiesTest.m b/Tests/KiwiTests/KWStringUtilitiesTest.m similarity index 100% rename from Tests/KWStringUtilitiesTest.m rename to Tests/KiwiTests/KWStringUtilitiesTest.m diff --git a/Tests/KWUserDefinedMatcherFunctionalTest.m b/Tests/KiwiTests/KWUserDefinedMatcherFunctionalTest.m similarity index 100% rename from Tests/KWUserDefinedMatcherFunctionalTest.m rename to Tests/KiwiTests/KWUserDefinedMatcherFunctionalTest.m diff --git a/Tests/KWUserDefinedMatcherTest.m b/Tests/KiwiTests/KWUserDefinedMatcherTest.m similarity index 100% rename from Tests/KWUserDefinedMatcherTest.m rename to Tests/KiwiTests/KWUserDefinedMatcherTest.m diff --git a/Tests/KWValueTest.m b/Tests/KiwiTests/KWValueTest.m similarity index 100% rename from Tests/KWValueTest.m rename to Tests/KiwiTests/KWValueTest.m diff --git a/Tests/KiwiTestConfiguration.h b/Tests/KiwiTests/KiwiTestConfiguration.h similarity index 100% rename from Tests/KiwiTestConfiguration.h rename to Tests/KiwiTests/KiwiTestConfiguration.h diff --git a/Tests/NSNumber_KiwiAdditionsTests.m b/Tests/KiwiTests/NSNumber_KiwiAdditionsTests.m similarity index 100% rename from Tests/NSNumber_KiwiAdditionsTests.m rename to Tests/KiwiTests/NSNumber_KiwiAdditionsTests.m diff --git a/Tests/Shared Examples/KWSharedExampleFunctionalTest.m b/Tests/KiwiTests/Shared Examples/KWSharedExampleFunctionalTest.m similarity index 100% rename from Tests/Shared Examples/KWSharedExampleFunctionalTest.m rename to Tests/KiwiTests/Shared Examples/KWSharedExampleFunctionalTest.m diff --git a/Tests/Shared Examples/KWSharedExampleRegistryTest.m b/Tests/KiwiTests/Shared Examples/KWSharedExampleRegistryTest.m similarity index 100% rename from Tests/Shared Examples/KWSharedExampleRegistryTest.m rename to Tests/KiwiTests/Shared Examples/KWSharedExampleRegistryTest.m diff --git a/Tests/Shared Examples/KWSharedExampleTest.m b/Tests/KiwiTests/Shared Examples/KWSharedExampleTest.m similarity index 100% rename from Tests/Shared Examples/KWSharedExampleTest.m rename to Tests/KiwiTests/Shared Examples/KWSharedExampleTest.m diff --git a/Tests/KWRealObjectStubTest.m b/Tests/KiwiTestsNoArc/KWRealObjectStubTest.m similarity index 95% rename from Tests/KWRealObjectStubTest.m rename to Tests/KiwiTestsNoArc/KWRealObjectStubTest.m index 4ed9bd06..a3494842 100644 --- a/Tests/KWRealObjectStubTest.m +++ b/Tests/KiwiTestsNoArc/KWRealObjectStubTest.m @@ -195,6 +195,15 @@ - (void)testItShouldStubWithBlock { XCTAssertEqual([cruiser classification], @"Enterprise", @"expected method to be stubbed with block"); } +- (void)testStubSecureCodingOfDateClass { + NSDate *date = [NSDate date]; + [NSDate stub:@selector(date) andReturn:date]; + if (@available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)) { + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:date requiringSecureCoding:YES error:NULL]; + XCTAssertNotNil(data, @"expected stubbed class to be able to use secure coding"); + } +} + @end #endif // #if KW_TESTS_ENABLED diff --git a/Tests/KWStubTest.m b/Tests/KiwiTestsNoArc/KWStubTest.m similarity index 100% rename from Tests/KWStubTest.m rename to Tests/KiwiTestsNoArc/KWStubTest.m diff --git a/Tests/KWSwiftNimbleTests.swift b/Tests/KiwiTestsSwift/KWSwiftNimbleTests.swift similarity index 100% rename from Tests/KWSwiftNimbleTests.swift rename to Tests/KiwiTestsSwift/KWSwiftNimbleTests.swift diff --git a/Tests/KWSwiftXCTestAssertionTests.swift b/Tests/KiwiTestsSwift/KWSwiftXCTestAssertionTests.swift similarity index 100% rename from Tests/KWSwiftXCTestAssertionTests.swift rename to Tests/KiwiTestsSwift/KWSwiftXCTestAssertionTests.swift