Compare commits

...

85 Commits

Author SHA1 Message Date
matthewpalmer 2eec09637f Update travis 2015-09-12 16:19:14 +10:00
matthewpalmer 477977a11c Update deployment target for example 2015-09-12 16:13:33 +10:00
matthewpalmer 1830acd0ee Update travis 2015-09-12 16:06:45 +10:00
matthewpalmer 0f06f2d911 Update README 2015-09-12 16:06:36 +10:00
matthewpalmer 3910c07e5b CI for everything 2015-09-12 15:57:03 +10:00
matthewpalmer e79e4aeb4e Update gitignore 2015-09-12 15:52:44 +10:00
matthewpalmer f2b44e6a1c Update travis 2015-09-12 15:48:53 +10:00
matthewpalmer 100fe4c13c Add iOS example app 2015-09-12 15:45:34 +10:00
matthewpalmer 562a68f2bd Tweak travis 2015-09-12 15:20:25 +10:00
matthewpalmer 373edfae08 Add watchOS scheme and tweak travis 2015-09-12 15:13:56 +10:00
matthewpalmer 31d6fc2ef7 Update travis 2015-09-12 09:56:47 +10:00
matthewpalmer 76cfd3c3e4 Update travis build file 2015-09-12 09:52:23 +10:00
matthewpalmer 2ebf806a1a Update README and make schemes shared 2015-09-12 09:49:49 +10:00
matthewpalmer 22bcd61cff Add watchOS target
* Note that this is untested and I don't know if it actually
  works at all
2015-09-12 09:40:02 +10:00
matthewpalmer f8e007ebda Update Travis 2015-09-12 09:23:02 +10:00
matthewpalmer 267fe346c9 Remove 1.2.2 note from README 2015-09-12 09:13:53 +10:00
matthewpalmer b4ebf6f318 Update metadata 2015-09-12 09:11:38 +10:00
matthewpalmer 8496e635c1 Clean up project structure 2015-09-12 08:50:33 +10:00
matthewpalmer 17579e4417 Add iOS compatibility checks 2015-09-08 22:56:21 +10:00
matthewpalmer c0906fbda3 Merge remote-tracking branch 'garnett/nil-asserts' into garnett-remove-uikit
* garnett/nil-asserts:
  Use nill asserts where possible
2015-09-08 22:25:28 +10:00
matthewpalmer b61c058597 Merge remote-tracking branch 'garnett/swifty-style' into garnett-remove-uikit
* garnett/swifty-style:
  Remove explict self where possible
2015-09-08 22:24:42 +10:00
Denis Lebedev 323cae20ec Use nill asserts where possible 2015-09-06 22:04:33 +01:00
Denis Lebedev e99470b94a Remove explict self where possible 2015-09-06 21:55:54 +01:00
Denis Lebedev 1aae774695 Remove UIKit dependency 2015-09-06 21:46:45 +01:00
Matthew Palmer 7bf3ad867f Update README.md 2015-09-05 09:09:01 +10:00
matthewpalmer 002ce89a89 Merge branch 'nvh-master'
* nvh-master:
  Added new files to project
  Removed old tests
2015-09-04 20:49:15 +10:00
matthewpalmer ef4a62f475 Fix iOS requirement and update travis 2015-09-04 20:48:38 +10:00
Niels van Hoorn d09f7af9d7 Added new files to project 2015-09-02 12:01:39 +02:00
Niels van Hoorn 9e99695143 Removed old tests 2015-09-02 12:01:30 +02:00
Matthew Palmer 27fbf4e935 Update README.md 2015-08-31 22:04:54 +10:00
matthewpalmer 7a6f2a6724 Add link to blog post 2015-08-31 21:58:50 +10:00
matthewpalmer 1bca5f35fb Fix typo in README 2015-08-31 21:43:17 +10:00
Matthew Palmer 1e3b72b0b6 Merge pull request #52 from matthewpalmer/swift-2.0-protocol
Adopt a protocol-oriented design
2015-08-31 21:39:57 +10:00
matthewpalmer 41b6644b18 Set version to 2.0.0 2015-08-31 21:38:49 +10:00
matthewpalmer a449ebf527 Update compatibility branch name 2015-08-31 21:29:59 +10:00
matthewpalmer ccda8fb901 Update README 2015-08-31 21:02:40 +10:00
matthewpalmer f94eff2115 Update README 2015-08-31 20:47:32 +10:00
matthewpalmer ee96b18cfd Add tests to clarify closure bug 2015-08-31 19:42:32 +10:00
matthewpalmer 79cf22216f Refactor into separate files and fix closure bug 2015-08-31 19:42:16 +10:00
matthewpalmer 4bfbf86f73 Add the ability to conform to all 3 protocols 2015-08-31 18:58:01 +10:00
matthewpalmer f0c4572ff4 Add test for deleting internet password 2015-08-31 18:27:11 +10:00
matthewpalmer af441ab648 Add internet password request metadata support 2015-08-30 22:23:24 +10:00
matthewpalmer 6074c2640a Add ability to retrieve result metadata from request 2015-08-30 20:31:58 +10:00
matthewpalmer 351b0a4c82 Update readme with code fix 2015-08-30 15:23:09 +10:00
matthewpalmer 38b29df3ca Update installation steps 2015-08-30 14:22:15 +10:00
matthewpalmer 9efa16d266 Remove br 2015-08-30 14:15:26 +10:00
matthewpalmer 709d323463 Fix README typos 2015-08-30 14:14:46 +10:00
matthewpalmer e06271dd90 Major rewrite to be protocol-oriented 2015-08-30 14:06:48 +10:00
matthewpalmer 1b40db9405 Add loading all data for a service.
* Note: this only works for .GenericPasswords. I think I've found
  a bug in trying to load other types of security classes,
  so will need to investigate that further
2015-08-23 19:39:00 +10:00
matthewpalmer afe4706789 Manually merge change to [String: AnyObject] 2015-08-22 22:21:37 +10:00
matthewpalmer a89f2584ce Merge branch 'kayvink-master' into swift-2.0-further-changes
* kayvink-master:
2015-08-22 22:14:22 +10:00
matthewpalmer cb920c0318 Merge branch 'master' of https://github.com/kayvink/Locksmith into kayvink-master
* 'master' of https://github.com/kayvink/Locksmith:
  - Changed saveData from Dictionary<String,String> to Dictionary<String,AnyObjec> - Changed updateData from Dictionary<String,String> to Dictionary<String,AnyObjec>
  - Changed NSDictionary to Dictionary<String:AnyObject> - Added support for other file types beside String
  Update README.md
2015-08-22 22:10:45 +10:00
matthewpalmer b11dea36b4 Merge branch '2.0' into getaaron-keychain-enumeration
* 2.0:
  Update version number
  Update README to reflect Swift 2 changes
  Change loadData method to be non-throwing
  Update tests for new error handling mechanisms
  Refactor for Swift 2
  Major update for Swift 2
  Add tests for Swift 2 style errors
  Update README.md
  + Updates to the new Swift 2 syntax
2015-08-22 22:04:05 +10:00
matthewpalmer 07a9234d3e Merge branch 'master' of https://github.com/kayvink/Locksmith into kayvink-master
* 'master' of https://github.com/kayvink/Locksmith:
  - Changed saveData from Dictionary<String,String> to Dictionary<String,AnyObjec> - Changed updateData from Dictionary<String,String> to Dictionary<String,AnyObjec>
  - Changed NSDictionary to Dictionary<String:AnyObject> - Added support for other file types beside String
2015-08-22 21:22:16 +10:00
matthewpalmer b193e300a5 Add fixes from #38 2015-08-22 21:05:06 +10:00
matthewpalmer 7e53fc8322 Merge branch 'keychain-enumeration' of https://github.com/getaaron/Locksmith into getaaron-keychain-enumeration
* 'keychain-enumeration' of https://github.com/getaaron/Locksmith:
  Make user account optional
  Deprecate .Many and replace it with .All
  Initial implementation of each
  Update README.md
2015-08-22 20:48:13 +10:00
Kay Vink 9ce641f262 - Changed saveData from Dictionary<String,String> to Dictionary<String,AnyObjec>
- Changed updateData from Dictionary<String,String> to Dictionary<String,AnyObjec>

- Changed LocksmithRequest data from NSDictionary? to Dictionary<String,Anyobject>?
- Updated init accordingly
2015-08-21 16:13:45 +02:00
Kay Vink 17d52574ab - Changed NSDictionary to Dictionary<String:AnyObject>
- Added support for other file types beside String
2015-08-21 15:53:57 +02:00
Aaron Brager 5602015a6d Make user account optional 2015-08-12 12:39:29 +02:00
Aaron Brager 737c262e8b Deprecate .Many and replace it with .All 2015-08-12 12:02:40 +02:00
Aaron Brager 8dc3ef57c6 Initial implementation of each 2015-08-12 12:02:03 +02:00
Matthew Palmer 48f008a26e Update README.md 2015-08-11 22:30:00 +10:00
matthewpalmer 7a6395f189 Update version number 2015-06-27 15:42:53 +10:00
matthewpalmer c48ce652bd Update README to reflect Swift 2 changes 2015-06-27 15:42:05 +10:00
matthewpalmer 716759b767 Change loadData method to be non-throwing 2015-06-27 15:36:29 +10:00
matthewpalmer 3da0e97cc6 Update tests for new error handling mechanisms 2015-06-27 10:50:20 +10:00
matthewpalmer 03b5015f4f Refactor for Swift 2
* Make more extensive use of enums for Accessible and SecurityClass
  This wraps up the kSecXXX values much more nicely, and makes them
  more easily accessible through the provided enums
2015-06-27 10:46:24 +10:00
matthewpalmer 1b0c092708 Major update for Swift 2
* Add Swift 2-style error handling: many functions now 'throw'
* Add error types conforming to ErrorType, which are thrown
* Consolidate error processing and information sources to be
  in a single enum
* Refactor and clean up logic as a result of these improvements
  in error handling
2015-06-27 10:44:27 +10:00
matthewpalmer 25917eaf15 Add tests for Swift 2 style errors
* Many functions will now throw instead of returning an NSError
* I have run these in a separate demo project, but not as part of
  the main project (Cocoapods/testing woes continue). If you want
  to run these tests standalone, I've put them in a Gist here
  https://gist.github.com/matthewpalmer/17f54354a710828ec193
* Most of these tests use try!, though they could probably be
  improved to use do/try/catch
2015-06-27 10:42:03 +10:00
Matthew Palmer 0dda3a7208 Update README.md
Add note on Swift 2 support
2015-06-23 07:42:03 +10:00
Matthew Palmer 4dce464fb0 Update README.md
Add README note for installing the 2.0 branch
2015-06-23 07:38:07 +10:00
matthewpalmer 5e508a7551 Merge branch 'SirWellington-feature/swift-2.0-update' into 2.0
* SirWellington-feature/swift-2.0-update:
  + Updates to the new Swift 2 syntax
2015-06-23 07:32:39 +10:00
matthewpalmer a2e58ce87f Merge branch 'feature/swift-2.0-update' of https://github.com/SirWellington/Locksmith into SirWellington-feature/swift-2.0-update
* 'feature/swift-2.0-update' of https://github.com/SirWellington/Locksmith:
  + Updates to the new Swift 2 syntax
2015-06-23 07:32:29 +10:00
Juan Wellington Moreno 825d7d2485 + Updates to the new Swift 2 syntax 2015-06-20 14:22:43 -07:00
matthewpalmer 0418e37185 Release 1.2.2 2015-05-24 09:44:45 +10:00
Matthew Palmer c218c1fbea Add note on running tests 2015-05-24 09:34:49 +10:00
Matthew Palmer 68515bdc2c Merge pull request #34 from larslockefeer/CarthageSupport
Fixed some leftover Carthage issues
2015-05-24 09:05:42 +10:00
Lars Lockefeer f38046bb9e Added Info.plist file 2015-05-23 12:50:51 +02:00
Lars Lockefeer e804dd0452 Set deployment target to iOS 8.0 2015-05-22 17:52:26 +02:00
Matthew Palmer 04c6084a8f Merge pull request #33 from larslockefeer/CarthageSupport
Carthage support
2015-05-22 21:05:24 +10:00
Lars Lockefeer fbc549973b Made the xcode scheme shared for Carthage support 2015-05-21 18:30:19 +02:00
Lars Lockefeer 4ad7ca14e6 Made LocksmithDefaultService resilient against absent plist keys 2015-05-21 18:26:06 +02:00
Lars Lockefeer 582f74e305 Updated the tests
The signature of some methods in `Locksmith.swift` was updated, but the
tests weren’t. This commit updates the tests such that they resemble
the API exposed by `Locksmith.swift` again.
2015-05-21 18:25:38 +02:00
Lars Lockefeer 1758691bc2 Restored the project file
The main project file was still based on the Project Structure before
the addition of Cocoapods support. It has now been restored, such that
the project can be opened and compiled
2015-05-21 18:24:03 +02:00
Matthew Palmer 2a21d9d0d1 Merge pull request #30 from matthewpalmer/1.2.1
Update podspec and tests for latest version
2015-04-10 10:18:17 +10:00
305 changed files with 3235 additions and 8384 deletions
-3
View File
@@ -26,8 +26,6 @@ DerivedData
#
# Pods/
=======
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
@@ -35,4 +33,3 @@ DerivedData
.idea/
# Pods - for those of you who use CocoaPods
Pods
>>>>>>> a8d082ca0a00018a7df906eca307a0961fbd4357
+59 -13
View File
@@ -1,15 +1,61 @@
# references:
# * http://www.objc.io/issue-6/travis-ci.html
# * https://github.com/supermarin/xcpretty#usage
# Taken from https://github.com/Alamofire/AlamofireImage
language: objective-c
osx_image: xcode7
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
matrix:
- DESTINATION="OS=2.0,name=Apple Watch - 42mm" SCHEME="Locksmith watchOS" SDK=watchsimulator2.0 RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="YES"
- DESTINATION="arch=x86_64" SCHEME="Locksmith OS X" SDK=macosx10.11 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
language: swift
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
# "build_example" should be YES but travis was giving me grief
- DESTINATION="OS=9.0,name=iPad 2" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPad 2" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.2,name=iPhone 4S" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.3,name=iPhone 5" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 5S" SCHEME="Locksmith iOS" SDK=iphonesimulator9.0 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
script:
- set -o pipefail && xcodebuild test -workspace Example/Locksmith.xcworkspace -scheme Locksmith -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
- pod lib lint --quick
- set -o pipefail
- xcodebuild -version
# Build and run tests in Debug and Release
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
-configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c;
fi
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
-configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c;
fi
# Only build in Debug and Release
- if [ $RUN_TESTS == "NO" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
-configuration Debug ONLY_ACTIVE_ARCH=NO | xcpretty -c;
fi
- if [ $RUN_TESTS == "NO" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION"
-configuration Release ONLY_ACTIVE_ARCH=NO | xcpretty -c;
fi
# Build example in Debug and Release
- if [ $BUILD_EXAMPLE == "YES" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "Locksmith iOS Example" -sdk "$SDK" -destination "$DESTINATION"
-configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
fi
- if [ $BUILD_EXAMPLE == "YES" ]; then
xcodebuild -workspace Locksmith.xcworkspace -scheme "Locksmith iOS Example" -sdk "$SDK" -destination "$DESTINATION"
-configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
fi
# Run pod lib lint quick if specified
- if [ $POD_LINT == "YES" ]; then
pod lib lint --quick;
fi
-566
View File
@@ -1,566 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0EFF2E121A74DB2F007F091F /* LocksmithTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFF2E111A74DB2F007F091F /* LocksmithTests.swift */; };
13AE2F64DF760DB65763DCD3 /* Pods_Locksmith.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B7EB4002C28E8C411F01E459 /* Pods_Locksmith.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
65B60026AFB3A444C96283F4 /* Pods_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C424AFB4627DE883BC159F2 /* Pods_Tests.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6003F582195388D10070C39A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 6003F589195388D20070C39A;
remoteInfo = Locksmith;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0EFF2E101A74DB2E007F091F /* Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Bridging-Header.h"; sourceTree = "<group>"; };
0EFF2E111A74DB2F007F091F /* LocksmithTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocksmithTests.swift; sourceTree = "<group>"; };
5C424AFB4627DE883BC159F2 /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5EED6F71CD7E7E38799A9088 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = "<group>"; };
6003F58A195388D20070C39A /* Locksmith.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Locksmith.app; sourceTree = BUILT_PRODUCTS_DIR; };
6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
6003F5AE195388D20070C39A /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
6CD8C57E2443F70459FC855A /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
71D78BD7B80CF35F7AB983DA /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = "<group>"; };
A3BA10543E418C7145D9A876 /* Locksmith.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Locksmith.podspec; path = ../Locksmith.podspec; sourceTree = "<group>"; };
AC21E995B5D782DE1BD72A13 /* Pods-Locksmith.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Locksmith.release.xcconfig"; path = "Pods/Target Support Files/Pods-Locksmith/Pods-Locksmith.release.xcconfig"; sourceTree = "<group>"; };
B2C887220ADA4C2285BD6A81 /* Pods-Locksmith.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Locksmith.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Locksmith/Pods-Locksmith.debug.xcconfig"; sourceTree = "<group>"; };
B7EB4002C28E8C411F01E459 /* Pods_Locksmith.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Locksmith.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D8A12441F80D586EAA6DFAE6 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6003F587195388D20070C39A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */,
6003F592195388D20070C39A /* UIKit.framework in Frameworks */,
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */,
13AE2F64DF760DB65763DCD3 /* Pods_Locksmith.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
6003F5AB195388D20070C39A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
65B60026AFB3A444C96283F4 /* Pods_Tests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6003F581195388D10070C39A = {
isa = PBXGroup;
children = (
60FF7A9C1954A5C5007DD14C /* Podspec Metadata */,
6003F5B5195388D20070C39A /* Tests */,
6003F58C195388D20070C39A /* Frameworks */,
6003F58B195388D20070C39A /* Products */,
B7D9B47D5D9EC387A120D37A /* Pods */,
);
sourceTree = "<group>";
};
6003F58B195388D20070C39A /* Products */ = {
isa = PBXGroup;
children = (
6003F58A195388D20070C39A /* Locksmith.app */,
6003F5AE195388D20070C39A /* Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
6003F58C195388D20070C39A /* Frameworks */ = {
isa = PBXGroup;
children = (
6003F58D195388D20070C39A /* Foundation.framework */,
6003F58F195388D20070C39A /* CoreGraphics.framework */,
6003F591195388D20070C39A /* UIKit.framework */,
6003F5AF195388D20070C39A /* XCTest.framework */,
B7EB4002C28E8C411F01E459 /* Pods_Locksmith.framework */,
5C424AFB4627DE883BC159F2 /* Pods_Tests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
6003F5B5195388D20070C39A /* Tests */ = {
isa = PBXGroup;
children = (
0EFF2E111A74DB2F007F091F /* LocksmithTests.swift */,
6003F5B6195388D20070C39A /* Supporting Files */,
0EFF2E101A74DB2E007F091F /* Tests-Bridging-Header.h */,
);
path = Tests;
sourceTree = "<group>";
};
6003F5B6195388D20070C39A /* Supporting Files */ = {
isa = PBXGroup;
children = (
6003F5B7195388D20070C39A /* Tests-Info.plist */,
6003F5B8195388D20070C39A /* InfoPlist.strings */,
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = {
isa = PBXGroup;
children = (
A3BA10543E418C7145D9A876 /* Locksmith.podspec */,
6CD8C57E2443F70459FC855A /* README.md */,
D8A12441F80D586EAA6DFAE6 /* LICENSE */,
);
name = "Podspec Metadata";
sourceTree = "<group>";
};
B7D9B47D5D9EC387A120D37A /* Pods */ = {
isa = PBXGroup;
children = (
B2C887220ADA4C2285BD6A81 /* Pods-Locksmith.debug.xcconfig */,
AC21E995B5D782DE1BD72A13 /* Pods-Locksmith.release.xcconfig */,
5EED6F71CD7E7E38799A9088 /* Pods-Tests.debug.xcconfig */,
71D78BD7B80CF35F7AB983DA /* Pods-Tests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
6003F589195388D20070C39A /* Locksmith */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "Locksmith" */;
buildPhases = (
5E2E4A3393C6EFF486EEB802 /* Check Pods Manifest.lock */,
6003F586195388D20070C39A /* Sources */,
6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */,
1DC11D3DCA31DFDD8B121B3B /* Copy Pods Resources */,
5C7FFF24A37A121C9638FBE4 /* Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Locksmith;
productName = Locksmith;
productReference = 6003F58A195388D20070C39A /* Locksmith.app */;
productType = "com.apple.product-type.application";
};
6003F5AD195388D20070C39A /* Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Tests" */;
buildPhases = (
233CB72219D113903690BD69 /* Check Pods Manifest.lock */,
6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */,
50B1458C3BD4E6E7F43E246D /* Copy Pods Resources */,
8681ED57DFA32D5996C4B140 /* Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
6003F5B4195388D20070C39A /* PBXTargetDependency */,
);
name = Tests;
productName = LocksmithTests;
productReference = 6003F5AE195388D20070C39A /* Tests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6003F582195388D10070C39A /* Project object */ = {
isa = PBXProject;
attributes = {
CLASSPREFIX = Locksmith;
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = matthewpalmer;
TargetAttributes = {
6003F5AD195388D20070C39A = {
TestTargetID = 6003F589195388D20070C39A;
};
};
};
buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "Locksmith" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 6003F581195388D10070C39A;
productRefGroup = 6003F58B195388D20070C39A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
6003F589195388D20070C39A /* Locksmith */,
6003F5AD195388D20070C39A /* Tests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
6003F588195388D20070C39A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
6003F5AC195388D20070C39A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1DC11D3DCA31DFDD8B121B3B /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Locksmith/Pods-Locksmith-resources.sh\"\n";
showEnvVarsInLog = 0;
};
233CB72219D113903690BD69 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
50B1458C3BD4E6E7F43E246D /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
5C7FFF24A37A121C9638FBE4 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Locksmith/Pods-Locksmith-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
5E2E4A3393C6EFF486EEB802 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
8681ED57DFA32D5996C4B140 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6003F586195388D20070C39A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
6003F5AA195388D20070C39A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EFF2E121A74DB2F007F091F /* LocksmithTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
6003F5B4195388D20070C39A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 6003F589195388D20070C39A /* Locksmith */;
targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
6003F5B8195388D20070C39A /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
6003F5B9195388D20070C39A /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
6003F5BD195388D20070C39A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
6003F5BE195388D20070C39A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
6003F5C0195388D20070C39A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B2C887220ADA4C2285BD6A81 /* Pods-Locksmith.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Locksmith/Locksmith-Prefix.pch";
INFOPLIST_FILE = "Locksmith-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
6003F5C1195388D20070C39A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = AC21E995B5D782DE1BD72A13 /* Pods-Locksmith.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Locksmith/Locksmith-Prefix.pch";
INFOPLIST_FILE = "Locksmith-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
6003F5C3195388D20070C39A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5EED6F71CD7E7E38799A9088 /* Pods-Tests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Locksmith.app/Locksmith";
CLANG_ENABLE_MODULES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Tests/Tests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
6003F5C4195388D20070C39A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 71D78BD7B80CF35F7AB983DA /* Pods-Tests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Locksmith.app/Locksmith";
CLANG_ENABLE_MODULES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
INFOPLIST_FILE = "Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Tests/Tests-Bridging-Header.h";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6003F585195388D10070C39A /* Build configuration list for PBXProject "Locksmith" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6003F5BD195388D20070C39A /* Debug */,
6003F5BE195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "Locksmith" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6003F5C0195388D20070C39A /* Debug */,
6003F5C1195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6003F5C3195388D20070C39A /* Debug */,
6003F5C4195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6003F582195388D10070C39A /* Project object */;
}
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Locksmith.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
-16
View File
@@ -1,16 +0,0 @@
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'
target 'Locksmith', :exclusive => true do
pod "Locksmith", :path => "../"
end
target 'Tests', :exclusive => true do
pod "Locksmith", :path => "../"
pod 'Specta', '~> 0.2.1'
pod 'Expecta'
end
-20
View File
@@ -1,20 +0,0 @@
PODS:
- Expecta (0.3.1)
- Locksmith (1.2.1)
- Specta (0.2.1)
DEPENDENCIES:
- Expecta
- Locksmith (from `../`)
- Specta (~> 0.2.1)
EXTERNAL SOURCES:
Locksmith:
:path: "../"
SPEC CHECKSUMS:
Expecta: a354d4633409dd9fe8c4f5ff5130426adbe31628
Locksmith: 770f6c5c6e5c5c712d1f00e709c62b8a7240c716
Specta: 15a276a6343867b426d5ed135d5aa4d04123a573
COCOAPODS: 0.36.3
-19
View File
@@ -1,19 +0,0 @@
Copyright (c) 2011-2012 Specta Team - https://github.com/specta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-308
View File
@@ -1,308 +0,0 @@
#Expecta
[![Build Status](http://img.shields.io/travis/specta/expecta/master.svg?style=flat)](https://travis-ci.org/specta/expecta)
[![Pod Version](http://img.shields.io/cocoapods/v/Expecta.svg?style=flat)](http://cocoadocs.org/docsets/Expecta/)
[![Pod Platform](http://img.shields.io/cocoapods/p/Expecta.svg?style=flat)](http://cocoadocs.org/docsets/Expecta/)
[![Pod License](http://img.shields.io/cocoapods/l/Expecta.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)
A Matcher Framework for Objective-C/Cocoa
## NOTICE
Expecta 0.3.x removes support for Garbage Collected targets, as support for these has been removed from Xcode 5.1 and greater. If you need Garbage Collection support, please continue to use Expecta 0.2.4. The minimum deployment targets have also been raised to iOS 5.x and OS X 10.7 or greater.
Expecta 0.2.x and later has a new syntax that is slightly different from Expecta 0.1.x. For example `expect(x).toEqual(y)` should now be written as `expect(x).to.equal(y)`. You can do `#define EXP_OLD_SYNTAX` before importing `Expecta.h` to enable backward-compatiblity mode, but keep in mind that the old syntax is deprecated.
## INTRODUCTION
The main advantage of using Expecta over other matcher frameworks is that you do not have to specify the data types. Also, the syntax of Expecta matchers is much more readable and does not suffer from parenthesitis.
**OCHamcrest**
```objective-c
assertThat(@"foo", is(equalTo(@"foo")));
assertThatUnsignedInteger(foo, isNot(equalToUnsignedInteger(1)));
assertThatBool([bar isBar], is(equalToBool(YES)));
assertThatDouble(baz, is(equalToDouble(3.14159)));
```
vs. **Expecta**
```objective-c
expect(@"foo").to.equal(@"foo"); // `to` is a syntatic sugar and can be safely omitted.
expect(foo).notTo.equal(1);
expect([bar isBar]).to.equal(YES);
expect(baz).to.equal(3.14159);
```
## SETUP
Use [CocoaPods](https://github.com/CocoaPods/CocoaPods)
```ruby
target :MyApp do
#your app dependencies
end
target :MyAppTests do
pod 'Expecta', '~> 0.2.4' # expecta matchers
#pod 'Specta', '~> 0.1.11' #specta bdd framework
end
```
or
1. Clone from Github.
2. Run `rake` in project root to build.
3. Copy and add all header files in `products` folder to the Spec/Test target in your Xcode project.
4. For **OS X projects**, copy and add `libExpecta-macosx.a` in `products` folder to the Spec/Test target in your Xcode project.
For **iOS projects**, copy and add `libExpecta-ios-universal.a` in `products` folder to the Spec/Test target in your Xcode project.
5. Add `-ObjC` to the "Other Linker Flags" build setting for the Spec/Test target in your Xcode project.
6. Add the following to your test code.
```objective-c
// #define EXP_OLD_SYNTAX // enable backward-compatibility
#define EXP_SHORTHAND
#import "Expecta.h"
```
If `EXP_SHORTHAND` is not defined, expectations must be written with `EXP_expect` instead of `expect`.
Expecta is framework-agnostic. It works well with XCTest, OCUnit (SenTestingKit) and OCUnit-compatible test frameworks such as [Specta](http://github.com/petejkim/specta/), [GHUnit](http://github.com/gabriel/gh-unit/) and [GTMUnit](http://code.google.com/p/google-toolbox-for-mac/). Expecta also supports [Cedar](http://pivotal.github.com/cedar/).
## BUILT-IN MATCHERS
>`expect(x).to.equal(y);` compares objects or primitives x and y and passes if they are identical (==) or equivalent (isEqual:).
>
>`expect(x).to.beIdenticalTo(y);` compares objects x and y and passes if they are identical and have the same memory address.
>
>`expect(x).to.beNil();` passes if x is nil.
>
>`expect(x).to.beTruthy();` passes if x evaluates to true (non-zero).
>
>`expect(x).to.beFalsy();` passes if x evaluates to false (zero).
>
>`expect(x).to.contain(y);` passes if an instance of NSArray or NSString x contains y.
>
>`expect(x).to.beSupersetOf(y);` passes if an instance of NSArray, NSSet, NSDictionary or NSOrderedSet x contains all elements of y.
>
>`expect(x).to.haveCountOf(y);` passes if an instance of NSArray, NSSet, NSDictionary or NSString x has a count or length of y.
>
>`expect(x).to.beEmpty();` passes if an instance of NSArray, NSSet, NSDictionary or NSString x has a count or length of 0.
>
>`expect(x).to.beInstanceOf([Foo class]);` passes if x is an instance of a class Foo.
>
>`expect(x).to.beKindOf([Foo class]);` passes if x is an instance of a class Foo or if x is an instance of any class that inherits from the class Foo.
>
>`expect([Foo class]).to.beSubclassOf([Bar class]);` passes if the class Foo is a subclass of the class Bar or if it is identical to the class Bar. Use beKindOf() for class clusters.
>
>`expect(x).to.beLessThan(y);` passes if `x` is less than `y`.
>
>`expect(x).to.beLessThanOrEqualTo(y);` passes if `x` is less than or equal to `y`.
>
>`expect(x).to.beGreaterThan(y);` passes if `x` is greater than `y`.
>
>`expect(x).to.beGreaterThanOrEqualTo(y);` passes if `x` is greater than or equal to `y`.
>
>`expect(x).to.beInTheRangeOf(y,z);` passes if `x` is in the range of `y` and `z`.
>
>`expect(x).to.beCloseTo(y);` passes if `x` is close to `y`.
>
>`expect(x).to.beCloseToWithin(y, z);` passes if `x` is close to `y` within `z`.
>
>`expect(^{ /* code */ }).to.raise(@"ExceptionName");` passes if a given block of code raises an exception named `ExceptionName`.
>
>`expect(^{ /* code */ }).to.raiseAny();` passes if a given block of code raises any exception.
>
>`expect(x).to.conformTo(y);` passes if `x` conforms to the protocol `y`.
>
>`expect(x).to.respondTo(y);` passes if `x` responds to the selector `y`.
>
>`expect(^{ /* code */ }).to.notify(@"NotificationName");` passes if a given block of code generates an NSNotification named `NotificationName`.
>
>`expect(^{ /* code */ }).to.notify(notification);` passes if a given block of code generates an NSNotification equal to the passed `notification`.
>
>`expect(x).to.beginWith(y);` passes if an instance of NSString, NSArray, or NSOrderedSet `x` begins with `y`. Also aliased by `startWith`
>
>`expect(x).to.endWith(y);` passes if an instance of NSString, NSArray, or NSOrderedSet `x` ends with `y`.
**Please contribute more matchers.**
## INVERTING MATCHERS
Every matcher's criteria can be inverted by prepending `.notTo` or `.toNot`:
>`expect(x).notTo.equal(y);` compares objects or primitives x and y and passes if they are *not* equivalent.
## ASYNCHRONOUS TESTING
Every matcher can be made to perform asynchronous testing by prepending `.will`, `.willNot` or `after(...)`:
>`expect(x).will.beNil();` passes if x becomes nil before the default timeout.
>
>`expect(x).willNot.beNil();` passes if x becomes non-nil before the default timeout.
>
>`expect(x).after(3).to.beNil();` passes if x becoms nil after 3.0 seconds.
>
>`expect(x).after(2.5).notTo.equal(42);` passes if x doesn't equal 42 after 2.5 seconds.
Default timeout is 1.0 second and it's used for all matchers if not specified otherwise. This setting can be changed by calling `[Expecta setAsynchronousTestTimeout:x]`, where x is the desired timeout.
```objective-c
describe(@"Foo", ^{
beforeAll(^{
// All asynchronous matching using `will` and `willNot`
// will have a timeout of 2.0 seconds
[Expecta setAsynchronousTestTimeout:2];
});
it(@"will not be nil", ^{
// Test case where default timeout is used
expect(foo).willNot.beNil();
});
it(@"should equal 42 after 3 seconds", ^{
// Signle case where timeout differs from the default
expect(foo).after(3).to.equal(42);
});
});
```
## WRITING NEW MATCHERS
Writing a new matcher is easy with special macros provided by Expecta. Take a look at how `.beKindOf()` matcher is defined:
`EXPMatchers+beKindOf.h`
```objective-c
#import "Expecta.h"
EXPMatcherInterface(beKindOf, (Class expected));
// 1st argument is the name of the matcher function
// 2nd argument is the list of arguments that may be passed in the function
// call.
// Multiple arguments are fine. (e.g. (int foo, float bar))
#define beAKindOf beKindOf
```
`EXPMatchers+beKindOf.m`
```objective-c
#import "EXPMatchers+beKindOf.h"
EXPMatcherImplementationBegin(beKindOf, (Class expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
prerequisite(^BOOL {
return !(actualIsNil || expectedIsNil);
// Return `NO` if matcher should fail whether or not the result is inverted
// using `.Not`.
});
match(^BOOL {
return [actual isKindOfClass:expected];
// Return `YES` if the matcher should pass, `NO` if it should not.
// The actual value/object is passed as `actual`.
// Please note that primitive values will be wrapped in NSNumber/NSValue.
});
failureMessageForTo(^NSString * {
if (actualIsNil)
return @"the actual value is nil/null";
if (expectedIsNil)
return @"the expected value is nil/null";
return [NSString
stringWithFormat:@"expected: a kind of %@, "
"got: an instance of %@, which is not a kind of %@",
[expected class], [actual class], [expected class]];
// Return the message to be displayed when the match function returns `YES`.
});
failureMessageForNotTo(^NSString * {
if (actualIsNil)
return @"the actual value is nil/null";
if (expectedIsNil)
return @"the expected value is nil/null";
return [NSString
stringWithFormat:@"expected: not a kind of %@, "
"got: an instance of %@, which is a kind of %@",
[expected class], [actual class], [expected class]];
// Return the message to be displayed when the match function returns `NO`.
});
}
EXPMatcherImplementationEnd
```
## DYNAMIC PREDICATE MATCHERS
It is possible to add predicate matchers by simply defining the matcher interface, with the matcher implementation being handled at runtime by delegating to the predicate method on your object.
For instance, if you have the following class:
```objc
@interface LightSwitch : NSObject
@property (nonatomic, assign, getter=isTurnedOn) BOOL turnedOn;
@end
@implementation LightSwitch
@synthesize turnedOn;
@end
```
The normal way to write an assertion that the switch is turned on would be:
```objc
expect([lightSwitch isTurnedOn]).to.beTruthy();
```
However, if we define a custom predicate matcher:
```objc
EXPMatcherInterface(isTurnedOn, (void));
```
(Note: we haven't defined the matcher implementation, just it's interface)
You can now write your assertion as follows:
```objc
expect(lightSwitch).isTurnedOn();
```
## CONTRIBUTION
You can find the public Tracker project [here](https://www.pivotaltracker.com/projects/323267).
### CONTRIBUTION GUIDELINES
* Please use only spaces and indent 2 spaces at a time.
* Please prefix instance variable names with a single underscore (`_`).
* Please prefix custom classes and functions defined in the global scope with `EXP`.
## CREDITS
Expecta is brought to you by [Peter Jihoon Kim](http://github.com/petejkim) and the [Specta team](https://github.com/specta?tab=members).
### CONTRIBUTORS
* [Alan Rogers](https://github.com/alanjrogers)
* [Andrew Kitchen](https://github.com/akitchen)
* [Blake Watters](https://github.com/blakewatters)
* [Christopher Pickslay](https://github.com/twobitlabs)
* [Chris Devereux](https://github.com/chrisdevereux)
* [David Hart](https://github.com/TrahDivad)
* [Jacob Gorban](https://github.com/apparentsoft)
* [Jon Cooper](https://github.com/joncooper)
* [Justin Spahr-Summers](https://github.com/jspahrsummers)
* [Kurtis Seebaldt](https://github.com/kseebaldt)
* [Luke Redpath](https://github.com/lukeredpath)
* [Nicholas Hutchinson](https://github.com/nickhutchinson)
* [Rob Rix](https://github.com/robrix)
* [Samuel Giddins](https://github.com/segiddins)
* [Zack Waugh](https://github.com/zachwaugh)
## LICENSE
Expecta is licensed under the [MIT License](http://github.com/petejkim/expecta/raw/master/LICENSE).
-42
View File
@@ -1,42 +0,0 @@
#import "EXPExpect.h"
@interface EXPExpect (BackwardCompatiblity)
@property(nonatomic, readonly) EXPExpect *Not;
@property(nonatomic, readonly) EXPExpect *isGoing;
@property(nonatomic, readonly) EXPExpect *isNotGoing;
@end
#define toBeFalsy beFalsy
#define toBeGreaterThan beGreaterThan
#define toBeGreaterThanOrEqualTo beGreaterThanOrEqualTo
#define toBeIdenticalTo beIdenticalTo
#define toBeInTheRangeOf beInTheRangeOf
#define toBeInstanceOf beInstanceOf
#define toBeAnInstanceOf beInstanceOf
#define toBeMemberOf beInstanceOf
#define toBeAMemberOf beInstanceOf
#define toBeKindOf beKindOf
#define toBeAKindOf beKindOf
#define toBeLessThan beLessThan
#define toBeLessThanOrEqualTo beLessThanOrEqualTo
#define toBeNil beNil
#define toBeNull beNil
#define toBeSubclassOf beSubclassOf
#define toBeASubclassOf beSubclassOf
#define toBeTruthy beTruthy
#define toBeFalsy beFalsy
#define toContain contain
#define toEqual equal
#define toBeCloseTo beCloseTo
#define toBeCloseToWithin beCloseToWithin
#define toHaveCount haveCountOf
#define toHaveCountOf haveCountOf
#define toHaveACountOf haveCountOf
#define toHaveLength haveCountOf
#define toHaveLengthOf haveCountOf
#define toHaveALengthOf haveCountOf
#define toBeEmpty beEmpty
#define toRaise raise
#define toRaiseAny raiseAny
-17
View File
@@ -1,17 +0,0 @@
#import "EXPBackwardCompatibility.h"
@implementation EXPExpect (BackwardCompatiblity)
- (EXPExpect *)Not {
return self.toNot;
}
- (EXPExpect *)isGoing {
return self.will;
}
- (EXPExpect *)isNotGoing {
return self.willNot;
}
@end
-25
View File
@@ -1,25 +0,0 @@
//
// EXPRuntimeMatcher.h
// Expecta
//
// Created by Luke Redpath on 26/03/2012.
// Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "EXPMatcher.h"
#import "EXPDefines.h"
@interface EXPBlockDefinedMatcher : NSObject <EXPMatcher> {
EXPBoolBlock prerequisiteBlock;
EXPBoolBlock matchBlock;
EXPStringBlock failureMessageForToBlock;
EXPStringBlock failureMessageForNotToBlock;
}
@property(nonatomic, copy) EXPBoolBlock prerequisiteBlock;
@property(nonatomic, copy) EXPBoolBlock matchBlock;
@property(nonatomic, copy) EXPStringBlock failureMessageForToBlock;
@property(nonatomic, copy) EXPStringBlock failureMessageForNotToBlock;
@end
-60
View File
@@ -1,60 +0,0 @@
//
// EXPRuntimeMatcher.m
// Expecta
//
// Created by Luke Redpath on 26/03/2012.
// Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//
#import "EXPBlockDefinedMatcher.h"
@implementation EXPBlockDefinedMatcher
- (void)dealloc
{
self.prerequisiteBlock = nil;
self.matchBlock = nil;
self.failureMessageForToBlock = nil;
self.failureMessageForNotToBlock = nil;
[super dealloc];
}
@synthesize prerequisiteBlock;
@synthesize matchBlock;
@synthesize failureMessageForToBlock;
@synthesize failureMessageForNotToBlock;
- (BOOL)meetsPrerequesiteFor:(id)actual
{
if (self.prerequisiteBlock) {
return self.prerequisiteBlock();
}
return YES;
}
- (BOOL)matches:(id)actual
{
if (self.matchBlock) {
return self.matchBlock();
}
return YES;
}
- (NSString *)failureMessageForTo:(id)actual
{
if (self.failureMessageForToBlock) {
return self.failureMessageForToBlock();
}
return nil;
}
- (NSString *)failureMessageForNotTo:(id)actual
{
if (self.failureMessageForNotToBlock) {
return self.failureMessageForNotToBlock();
}
return nil;
}
@end
-17
View File
@@ -1,17 +0,0 @@
//
// EXPDefines.h
// Expecta
//
// Created by Luke Redpath on 26/03/2012.
// Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//
#ifndef Expecta_EXPDefines_h
#define Expecta_EXPDefines_h
typedef void (^EXPBasicBlock)();
typedef id (^EXPIdBlock)();
typedef BOOL (^EXPBoolBlock)();
typedef NSString *(^EXPStringBlock)();
#endif
-13
View File
@@ -1,13 +0,0 @@
#import <Foundation/Foundation.h>
@interface EXPDoubleTuple : NSObject {
double *_values;
size_t _size;
}
@property (nonatomic, assign) double *values;
@property (nonatomic, assign) size_t size;
- (id)initWithDoubleValues:(double *)values size:(size_t)size;
@end
-42
View File
@@ -1,42 +0,0 @@
#import "EXPDoubleTuple.h"
@implementation EXPDoubleTuple
@synthesize values = _values, size = _size;
- (id)initWithDoubleValues:(double *)values size:(size_t)size {
if ((self = [super init])) {
self.values = malloc(sizeof(double) * size);
memcpy(self.values, values, sizeof(double) * size);
self.size = size;
}
return self;
}
- (void)dealloc {
free(self.values);
[super dealloc];
}
- (BOOL)isEqual:(id)object {
if (![object isKindOfClass:[EXPDoubleTuple class]]) return NO;
EXPDoubleTuple *other = (EXPDoubleTuple *)object;
if (self.size == other.size) {
for (int i = 0; i < self.size; ++i) {
if (self.values[i] != other.values[i]) return NO;
}
return YES;
}
return NO;
}
- (NSString *)description {
if (self.size == 2) {
return [NSString stringWithFormat:@"Double tuple: {%f, %f}", self.values[0], self.values[1]];
} else if (self.size == 4) {
return [NSString stringWithFormat:@"Double tuple: {%f, %f, %f, %f}", self.values[0], self.values[1], self.values[2], self.values[3]];
}
return [NSString stringWithFormat:@"Double tuple of unexpected size %zd, sadly", self.size];
}
@end
-45
View File
@@ -1,45 +0,0 @@
#import <Foundation/Foundation.h>
#import "EXPMatcher.h"
#import "EXPDefines.h"
@interface EXPExpect : NSObject {
EXPIdBlock _actualBlock;
id _testCase;
int _lineNumber;
char *_fileName;
BOOL _negative;
BOOL _asynchronous;
NSTimeInterval _timeout;
}
@property(nonatomic, copy) EXPIdBlock actualBlock;
@property(nonatomic, readonly) id actual;
@property(nonatomic, assign) id testCase;
@property(nonatomic) int lineNumber;
@property(nonatomic) const char *fileName;
@property(nonatomic) BOOL negative;
@property(nonatomic) BOOL asynchronous;
@property(nonatomic) NSTimeInterval timeout;
@property(nonatomic, readonly) EXPExpect *to;
@property(nonatomic, readonly) EXPExpect *toNot;
@property(nonatomic, readonly) EXPExpect *notTo;
@property(nonatomic, readonly) EXPExpect *will;
@property(nonatomic, readonly) EXPExpect *willNot;
@property(nonatomic, readonly) EXPExpect *(^after)(NSTimeInterval timeInterval);
- (id)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName;
+ (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName;
- (void)applyMatcher:(id<EXPMatcher>)matcher;
- (void)applyMatcher:(id<EXPMatcher>)matcher to:(NSObject **)actual;
@end
@interface EXPDynamicPredicateMatcher : NSObject <EXPMatcher> {
EXPExpect *_expectation;
SEL _selector;
}
- (id)initWithExpectation:(EXPExpect *)expectation selector:(SEL)selector;
- (void (^)(void))dispatch;
@end
-214
View File
@@ -1,214 +0,0 @@
#import "EXPExpect.h"
#import "NSObject+Expecta.h"
#import "Expecta.h"
#import "EXPUnsupportedObject.h"
#import "EXPMatcher.h"
#import "EXPBlockDefinedMatcher.h"
#import <libkern/OSAtomic.h>
@implementation EXPExpect
@dynamic
actual,
to,
toNot,
notTo,
will,
willNot,
after;
@synthesize
actualBlock=_actualBlock,
testCase=_testCase,
negative=_negative,
asynchronous=_asynchronous,
timeout=_timeout,
lineNumber=_lineNumber,
fileName=_fileName;
- (id)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName {
self = [super init];
if(self) {
self.actualBlock = actualBlock;
self.testCase = testCase;
self.negative = NO;
self.asynchronous = NO;
self.timeout = [Expecta asynchronousTestTimeout];
self.lineNumber = lineNumber;
self.fileName = fileName;
}
return self;
}
- (void)dealloc
{
self.actualBlock = nil;
[super dealloc];
}
+ (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(const char *)fileName {
return [[[EXPExpect alloc] initWithActualBlock:actualBlock testCase:(id)testCase lineNumber:lineNumber fileName:fileName] autorelease];
}
#pragma mark -
- (EXPExpect *)to {
return self;
}
- (EXPExpect *)toNot {
self.negative = !self.negative;
return self;
}
- (EXPExpect *)notTo {
return [self toNot];
}
- (EXPExpect *)will {
self.asynchronous = YES;
return self;
}
- (EXPExpect *)willNot {
return self.will.toNot;
}
- (EXPExpect *(^)(NSTimeInterval))after
{
EXPExpect * (^block)(NSTimeInterval) = [^EXPExpect *(NSTimeInterval timeout) {
self.asynchronous = YES;
self.timeout = timeout;
return self;
} copy];
return [block autorelease];
}
#pragma mark -
- (id)actual {
if(self.actualBlock) {
return self.actualBlock();
}
return nil;
}
- (void)applyMatcher:(id<EXPMatcher>)matcher
{
id actual = [self actual];
[self applyMatcher:matcher to:&actual];
}
- (void)applyMatcher:(id<EXPMatcher>)matcher to:(NSObject **)actual {
if([*actual isKindOfClass:[EXPUnsupportedObject class]]) {
EXPFail(self.testCase, self.lineNumber, self.fileName,
[NSString stringWithFormat:@"expecting a %@ is not supported", ((EXPUnsupportedObject *)*actual).type]);
} else {
BOOL failed = NO;
if([matcher respondsToSelector:@selector(meetsPrerequesiteFor:)] &&
![matcher meetsPrerequesiteFor:*actual]) {
failed = YES;
} else {
BOOL matchResult = NO;
if(self.asynchronous) {
NSTimeInterval timeOut = self.timeout;
NSDate *expiryDate = [NSDate dateWithTimeIntervalSinceNow:timeOut];
while(1) {
matchResult = [matcher matches:*actual];
failed = self.negative ? matchResult : !matchResult;
if(!failed || ([(NSDate *)[NSDate date] compare:expiryDate] == NSOrderedDescending)) {
break;
}
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
OSMemoryBarrier();
*actual = self.actual;
}
} else {
matchResult = [matcher matches:*actual];
}
failed = self.negative ? matchResult : !matchResult;
}
if(failed) {
NSString *message = nil;
if(self.negative) {
if ([matcher respondsToSelector:@selector(failureMessageForNotTo:)]) {
message = [matcher failureMessageForNotTo:*actual];
}
} else {
if ([matcher respondsToSelector:@selector(failureMessageForTo:)]) {
message = [matcher failureMessageForTo:*actual];
}
}
if (message == nil) {
message = @"Match Failed.";
}
EXPFail(self.testCase, self.lineNumber, self.fileName, message);
}
}
self.negative = NO;
}
#pragma mark - Dynamic predicate dispatch
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
if ([self.actual respondsToSelector:aSelector]) {
return [self.actual methodSignatureForSelector:aSelector];
}
return [super methodSignatureForSelector:aSelector];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
if ([self.actual respondsToSelector:anInvocation.selector]) {
EXPDynamicPredicateMatcher *matcher = [[EXPDynamicPredicateMatcher alloc] initWithExpectation:self selector:anInvocation.selector];
[anInvocation setSelector:@selector(dispatch)];
[anInvocation invokeWithTarget:matcher];
[matcher release];
}
else {
[super forwardInvocation:anInvocation];
}
}
@end
@implementation EXPDynamicPredicateMatcher
- (id)initWithExpectation:(EXPExpect *)expectation selector:(SEL)selector
{
if ((self = [super init])) {
_expectation = expectation;
_selector = selector;
}
return self;
}
- (BOOL)matches:(id)actual
{
return (BOOL)[actual performSelector:_selector];
}
- (NSString *)failureMessageForTo:(id)actual
{
return [NSString stringWithFormat:@"expected %@ to be true", NSStringFromSelector(_selector)];
}
- (NSString *)failureMessageForNotTo:(id)actual
{
return [NSString stringWithFormat:@"expected %@ to be false", NSStringFromSelector(_selector)];
}
- (void (^)(void))dispatch
{
__block id blockExpectation = _expectation;
return [[^{
[blockExpectation applyMatcher:self];
} copy] autorelease];
}
@end
-13
View File
@@ -1,13 +0,0 @@
#import <Foundation/Foundation.h>
@interface EXPFloatTuple : NSObject {
float *_values;
size_t _size;
}
@property (nonatomic, assign) float *values;
@property (nonatomic, assign) size_t size;
- (id)initWithFloatValues:(float *)values size:(size_t)size;
@end
-42
View File
@@ -1,42 +0,0 @@
#import "EXPFloatTuple.h"
@implementation EXPFloatTuple
@synthesize values = _values, size = _size;
- (id)initWithFloatValues:(float *)values size:(size_t)size {
if ((self = [super init])) {
self.values = malloc(sizeof(float) * size);
memcpy(self.values, values, sizeof(float) * size);
self.size = size;
}
return self;
}
- (void)dealloc {
free(self.values);
[super dealloc];
}
- (BOOL)isEqual:(id)object {
if (![object isKindOfClass:[EXPFloatTuple class]]) return NO;
EXPFloatTuple *other = (EXPFloatTuple *)object;
if (self.size == other.size) {
for (int i = 0; i < self.size; ++i) {
if (self.values[i] != other.values[i]) return NO;
}
return YES;
}
return NO;
}
- (NSString *)description {
if (self.size == 2) {
return [NSString stringWithFormat:@"Float tuple: {%f, %f}", self.values[0], self.values[1]];
} else if (self.size == 4) {
return [NSString stringWithFormat:@"Float tuple: {%f, %f, %f, %f}", self.values[0], self.values[1], self.values[2], self.values[3]];
}
return [NSString stringWithFormat:@"Float tuple of unexpected size %zd, sadly", self.size];
}
@end
-20
View File
@@ -1,20 +0,0 @@
//
// EXPMatcher.h
// Expecta
//
// Created by Luke Redpath on 26/03/2012.
// Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol EXPMatcher <NSObject>
- (BOOL)matches:(id)actual;
@optional
- (BOOL)meetsPrerequesiteFor:(id)actual;
- (NSString *)failureMessageForTo:(id)actual;
- (NSString *)failureMessageForNotTo:(id)actual;
@end
-11
View File
@@ -1,11 +0,0 @@
#import <Foundation/Foundation.h>
@interface EXPUnsupportedObject : NSObject {
NSString *_type;
}
@property (nonatomic, retain) NSString *type;
- (id)initWithType:(NSString *)type;
@end
-20
View File
@@ -1,20 +0,0 @@
#import "EXPUnsupportedObject.h"
@implementation EXPUnsupportedObject
@synthesize type=_type;
- (id)initWithType:(NSString *)type {
self = [super init];
if(self) {
self.type = type;
}
return self;
}
- (void)dealloc {
self.type = nil;
[super dealloc];
}
@end
-27
View File
@@ -1,27 +0,0 @@
#import <Foundation/Foundation.h>
#import "ExpectaSupport.h"
#define EXPObjectify(value) _EXPObjectify(@encode(__typeof__((value))), (value))
#define EXP_expect(actual) _EXP_expect(self, __LINE__, __FILE__, ^id{ return EXPObjectify((actual)); })
#define EXPMatcherInterface(matcherName, matcherArguments) _EXPMatcherInterface(matcherName, matcherArguments)
#define EXPMatcherImplementationBegin(matcherName, matcherArguments) _EXPMatcherImplementationBegin(matcherName, matcherArguments)
#define EXPMatcherImplementationEnd _EXPMatcherImplementationEnd
#import "EXPMatchers.h"
#ifdef EXP_SHORTHAND
# define expect(...) EXP_expect((__VA_ARGS__))
#endif
#ifdef EXP_OLD_SYNTAX
# import "EXPBackwardCompatibility.h"
#endif
@interface Expecta : NSObject
+ (NSTimeInterval)asynchronousTestTimeout;
+ (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout;
@end
-15
View File
@@ -1,15 +0,0 @@
#import "Expecta.h"
@implementation Expecta
static NSTimeInterval _asynchronousTestTimeout = 1.0;
+ (NSTimeInterval)asynchronousTestTimeout {
return _asynchronousTestTimeout;
}
+ (void)setAsynchronousTestTimeout:(NSTimeInterval)timeout {
_asynchronousTestTimeout = timeout;
}
@end
-64
View File
@@ -1,64 +0,0 @@
#import "EXPExpect.h"
#import "EXPBlockDefinedMatcher.h"
#ifdef __cplusplus
extern "C" {
#endif
id _EXPObjectify(const char *type, ...);
EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock);
void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message);
NSString *EXPDescribeObject(id obj);
void EXP_prerequisite(EXPBoolBlock block);
void EXP_match(EXPBoolBlock block);
void EXP_failureMessageForTo(EXPStringBlock block);
void EXP_failureMessageForNotTo(EXPStringBlock block);
#if __has_feature(objc_arc)
#define _EXP_release(x)
#define _EXP_autorelease(x) (x)
#else
#define _EXP_release(x) [x release]
#define _EXP_autorelease(x) [x autorelease]
#endif
// workaround for the categories bug: http://developer.apple.com/library/mac/#qa/qa1490/_index.html
#define EXPFixCategoriesBug(name) \
__attribute__((constructor)) static void EXPFixCategoriesBug##name() {}
#define _EXPMatcherInterface(matcherName, matcherArguments) \
@interface EXPExpect (matcherName##Matcher) \
@property (nonatomic, readonly) void(^ matcherName) matcherArguments; \
@end
#define _EXPMatcherImplementationBegin(matcherName, matcherArguments) \
EXPFixCategoriesBug(EXPMatcher##matcherName##Matcher); \
@implementation EXPExpect (matcherName##Matcher) \
@dynamic matcherName;\
- (void(^) matcherArguments) matcherName { \
EXPBlockDefinedMatcher *matcher = [[EXPBlockDefinedMatcher alloc] init]; \
[[[NSThread currentThread] threadDictionary] setObject:matcher forKey:@"EXP_currentMatcher"]; \
__block id actual = self.actual; \
__block void (^prerequisite)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_prerequisite(block); }; \
__block void (^match)(EXPBoolBlock block) = ^(EXPBoolBlock block) { EXP_match(block); }; \
__block void (^failureMessageForTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForTo(block); }; \
__block void (^failureMessageForNotTo)(EXPStringBlock block) = ^(EXPStringBlock block) { EXP_failureMessageForNotTo(block); }; \
prerequisite(nil); match(nil); failureMessageForTo(nil); failureMessageForNotTo(nil); \
void (^matcherBlock) matcherArguments = [^ matcherArguments { \
{
#define _EXPMatcherImplementationEnd \
} \
[self applyMatcher:matcher to:&actual]; \
} copy]; \
_EXP_release(matcher); \
return _EXP_autorelease(matcherBlock); \
} \
@end
#ifdef __cplusplus
}
#endif
-187
View File
@@ -1,187 +0,0 @@
#import "ExpectaSupport.h"
#import "NSValue+Expecta.h"
#import "NSObject+Expecta.h"
#import "EXPUnsupportedObject.h"
#import "EXPFloatTuple.h"
#import "EXPDoubleTuple.h"
#import "EXPDefines.h"
#import <objc/runtime.h>
@interface NSException (ExpectaSenTestFailure)
+ (NSException *)failureInFile:(NSString *)filename atLine:(int)lineNumber withDescription:(NSString *)formatString, ...;
@end
@interface NSObject (ExpectaXCTestRecordFailure)
// suppress warning
- (void)recordFailureWithDescription:(NSString *)description inFile:(NSString *)filename atLine:(NSUInteger)lineNumber expected:(BOOL)expected;
@end
id _EXPObjectify(const char *type, ...) {
va_list v;
va_start(v, type);
id obj = nil;
if(strcmp(type, @encode(char)) == 0) {
char actual = (char)va_arg(v, int);
obj = [NSNumber numberWithChar:actual];
} else if(strcmp(type, @encode(_Bool)) == 0) {
_Static_assert(sizeof(_Bool) <= sizeof(int), "Expected _Bool to be subject to vararg type promotion");
_Bool actual = (_Bool)va_arg(v, int);
obj = [NSNumber numberWithBool:actual];
} else if(strcmp(type, @encode(double)) == 0) {
double actual = (double)va_arg(v, double);
obj = [NSNumber numberWithDouble:actual];
} else if(strcmp(type, @encode(float)) == 0) {
float actual = (float)va_arg(v, double);
obj = [NSNumber numberWithFloat:actual];
} else if(strcmp(type, @encode(int)) == 0) {
int actual = (int)va_arg(v, int);
obj = [NSNumber numberWithInt:actual];
} else if(strcmp(type, @encode(long)) == 0) {
long actual = (long)va_arg(v, long);
obj = [NSNumber numberWithLong:actual];
} else if(strcmp(type, @encode(long long)) == 0) {
long long actual = (long long)va_arg(v, long long);
obj = [NSNumber numberWithLongLong:actual];
} else if(strcmp(type, @encode(short)) == 0) {
short actual = (short)va_arg(v, int);
obj = [NSNumber numberWithShort:actual];
} else if(strcmp(type, @encode(unsigned char)) == 0) {
unsigned char actual = (unsigned char)va_arg(v, unsigned int);
obj = [NSNumber numberWithUnsignedChar:actual];
} else if(strcmp(type, @encode(unsigned int)) == 0) {
unsigned int actual = (int)va_arg(v, unsigned int);
obj = [NSNumber numberWithUnsignedInt:actual];
} else if(strcmp(type, @encode(unsigned long)) == 0) {
unsigned long actual = (unsigned long)va_arg(v, unsigned long);
obj = [NSNumber numberWithUnsignedLong:actual];
} else if(strcmp(type, @encode(unsigned long long)) == 0) {
unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long);
obj = [NSNumber numberWithUnsignedLongLong:actual];
} else if(strcmp(type, @encode(unsigned short)) == 0) {
unsigned short actual = (unsigned short)va_arg(v, unsigned int);
obj = [NSNumber numberWithUnsignedShort:actual];
} else if(strstr(type, @encode(EXPBasicBlock)) != NULL) {
// @encode(EXPBasicBlock) returns @? as of clang 4.1.
// This condition must occur before the test for id/class type,
// otherwise blocks will be treated as vanilla objects.
id actual = va_arg(v, EXPBasicBlock);
obj = [[actual copy] autorelease];
} else if((strstr(type, @encode(id)) != NULL) || (strstr(type, @encode(Class)) != 0)) {
id actual = va_arg(v, id);
obj = actual;
} else if(strcmp(type, @encode(__typeof__(nil))) == 0) {
obj = nil;
} else if(strstr(type, "ff}{") != NULL) { //TODO: of course this only works for a 2x2 e.g. CGRect
obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[4]) size:4] autorelease];
} else if(strstr(type, "=ff}") != NULL) {
obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[2]) size:2] autorelease];
} else if(strstr(type, "=ffff}") != NULL) {
obj = [[[EXPFloatTuple alloc] initWithFloatValues:(float *)va_arg(v, float[4]) size:4] autorelease];
} else if(strstr(type, "dd}{") != NULL) { //TODO: same here
obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[4]) size:4] autorelease];
} else if(strstr(type, "=dd}") != NULL) {
obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[2]) size:2] autorelease];
} else if(strstr(type, "=dddd}") != NULL) {
obj = [[[EXPDoubleTuple alloc] initWithDoubleValues:(double *)va_arg(v, double[4]) size:4] autorelease];
} else if(type[0] == '{') {
EXPUnsupportedObject *actual = [[[EXPUnsupportedObject alloc] initWithType:@"struct"] autorelease];
obj = actual;
} else if(type[0] == '(') {
EXPUnsupportedObject *actual = [[[EXPUnsupportedObject alloc] initWithType:@"union"] autorelease];
obj = actual;
} else {
void *actual = va_arg(v, void *);
obj = (actual == NULL ? nil :[NSValue valueWithPointer:actual]);
}
if([obj isKindOfClass:[NSValue class]] && ![obj isKindOfClass:[NSNumber class]]) {
[(NSValue *)obj set_EXP_objCType:type];
}
va_end(v);
return obj;
}
EXPExpect *_EXP_expect(id testCase, int lineNumber, const char *fileName, EXPIdBlock actualBlock) {
return [EXPExpect expectWithActualBlock:actualBlock testCase:testCase lineNumber:lineNumber fileName:fileName];
}
void EXPFail(id testCase, int lineNumber, const char *fileName, NSString *message) {
NSLog(@"%s:%d %@", fileName, lineNumber, message);
NSString *reason = [NSString stringWithFormat:@"%s:%d %@", fileName, lineNumber, message];
NSException *exception = [NSException exceptionWithName:@"Expecta Error" reason:reason userInfo:nil];
if(testCase && [testCase respondsToSelector:@selector(failWithException:)]) {
if([[(Class)objc_getMetaClass("NSException") class] instancesRespondToSelector:@selector(failureInFile:atLine:withDescription:)]) {
exception = [NSException failureInFile:[NSString stringWithUTF8String:fileName] atLine:lineNumber withDescription:message];
}
[testCase failWithException:exception];
} else if(testCase && [testCase respondsToSelector:@selector(recordFailureWithDescription:inFile:atLine:expected:)]){
[testCase recordFailureWithDescription:message
inFile:[NSString stringWithUTF8String:fileName]
atLine:lineNumber
expected:NO];
} else {
[exception raise];
}
}
NSString *EXPDescribeObject(id obj) {
if(obj == nil) {
return @"nil/null";
} else if([obj isKindOfClass:[NSValue class]] && ![obj isKindOfClass:[NSNumber class]]) {
const char *type = [(NSValue *)obj _EXP_objCType];
if(type) {
if(strcmp(type, @encode(SEL)) == 0) {
return [NSString stringWithFormat:@"@selector(%@)", NSStringFromSelector([obj pointerValue])];
} else if(strcmp(type, @encode(Class)) == 0) {
return NSStringFromClass([obj pointerValue]);
}
}
}
NSString *description = [obj description];
if([obj isKindOfClass:[NSArray class]]) {
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]];
for(id o in obj) {
[arr addObject:EXPDescribeObject(o)];
}
description = [NSString stringWithFormat:@"(%@)", [arr componentsJoinedByString:@", "]];
} else if([obj isKindOfClass:[NSSet class]] || [obj isKindOfClass:[NSOrderedSet class]]) {
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]];
for(id o in obj) {
[arr addObject:EXPDescribeObject(o)];
}
description = [NSString stringWithFormat:@"{(%@)}", [arr componentsJoinedByString:@", "]];
} else if([obj isKindOfClass:[NSDictionary class]]) {
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:[obj count]];
for(id k in obj) {
id v = [obj objectForKey:k];
[arr addObject:[NSString stringWithFormat:@"%@ = %@;",EXPDescribeObject(k), EXPDescribeObject(v)]];
}
description = [NSString stringWithFormat:@"{%@}", [arr componentsJoinedByString:@" "]];
} else if([obj isKindOfClass:[NSAttributedString class]]) {
description = [obj string];
} else {
description = [description stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
}
return description;
}
void EXP_prerequisite(EXPBoolBlock block) {
[[[[NSThread currentThread] threadDictionary] objectForKey:@"EXP_currentMatcher"] setPrerequisiteBlock:block];
}
void EXP_match(EXPBoolBlock block) {
[[[[NSThread currentThread] threadDictionary] objectForKey:@"EXP_currentMatcher"] setMatchBlock:block];
}
void EXP_failureMessageForTo(EXPStringBlock block) {
[[[[NSThread currentThread] threadDictionary] objectForKey:@"EXP_currentMatcher"] setFailureMessageForToBlock:block];
}
void EXP_failureMessageForNotTo(EXPStringBlock block) {
[[[[NSThread currentThread] threadDictionary] objectForKey:@"EXP_currentMatcher"] setFailureMessageForNotToBlock:block];
}
-14
View File
@@ -1,14 +0,0 @@
#import <Foundation/Foundation.h>
@interface NSObject (Expecta)
#ifdef USE_XCTEST
- (void)recordFailureWithDescription:(NSString *)description
inFile:(NSString *)filename
atLine:(NSUInteger)lineNumber
expected:(BOOL)expected;
#else
- (void)failWithException:(NSException *)exception;
#endif
@end
-8
View File
@@ -1,8 +0,0 @@
#import <Foundation/Foundation.h>
@interface NSValue (Expecta)
- (const char *)_EXP_objCType;
- (void)set_EXP_objCType:(const char *)_EXP_objCType;
@end
-21
View File
@@ -1,21 +0,0 @@
#import "NSValue+Expecta.h"
#import <objc/runtime.h>
#import "Expecta.h"
EXPFixCategoriesBug(NSValue_Expecta);
@implementation NSValue (Expecta)
static char _EXP_typeKey;
- (const char *)_EXP_objCType {
return [(NSString *)objc_getAssociatedObject(self, &_EXP_typeKey) cStringUsingEncoding:NSASCIIStringEncoding];
}
- (void)set_EXP_objCType:(const char *)_EXP_objCType {
objc_setAssociatedObject(self, &_EXP_typeKey,
[NSString stringWithCString:_EXP_objCType encoding:NSASCIIStringEncoding],
OBJC_ASSOCIATION_COPY_NONATOMIC);
}
@end
-4
View File
@@ -1,4 +0,0 @@
#import <Foundation/Foundation.h>
BOOL EXPIsValuePointer(NSValue *value);
BOOL EXPIsNumberFloat(NSNumber *number);
-9
View File
@@ -1,9 +0,0 @@
#import "EXPMatcherHelpers.h"
BOOL EXPIsValuePointer(NSValue *value) {
return [value objCType][0] == @encode(void *)[0];
}
BOOL EXPIsNumberFloat(NSNumber *number) {
return strcmp([number objCType], @encode(float)) == 0;
}
@@ -1,7 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beCloseToWithin, (id expected, id within));
EXPMatcherInterface(beCloseToWithin, (id expected, id within));
#define beCloseTo(expected) _beCloseToWithin(EXPObjectify((expected)), nil)
#define beCloseToWithin(expected, range) _beCloseToWithin(EXPObjectify((expected)), EXPObjectify((range)))
@@ -1,49 +0,0 @@
#import "EXPMatchers+beCloseTo.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beCloseToWithin, (id expected, id within)) {
prerequisite(^BOOL{
return [actual isKindOfClass:[NSNumber class]] &&
[expected isKindOfClass:[NSNumber class]] &&
([within isKindOfClass:[NSNumber class]] || (within == nil));
});
match(^BOOL{
double actualValue = [actual doubleValue];
double expectedValue = [expected doubleValue];
if (within != nil) {
double withinValue = [within doubleValue];
double lowerBound = expectedValue - withinValue;
double upperBound = expectedValue + withinValue;
return (actualValue >= lowerBound) && (actualValue <= upperBound);
} else {
double diff = fabs(actualValue - expectedValue);
actualValue = fabs(actualValue);
expectedValue = fabs(expectedValue);
double largest = (expectedValue > actualValue) ? expectedValue : actualValue;
return (diff <= largest * FLT_EPSILON);
}
});
failureMessageForTo(^NSString *{
if (within) {
return [NSString stringWithFormat:@"expected %@ to be close to %@ within %@",
EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)];
} else {
return [NSString stringWithFormat:@"expected %@ to be close to %@",
EXPDescribeObject(actual), EXPDescribeObject(expected)];
}
});
failureMessageForNotTo(^NSString *{
if (within) {
return [NSString stringWithFormat:@"expected %@ not to be close to %@ within %@",
EXPDescribeObject(actual), EXPDescribeObject(expected), EXPDescribeObject(within)];
} else {
return [NSString stringWithFormat:@"expected %@ not to be close to %@",
EXPDescribeObject(actual), EXPDescribeObject(expected)];
}
});
}
EXPMatcherImplementationEnd
-3
View File
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beFalsy, (void));
-24
View File
@@ -1,24 +0,0 @@
#import "EXPMatchers+beFalsy.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(beFalsy, (void)) {
match(^BOOL{
if([actual isKindOfClass:[NSNumber class]]) {
return ![(NSNumber *)actual boolValue];
} else if([actual isKindOfClass:[NSValue class]]) {
if(EXPIsValuePointer((NSValue *)actual)) {
return ![(NSValue *)actual pointerValue];
}
}
return !actual;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: a falsy value, got: %@, which is truthy", EXPDescribeObject(actual)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: a non-falsy value, got: %@, which is falsy", EXPDescribeObject(actual)];
});
}
EXPMatcherImplementationEnd
@@ -1,6 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beGreaterThan, (id expected));
EXPMatcherInterface(beGreaterThan, (id expected));
#define beGreaterThan(expected) _beGreaterThan(EXPObjectify((expected)))
@@ -1,20 +0,0 @@
#import "EXPMatchers+beGreaterThan.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beGreaterThan, (id expected)) {
match(^BOOL{
if ([actual respondsToSelector:@selector(compare:)]) {
return [actual compare:expected] == NSOrderedDescending;
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ not to be greater than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
@@ -1,6 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beGreaterThanOrEqualTo, (id expected));
EXPMatcherInterface(beGreaterThanOrEqualTo, (id expected));
#define beGreaterThanOrEqualTo(expected) _beGreaterThanOrEqualTo(EXPObjectify((expected)))
@@ -1,20 +0,0 @@
#import "EXPMatchers+beGreaterThanOrEqualTo.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beGreaterThanOrEqualTo, (id expected)) {
match(^BOOL{
if ([actual respondsToSelector:@selector(compare:)]) {
return [actual compare:expected] != NSOrderedAscending;
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ not to be greater than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
@@ -1,10 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beIdenticalTo, (void *expected));
EXPMatcherInterface(beIdenticalTo, (void *expected)); // to aid code completion
#if __has_feature(objc_arc)
#define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected)
#else
#define beIdenticalTo _beIdenticalTo
#endif
@@ -1,24 +0,0 @@
#import "EXPMatchers+equal.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(beIdenticalTo, (void *expected)) {
match(^BOOL{
if(actual == expected) {
return YES;
} else if([actual isKindOfClass:[NSValue class]] && EXPIsValuePointer((NSValue *)actual)) {
if([(NSValue *)actual pointerValue] == expected) {
return YES;
}
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: <%p>, got: <%p>", expected, actual];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: not <%p>, got: <%p>", expected, actual];
});
}
EXPMatcherImplementationEnd
@@ -1,6 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound));
EXPMatcherInterface(beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound));
#define beInTheRangeOf(expectedLowerBound, expectedUpperBound) _beInTheRangeOf(EXPObjectify((expectedLowerBound)), EXPObjectify((expectedUpperBound)))
@@ -1,30 +0,0 @@
#import "EXPMatchers+beInTheRangeOf.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beInTheRangeOf, (id expectedLowerBound, id expectedUpperBound)) {
match(^BOOL{
if ([actual respondsToSelector:@selector(compare:)]) {
NSComparisonResult compareLowerBound = [expectedLowerBound compare: actual];
NSComparisonResult compareUpperBound = [expectedUpperBound compare: actual];
if (compareLowerBound == NSOrderedSame) {
return YES;
}
if (compareUpperBound == NSOrderedSame) {
return YES;
}
if ((compareLowerBound == NSOrderedAscending) && (compareUpperBound == NSOrderedDescending)) {
return YES;
}
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ not to be in the range [%@, %@] (inclusive)", EXPDescribeObject(actual), EXPDescribeObject(expectedLowerBound), EXPDescribeObject(expectedUpperBound)];
});
}
EXPMatcherImplementationEnd
@@ -1,7 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beInstanceOf, (Class expected));
#define beAnInstanceOf beInstanceOf
#define beMemberOf beInstanceOf
#define beAMemberOf beInstanceOf
@@ -1,27 +0,0 @@
#import "EXPMatchers+beInstanceOf.h"
EXPMatcherImplementationBegin(beInstanceOf, (Class expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
prerequisite(^BOOL{
return !(actualIsNil || expectedIsNil);
});
match(^BOOL{
return [actual isMemberOfClass:expected];
});
failureMessageForTo(^NSString *{
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected: an instance of %@, got: an instance of %@", [expected class], [actual class]];
});
failureMessageForNotTo(^NSString *{
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected: not an instance of %@, got: an instance of %@", [expected class], [actual class]];
});
}
EXPMatcherImplementationEnd
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beKindOf, (Class expected));
#define beAKindOf beKindOf
-27
View File
@@ -1,27 +0,0 @@
#import "EXPMatchers+beKindOf.h"
EXPMatcherImplementationBegin(beKindOf, (Class expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
prerequisite(^BOOL{
return !(actualIsNil || expectedIsNil);
});
match(^BOOL{
return [actual isKindOfClass:expected];
});
failureMessageForTo(^NSString *{
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected: a kind of %@, got: an instance of %@, which is not a kind of %@", [expected class], [actual class], [expected class]];
});
failureMessageForNotTo(^NSString *{
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected: not a kind of %@, got: an instance of %@, which is a kind of %@", [expected class], [actual class], [expected class]];
});
}
EXPMatcherImplementationEnd
@@ -1,6 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beLessThan, (id expected));
EXPMatcherInterface(beLessThan, (id expected));
#define beLessThan(expected) _beLessThan(EXPObjectify((expected)))
@@ -1,20 +0,0 @@
#import "EXPMatchers+beLessThan.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beLessThan, (id expected)) {
match(^BOOL{
if ([actual respondsToSelector:@selector(compare:)]) {
return [actual compare:expected] == NSOrderedAscending;
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ not to be less than %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
@@ -1,6 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_beLessThanOrEqualTo, (id expected));
EXPMatcherInterface(beLessThanOrEqualTo, (id expected));
#define beLessThanOrEqualTo(expected) _beLessThanOrEqualTo(EXPObjectify((expected)))
@@ -1,20 +0,0 @@
#import "EXPMatchers+beLessThanOrEqualTo.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_beLessThanOrEqualTo, (id expected)) {
match(^BOOL{
if ([actual respondsToSelector:@selector(compare:)]) {
return [actual compare:expected] != NSOrderedDescending;
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ not to be less than or equal to %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
-5
View File
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beNil, (void));
#define beNull beNil
-16
View File
@@ -1,16 +0,0 @@
#import "EXPMatchers+beNil.h"
EXPMatcherImplementationBegin(beNil, (void)) {
match(^BOOL{
return actual == nil;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: nil/null, got: %@", EXPDescribeObject(actual)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: not nil/null, got: %@", EXPDescribeObject(actual)];
});
}
EXPMatcherImplementationEnd
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beSubclassOf, (Class expected));
#define beASubclassOf beSubclassOf
@@ -1,27 +0,0 @@
#import "EXPMatchers+beSubclassOf.h"
#import "NSValue+Expecta.h"
#import <objc/runtime.h>
EXPMatcherImplementationBegin(beSubclassOf, (Class expected)) {
__block BOOL actualIsClass = YES;
prerequisite(^BOOL {
actualIsClass = class_isMetaClass(object_getClass(actual));
return actualIsClass;
});
match(^BOOL{
return [actual isSubclassOfClass:expected];
});
failureMessageForTo(^NSString *{
if(!actualIsClass) return @"the actual value is not a Class";
return [NSString stringWithFormat:@"expected: a subclass of %@, got: a class %@, which is not a subclass of %@", [expected class], actual, [expected class]];
});
failureMessageForNotTo(^NSString *{
if(!actualIsClass) return @"the actual value is not a Class";
return [NSString stringWithFormat:@"expected: not a subclass of %@, got: a class %@, which is a subclass of %@", [expected class], actual, [expected class]];
});
}
EXPMatcherImplementationEnd
@@ -1,4 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beSupersetOf, (id subset));
@@ -1,57 +0,0 @@
#import "EXPMatchers+contain.h"
EXPMatcherImplementationBegin(beSupersetOf, (id subset)) {
BOOL actualIsCompatible = [actual isKindOfClass:[NSDictionary class]] || [actual respondsToSelector:@selector(containsObject:)];
BOOL subsetIsNil = (subset == nil);
// For some instances the isKindOfClass: method returns false, even though
// they are both actually dictionaries. e.g. Comparing a NSCFDictionary and a
// NSDictionary.
BOOL bothAreDictionaries = [actual isKindOfClass:[NSDictionary class]] && [subset isKindOfClass:[NSDictionary class]];
BOOL classMatches = bothAreDictionaries || [subset isKindOfClass:[actual class]];
prerequisite(^BOOL{
return actualIsCompatible && !subsetIsNil && classMatches;
});
match(^BOOL{
if(!actualIsCompatible) return NO;
if([actual isKindOfClass:[NSDictionary class]]) {
for (id key in subset) {
id actualValue = [actual valueForKey:key];
id subsetValue = [subset valueForKey:key];
if (![subsetValue isEqual:actualValue]) return NO;
}
} else {
for (id object in subset) {
if (![actual containsObject:object]) return NO;
}
}
return YES;
});
failureMessageForTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)];
if(subsetIsNil) return @"the expected value is nil/null";
if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)];
return [NSString stringWithFormat:@"expected %@ to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)];
});
failureMessageForNotTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSDictionary and does not implement -containsObject:", EXPDescribeObject(actual)];
if(subsetIsNil) return @"the expected value is nil/null";
if(!classMatches) return [NSString stringWithFormat:@"%@ does not match the class of %@", EXPDescribeObject(subset), EXPDescribeObject(actual)];
return [NSString stringWithFormat:@"expected %@ not to be a superset of %@", EXPDescribeObject(actual), EXPDescribeObject(subset)];
});
}
EXPMatcherImplementationEnd
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beTruthy, (void));
-24
View File
@@ -1,24 +0,0 @@
#import "EXPMatchers+beTruthy.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(beTruthy, (void)) {
match(^BOOL{
if([actual isKindOfClass:[NSNumber class]]) {
return !![(NSNumber *)actual boolValue];
} else if([actual isKindOfClass:[NSValue class]]) {
if(EXPIsValuePointer((NSValue *)actual)) {
return !![(NSValue *)actual pointerValue];
}
}
return !!actual;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: a truthy value, got: %@, which is falsy", EXPDescribeObject(actual)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: a non-truthy value, got: %@, which is truthy", EXPDescribeObject(actual)];
});
}
EXPMatcherImplementationEnd
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(beginWith, (id expected));
#define startWith beginWith
@@ -1,49 +0,0 @@
#import "EXPMatchers+beginWith.h"
EXPMatcherImplementationBegin(beginWith, (id expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
//This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same
BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]])
|| ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]])
|| ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]]));
prerequisite(^BOOL {
return actualAndExpectedAreCompatible;
});
match(^BOOL {
if ([actual isKindOfClass:[NSString class]]) {
return [actual hasPrefix:expected];
} else if ([actual isKindOfClass:[NSArray class]]) {
if ([expected count] > [actual count] || [expected count] == 0) {
return NO;
}
NSArray *subArray = [actual subarrayWithRange:NSMakeRange(0, [expected count])];
return [subArray isEqualToArray:expected];
} else {
if ([expected count] > [actual count] || [expected count] == 0) {
return NO;
}
NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange(0, [expected count]) copyItems:NO];
return [subset isEqualToOrderedSet:expected];
}
});
failureMessageForTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNil) return @"the expected value is nil/null";
if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]];
return [NSString stringWithFormat:@"expected: %@ to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNil) return @"the expected value is nil/null";
if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]];
return [NSString stringWithFormat:@"expected: %@ not to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(conformTo, (Protocol *expected));
@@ -1,33 +0,0 @@
#import "EXPMatchers+conformTo.h"
#import "NSValue+Expecta.h"
#import <objc/runtime.h>
EXPMatcherImplementationBegin(conformTo, (Protocol *expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
prerequisite(^BOOL{
return !(actualIsNil || expectedIsNil);
});
match(^BOOL{
return [actual conformsToProtocol:expected];
});
failureMessageForTo(^NSString *{
if(actualIsNil) return @"the object is nil/null";
if(expectedIsNil) return @"the protocol is nil/null";
NSString *name = NSStringFromProtocol(expected);
return [NSString stringWithFormat:@"expected: %@ to conform to %@", actual, name];
});
failureMessageForNotTo(^NSString *{
if(actualIsNil) return @"the object is nil/null";
if(expectedIsNil) return @"the protocol is nil/null";
NSString *name = NSStringFromProtocol(expected);
return [NSString stringWithFormat:@"expected: %@ not to conform to %@", actual, name];
});
}
EXPMatcherImplementationEnd
-5
View File
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_contain, (id expected));
EXPMatcherInterface(contain, (id expected)); // to aid code completion
#define contain(expected) _contain(EXPObjectify((expected)))
-38
View File
@@ -1,38 +0,0 @@
#import "EXPMatchers+contain.h"
EXPMatcherImplementationBegin(_contain, (id expected)) {
BOOL actualIsCompatible = [actual isKindOfClass:[NSString class]] || [actual conformsToProtocol:@protocol(NSFastEnumeration)];
BOOL expectedIsNil = (expected == nil);
prerequisite(^BOOL{
return actualIsCompatible && !expectedIsNil;
});
match(^BOOL{
if(actualIsCompatible) {
if([actual isKindOfClass:[NSString class]]) {
return [(NSString *)actual rangeOfString:[expected description]].location != NSNotFound;
} else {
for (id object in actual) {
if ([object isEqual:expected]) {
return YES;
}
}
}
}
return NO;
});
failureMessageForTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)];
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected %@ to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString or NSFastEnumeration", EXPDescribeObject(actual)];
if(expectedIsNil) return @"the expected value is nil/null";
return [NSString stringWithFormat:@"expected %@ not to contain %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
-3
View File
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(endWith, (id expected));
-49
View File
@@ -1,49 +0,0 @@
#import "EXPMatchers+endWith.h"
EXPMatcherImplementationBegin(endWith, (id expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
//This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same
BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]])
|| ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]])
|| ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]]));
prerequisite(^BOOL {
return actualAndExpectedAreCompatible;
});
match(^BOOL {
if ([actual isKindOfClass:[NSString class]]) {
return [actual hasSuffix:expected];
} else if ([actual isKindOfClass:[NSArray class]]) {
if ([expected count] > [actual count] || [expected count] == 0) {
return NO;
}
NSArray *subArray = [actual subarrayWithRange:NSMakeRange([actual count] - [expected count], [expected count])];
return [subArray isEqualToArray:expected];
} else {
if ([expected count] > [actual count] || [expected count] == 0) {
return NO;
}
NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange([actual count] - [expected count], [expected count]) copyItems:NO];
return [subset isEqualToOrderedSet:expected];
}
});
failureMessageForTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNil) return @"the expected value is nil/null";
if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]];
return [NSString stringWithFormat:@"expected: %@ to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
failureMessageForNotTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNil) return @"the expected value is nil/null";
if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]];
return [NSString stringWithFormat:@"expected: %@ not to end with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)];
});
}
EXPMatcherImplementationEnd
-5
View File
@@ -1,5 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(_equal, (id expected));
EXPMatcherInterface(equal, (id expected)); // to aid code completion
#define equal(...) _equal(EXPObjectify((__VA_ARGS__)))
-24
View File
@@ -1,24 +0,0 @@
#import "EXPMatchers+equal.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(_equal, (id expected)) {
match(^BOOL{
if((actual == expected) || [actual isEqual:expected]) {
return YES;
} else if([actual isKindOfClass:[NSNumber class]] && [expected isKindOfClass:[NSNumber class]]) {
if(EXPIsNumberFloat((NSNumber *)actual) || EXPIsNumberFloat((NSNumber *)expected)) {
return [(NSNumber *)actual floatValue] == [(NSNumber *)expected floatValue];
}
}
return NO;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: not %@, got: %@", EXPDescribeObject(expected), EXPDescribeObject(actual)];
});
}
EXPMatcherImplementationEnd
@@ -1,10 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(haveCountOf, (NSUInteger expected));
#define haveCount haveCountOf
#define haveACountOf haveCountOf
#define haveLength haveCountOf
#define haveLengthOf haveCountOf
#define haveALengthOf haveCountOf
#define beEmpty() haveCountOf(0)
@@ -1,36 +0,0 @@
#import "EXPMatchers+haveCountOf.h"
EXPMatcherImplementationBegin(haveCountOf, (NSUInteger expected)) {
BOOL actualIsStringy = [actual isKindOfClass:[NSString class]] || [actual isKindOfClass:[NSAttributedString class]];
BOOL actualIsCompatible = actualIsStringy || [actual respondsToSelector:@selector(count)];
prerequisite(^BOOL{
return actualIsCompatible;
});
NSUInteger (^count)(id) = ^(id actual) {
if(actualIsStringy) {
return [actual length];
} else {
return [actual count];
}
};
match(^BOOL{
if(actualIsCompatible) {
return count(actual) == expected;
}
return NO;
});
failureMessageForTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)];
return [NSString stringWithFormat:@"expected %@ to have a count of %zi but got %zi", EXPDescribeObject(actual), expected, count(actual)];
});
failureMessageForNotTo(^NSString *{
if(!actualIsCompatible) return [NSString stringWithFormat:@"%@ is not an instance of NSString, NSAttributedString, NSArray, NSSet, NSOrderedSet, or NSDictionary", EXPDescribeObject(actual)];
return [NSString stringWithFormat:@"expected %@ not to have a count of %zi", EXPDescribeObject(actual), expected];
});
}
EXPMatcherImplementationEnd
-4
View File
@@ -1,4 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(notify, (id expectedNotification));
-63
View File
@@ -1,63 +0,0 @@
#import "EXPMatchers+notify.h"
EXPMatcherImplementationBegin(notify, (id expected)){
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNil = (expected == nil);
BOOL isNotification = [expected isKindOfClass:[NSNotification class]];
BOOL isName = [expected isKindOfClass:[NSString class]];
__block NSString *expectedName;
__block BOOL expectedNotificationOccurred = NO;
__block id observer;
prerequisite(^BOOL{
expectedNotificationOccurred = NO;
if (actualIsNil || expectedIsNil) return NO;
if (isNotification) {
expectedName = [expected name];
}else if(isName) {
expectedName = expected;
}else{
return NO;
}
observer = [[NSNotificationCenter defaultCenter] addObserverForName:expectedName object:nil queue:nil usingBlock:^(NSNotification *note){
if (isNotification) {
expectedNotificationOccurred |= [expected isEqual:note];
}else{
expectedNotificationOccurred = YES;
}
}];
((EXPBasicBlock)actual)();
return YES;
});
match(^BOOL{
if(expectedNotificationOccurred) {
[[NSNotificationCenter defaultCenter] removeObserver:observer];
}
return expectedNotificationOccurred;
});
failureMessageForTo(^NSString *{
if (observer) {
[[NSNotificationCenter defaultCenter] removeObserver:observer];
}
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
if(!(isNotification || isName)) return @"the actual value is not a notification or string";
return [NSString stringWithFormat:@"expected: %@, got: none",expectedName];
});
failureMessageForNotTo(^NSString *{
if (observer) {
[[NSNotificationCenter defaultCenter] removeObserver:observer];
}
if(actualIsNil) return @"the actual value is nil/null";
if(expectedIsNil) return @"the expected value is nil/null";
if(!(isNotification || isName)) return @"the actual value is not a notification or string";
return [NSString stringWithFormat:@"expected: none, got: %@", expectedName];
});
}
EXPMatcherImplementationEnd
-4
View File
@@ -1,4 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(raise, (NSString *expectedExceptionName));
#define raiseAny() raise(nil)
-30
View File
@@ -1,30 +0,0 @@
#import "EXPMatchers+raise.h"
#import "EXPDefines.h"
EXPMatcherImplementationBegin(raise, (NSString *expectedExceptionName)) {
__block NSException *exceptionCaught = nil;
match(^BOOL{
BOOL expectedExceptionCaught = NO;
@try {
((EXPBasicBlock)actual)();
} @catch(NSException *e) {
exceptionCaught = e;
expectedExceptionCaught = (expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName];
}
return expectedExceptionCaught;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@, got: %@",
expectedExceptionName ? expectedExceptionName : @"any exception",
exceptionCaught ? [exceptionCaught name] : @"no exception"];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@, got: %@",
expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception",
exceptionCaught ? [exceptionCaught name] : @"no exception"];
});
}
EXPMatcherImplementationEnd
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason));
@@ -1,35 +0,0 @@
#import "EXPMatchers+raiseWithReason.h"
#import "EXPDefines.h"
EXPMatcherImplementationBegin(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)) {
__block NSException *exceptionCaught = nil;
match(^BOOL{
BOOL expectedExceptionCaught = NO;
@try {
((EXPBasicBlock)actual)();
} @catch(NSException *e) {
exceptionCaught = e;
expectedExceptionCaught = (((expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]) &&
((expectedReason == nil) || ([[exceptionCaught reason] isEqualToString:expectedReason])));
}
return expectedExceptionCaught;
});
failureMessageForTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)",
expectedExceptionName ?: @"any exception",
expectedReason ?: @"any reason",
exceptionCaught ? [exceptionCaught name] : @"no exception",
exceptionCaught ? [exceptionCaught reason] : @""];
});
failureMessageForNotTo(^NSString *{
return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)",
expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception",
expectedReason ? [NSString stringWithFormat:@"not '%@'", expectedReason] : @"no reason",
exceptionCaught ? [exceptionCaught name] : @"no exception",
exceptionCaught ? [exceptionCaught reason] : @"no reason"];
});
}
EXPMatcherImplementationEnd
@@ -1,3 +0,0 @@
#import "Expecta.h"
EXPMatcherInterface(respondTo, (SEL expected));
@@ -1,28 +0,0 @@
#import "EXPMatchers+respondTo.h"
#import "EXPMatcherHelpers.h"
EXPMatcherImplementationBegin(respondTo, (SEL expected)) {
BOOL actualIsNil = (actual == nil);
BOOL expectedIsNull = (expected == NULL);
prerequisite (^BOOL {
return !(actualIsNil || expectedIsNull);
});
match(^BOOL {
return [actual respondsToSelector:expected];
});
failureMessageForTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNull) return @"the selector is null";
return [NSString stringWithFormat:@"expected: %@ to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)];
});
failureMessageForNotTo(^NSString *{
if (actualIsNil) return @"the object is nil/null";
if (expectedIsNull) return @"the selector is null";
return [NSString stringWithFormat:@"expected: %@ not to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)];
});
}
EXPMatcherImplementationEnd
-24
View File
@@ -1,24 +0,0 @@
#import "EXPMatchers+beNil.h"
#import "EXPMatchers+equal.h"
#import "EXPMatchers+beInstanceOf.h"
#import "EXPMatchers+beKindOf.h"
#import "EXPMatchers+beSubclassOf.h"
#import "EXPMatchers+conformTo.h"
#import "EXPMatchers+beTruthy.h"
#import "EXPMatchers+beFalsy.h"
#import "EXPMatchers+contain.h"
#import "EXPMatchers+beSupersetOf.h"
#import "EXPMatchers+haveCountOf.h"
#import "EXPMatchers+beIdenticalTo.h"
#import "EXPMatchers+beGreaterThan.h"
#import "EXPMatchers+beGreaterThanOrEqualTo.h"
#import "EXPMatchers+beLessThan.h"
#import "EXPMatchers+beLessThanOrEqualTo.h"
#import "EXPMatchers+beInTheRangeOf.h"
#import "EXPMatchers+beCloseTo.h"
#import "EXPMatchers+raise.h"
#import "EXPMatchers+raiseWithReason.h"
#import "EXPMatchers+respondTo.h"
#import "EXPMatchers+notify.h"
#import "EXPMatchers+beginWith.h"
#import "EXPMatchers+endWith.h"
@@ -1 +0,0 @@
../../../Expecta/src/EXPBackwardCompatibility.h
@@ -1 +0,0 @@
../../../Expecta/src/EXPBlockDefinedMatcher.h
-1
View File
@@ -1 +0,0 @@
../../../Expecta/src/EXPDefines.h
-1
View File
@@ -1 +0,0 @@
../../../Expecta/src/EXPDoubleTuple.h
-1
View File
@@ -1 +0,0 @@
../../../Expecta/src/EXPExpect.h
-1
View File
@@ -1 +0,0 @@
../../../Expecta/src/EXPFloatTuple.h
-1
View File
@@ -1 +0,0 @@
../../../Expecta/src/EXPMatcher.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatcherHelpers.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beCloseTo.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beFalsy.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beGreaterThan.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beGreaterThanOrEqualTo.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beIdenticalTo.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beInTheRangeOf.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beInstanceOf.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beKindOf.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beLessThan.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beLessThanOrEqualTo.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beNil.h
@@ -1 +0,0 @@
../../../Expecta/src/matchers/EXPMatchers+beSubclassOf.h

Some files were not shown because too many files have changed in this diff Show More