07 Oct 2022
Project changes:
- Increased deployment targets to macOS 11.0, watchOS 4.0.
01 Oct 2022
Fixes:
- Fixes Carthage build to work with OCMockito.
Other:
- Restores "year of first publication" in copyright notices
13 Mar 2022
Fixes:
- Fix M1-only crash for SenTestingKit failures.
09 Oct 2021
Features:
- Add support for Swift Package Manager. Thanks to: nrudnyk
- Add Mac Catalyst to XCFramework-supported architectures in build script
makeXCFramework.sh
Fixes:
- Fix HCArgumentCaptor issue capturing objects that don't implement -copy. Thanks to: kmcbride
19 Feb 2021
-
Packaged pre-built binary as single XCFramework containing 7 architectures:
- macOS
- iOS device
- iOS simulator
- tvOS device
- tvOS simulator
- watchOS device
- watchOS simulator
Note:
- iOS projects that use the pre-built binary should now import OCHamcrest instead of OCHamcrestIOS.
- macOS projects should remove OCHamcrest from the Copy Files build phase.
- For Carthage builds, specify --use-xcframeworks
Thanks to: Mateusz Szklarek
-
Simplified project settings. In particular:
- Removed iOS Static Library target.
- Removed iOS-specific test target.
- Simplified Product Bundle Identifiers.
31 Jan 2021
Features:
- Mac binary now supports Apple Silicon.
- Report mismatches using XCTIssue if using Xcode 12 or higher.
- Added Cartfile.project for Carthage caching. Thanks to: René Pirringer
23 Sep 2019
Fixes:
- Fix warning about double-quoted includes in public headers.
15 Jun 2018
Fixes:
- Fixed crash with HCArgumentCaptor capturing objects that don't conform to NSCopyable.
21 Mar 2018
Features:
- Made OCHamcrest/OCHamcrestIOS into modules, so you can
@import
them. CocoaPods users should specifyuse_frameworks!
Fixes:
- Fixed crash with HCArgumentCaptor capturing blocks.
19 Sep 2017
Fixes:
- Fixed new warnings from Xcode 9.
12 Aug 2017
Fixes:
- Remove exposed instance variables that triggered warnings for
-Wobjc-interface-ivars
.
I doubt that it affects anyone, but converting public ivars to private properties does have the potential to break backwards compatibility. Please notify me if you have any code that complains.
Project changes:
- Increase macOS deployment target to 10.10. (iOS was already at 8.0.)
(Version 7.0.0 mistakenly required projects to Enable Modules and had out-of-date documentation.)
06 Mar 2017
Fixes:
- Fixed nullability mistake: HCWrapInMatcher(nil) should return nil.
17 Feb 2017
Features:
- Adopt latest Objective-C annotations for designated initializers, unavailable initializers, typed arrays, nullability.
04 Aug 2016
Features:
- Improved mismatch descriptions for
contains
,containsIn
when actual collection exceeds expected size.
Deleted:
equalToIgnoringWhiteSpace
matcher (deprecated in v5.4.0)- HCCollectMatchers (deprecated in v5.3.0)
Project changes:
- Increased deployment targets to OS X 10.9, iOS 7.0.
03 Jun 2016
Features:
- Added
captureEnabled
property to HCArgumentCaptor to control whether subsequent matched values are captured.
Improvements:
- Updated CocoaPods instructions and examples to CocoaPods 1.0.
Deprecated:
equalToIgnoringWhiteSpace
has been renamed toequalToCompressingWhiteSpace
.- Known issue: warning on this deprecation
22 May 2016
Fixes:
- Removed semicolons that triggered warnings for
-Wsemicolon-before-method-body
. Thanks to: Sylvain Defresne - Describe
isIn
matcher in README.
Features:
- Rewrote
assertThatAfter
to use runloop observer instead of while loop comparing dates. The condition is now tested on every pump of the runloop instead of polling after a predefined delay. Thanks to: Dan Fleming
Deprecated:
- Deprecated HCCollectMatchers. Instead, follow the example of HCAllOf.m and break it into two steps: HCCollectItems, then HCWrapIntoMatchers. This will let you expose a new interface to your matcher that takes an NSArray.
16 Jan 2016
Fixes:
- Fixed umbrella header for Carthage. Thanks to: Sylvain Rebaud, Engin Kurutepe
Features:
- Improved mismatch descriptions for
allOf
,allOfIn
.
14 Dec 2015
Features:
- Added HCDescribeMismatch, a helper function to describe mismatches the way
assertThat
does. - Added Carthage support for Mac, iOS, watchOS and tvOS. Thanks to: Nikolaj Schumacher
02 Nov 2015
For detailed discussion on v5.0.0, see https://qualitycoding.org/ochamcrest-v5-0-0/
Features:
- Instead of enabling short syntax by defining HC_SHORTHAND, short syntax is now enabled by default. To disable it, #define HC_DISABLE_SHORT_SYNTAX.
- Matchers which take nil-terminated lists have "In" variants which take a single NSArray, like
allOfIn
. The matcherhasEntriesIn
is an exception and takes an NSDictionary. - Improved documentation on all matchers. Documentation is now shown for matchers with fixed numbers of arguments. All matchers provide argument hinting.
Renamed:
- Renamed long syntax for
containsInRelativeOrder
from prefix hc_ to HC_ to conform to other matchers.
Deleted:
equalToBool
matcher (deprecated in v4.1.0)containsString
matcher (deprecated in v4.2.0)assertThatAfter
/futureValueOf
(deprecated in v4.2.0)HC_testFailureHandlerChain()
(deprecated in v4.2.0)
31 Oct 2015
Project changes:
- Enabling "Symbols hidden by default" in 4.3.1 was overkill, preventing people from using the prebuilt Mac framework.
24 Oct 2015
Project changes:
- Remove debug symbols from Release configuration, which bloated the libraries and kept folks from using the prebuilt iOS framework.
11 Oct 2015
Features:
- New matcher
containsInRelativeOrder
matches collections containing items in relative order. - New matcher HCArgumentCaptor matches anything, capturing matched values.
Project changes:
- Updated project settings to Xcode 7, with tests now run by XCTest.
11 Sep 2015
Fixes:
- Fixed "Incompatible pointer types sending 'Class' to parameter of type 'NSString *'" warning on
instanceOf
.
Features:
- Improved readability of asynchronous tests:
assertWithTimeout(1, thatEventually(var), is(@10));
- Added ability to add custom test failure reporter. See HCTestFailureReporterChain.
Deprecated:
- Deprecated
containsString
; usecontainsSubstring
instead.containsString
clashes with an NSString method introduced in iOS 8. - Deprecated
assertThatAfter
/futureValueOf
. UseassertWithTimeout
/thatEventually
instead. - Deprecated
HC_testFailureHandlerChain()
; use[HCTestFailureReporterChain reporterChain]
instead.
31 Dec 2014
- Oops! Add the new features to OCHamcrest.h
30 Dec 2014
Fixes:
- Fixed crash when OCHamcrest tries to describe an OCMockito mock object. Thanks to: Michael Seghers
- Fixed crash when
equalToBool
attempts to match a non-number.
Features:
assertThatAfter
tests asynchronous code, retrying the assertion until a given timeout. Wrap the code you want to evaluate infutureValueOf
. Thanks to: Sergio Padrino- New matcher
everyItem
matches collections if every item satisfies a given matcher. - New matcher
throwsException
matches a block if it throws an exception satisfying a given matcher. - New matchers
isTrue
andisFalse
match non-zero and zero NSNumbers. Intended to replaceequalToBool
.
Improvements:
- Added new base class HCDiagnosingMatcher to simplify complex matchers.
equalToBool
matcher can no longer be created with a value other than YES or NO. This especially avoids the accidental @YES.- Improved ordered comparison matchers (
greaterThan
, etc.) so that when the given object can't be compared, the matchers return NO instead of throwing an exception. - Improved mismatch descriptions for
hasItem
. - Improved mismatch descriptions for
hasProperty
to show actual property value or "no property". - Improved mismatch descriptions for
onlyContains
, especially in reporting all elements that don't match. - Updated project to make it run-path dependent. Thanks to: csano
Deprecated:
equalToBool
deprecated in favor ofisTrue
andisFalse
.equalToBool(YES)
had too much potential for semantic error since any non-zero number evaluates to true.
04 Jun 2014
Project changes:
- Increased deployment targets to OS X 10.8, iOS 6.0.
10 May 2014
This is a refactoring release with potential backwards compatibility issues for writers of custom matchers:
- Almost all ivars have been converted to hidden properties. Let me know if this trips you up.
- If you subclass HCInvocationMatcher for a custom matcher, the ivars have been renamed.
- If you import HCCollectMatchers.h for a custom matcher, change this to import HCCollect.h.
- HCTestFailureHandler has changed from a protocol to a class.
Also, if you're not using CocoaPods, specify -ObjC
in your "Other Linker Flags".
29 Oct 2013
Fixes:
- Fixed problem where isNot did not ask the sub-matcher's mismatch description. Thanks to: James Richard and Jonathan Barnes
- Fixed crash in
describedAs
matcher . Thanks to: Nikolaj Schumacher - Fixed crash in
hasProperty
matcher when the property is a primitive type. Thanks to: Nikolaj Schumacher
Improvements:
- Changed matcher factory methods to return plain
id
so that matchers can be used without casting to(id)
for OCMockito arguments. - Added support for 64-bit iOS devices.
Examples & Documentation:
- Updated examples so they are based on Apple's templates for main target vs. test target. Added CocoaPods examples.
- Eliminated DocSet. Documentation will be in the main README and in the OCHamcrest wiki, https://github.com/hamcrest/OCHamcrest/wiki/_pages
06 Sep 2013
Features:
- Added support for XCTest. Special thanks to Jiajun "gaosboy" for pointing the way, and to Richard Clem for testing.
- Made unit test integration more flexible with HC_testFailureHandlerChain. It can be called from outside OCHamcrest to signal a test failure within the current testing framework. (At present it tries XCTest, then SenTestCase, then falls back on raising a generic exception.)
Deleted:
- HCRequireNonNilString.h (deprecated in v1.2)
empty
matcher (deprecated in v2.1.0)
23 Jun 2013
Fixes:
- Made build script flexible so that doxygen isn't required, or can be in a different location. Thanks to: Bennett Smith
- Fixed problem formatting percent symbols in assertion failures. Thanks to: Nikolaj Schumacher
- Fixed wrong descriptions in the unordered collection matcher. Thanks to: Nikolaj Schumacher
- Fixed underlying cause of crash in Mac version on assertion failure. With this fix, we could switch back to optimized code. Thanks to: Nikolaj Schumacher
- Fixed MacExample so it finds OCHamcrest.
Features:
- Added support for XCTest. (This was undone by subsequent updates to XCTest.)
Deprecated:
empty
clashed with the C++ string method of the same name. It has been renamed toisEmpty
.
Project changes:
- Increased deployment targets to Mac OS X 10.7, iOS 5.0.
12 May 2013
Fixes:
- Fixed crash in Mac version on assertion failure. (Problem with optimized code)
- Fixed crash in
instanceOf
andisA
when argument wasnil
.
Improvements:
- Updated example projects to Xcode 4.6.
13 Apr 2013
This release adopts Semantic Versioning (http://semver.org). Since removal of deprecated items is a backwards incompatible change, the major version number is incremented. Thanks to: Jens Nerup
Fixes:
- Fixed GTM compatibility -- avoid shadowing
conformsToProtocol:
New matchers:
isA
matches objects that are instances of a given class, but not of any subclass.
Improved matchers:
equalToBool
has a better description. Thanks to: Jonathan CrookeinstanceOf
mismatch description now includes actual class.
Deleted following items deprecated in v1.8:
- C++ template function
boxNumber
HC_conformsToProtocol
(which was renamed toHC_conformsTo
)
Project changes:
- Updated project settings to Xcode 4.6. Thanks to: Florian Buerger
- Fixed unit tests so they remain quiet when handling expected test failures.
- Replaced older code coverage scripts with XcodeCoverage submodule.
23 Nov 2012
Improved matchers:
- Changed
hasCount
/hasCountOf
mismatch description so that count comes first (if object has a count).
Project changes:
- Fixed warnings revealed by latest Xcode. Thanks to: David Hart
- Changed iOS Architecture support to "Standard" (which includes armv7s)
- Changed Mac Architecture support to 64-bit only
- Converted source, tests, and examples to ARC
09 Jul 2012
The primary purpose of this release is to make it easier to add OCHamcrest to iOS projects. No more need to specify "Other Linker Flags"! Depending on your project, you may be able to eliminate:
-lstdc++
-ObjC
Also, the repository has a new official home: https://github.com/hamcrest/OCHamcrest/
No need to specify "Other Linker Flags" in iOS projects:
- Changed all Objective-C++ to Objective-C
- Eliminated categories
Deprecated:
- C++ template function
boxNumber
. conformsToProtocol
clashed with the method of the same name. It has been renamed toconformsTo
.
Deleted following items deprecated in v1.2:
-[HCDescription appendValue]
+[HCInvocationMatcher createInvocationForSelector:onClass:]
- NSObject+SelfDescribingValue
20 Feb 2012
New matchers:
conformsToProtocol
matches objects that conform to a given protocol. Thanks to: Todd Farrell
Improved matchers:
hasProperty
now works for methods with primitive return types. Thanks to: Christopher Pickslay
Other improvements:
- Rewrote introductory sections of documentation.
27 Sep 2011
Fixes:
stringContainsInOrder
was missing from the master header; now it's there.
New matchers:
hasProperty
matches the return value of a method with a given name. (It could be a property, but really can be any method with no arguments that returns an object.) Thanks to: Justin Shacklette
Improvements:
- Rewrote documentation.
- Matchers that require a nil-terminated list now generate a compiler error if you don't have
nil
at the end.
29 Apr 2011
Fixes:
- Fixed crash when trying to describe an object with
nil
description.
Packaging:
- Updated project to Xcode 4. iOS framework / documentation / distribution scripts are now external, run from command-line instead of Xcode.
- Improved documentation by adding Factory headings pointing from implementing classes back to their factories.
New matcher:
stringContainsInOrder
matches string containing given list of substrings, in order.
Improved matchers:
- Changed
sameInstance
mismatch description to omit address when describingnil
. - For consistency, changed
anyOf
andallOf
to implicitly wrap non-matcher values inequalTo
.
13 Feb 2011
New matchers:
hasEntries
matches dictionary containing key-value pairs satisfying a given list of alternating keys and value matchers.
Improvements:
- Added complete descriptions to macros so they appear in Xcode 4 Quick Help. (Couldn't add arguments to macros without breaking backwards compatibility.)
Improved descriptions:
- Improved description of
hasEntry
, removing colon so it doesn't get truncated in Xcode's error display. is
no longer says "is ..." in its description, but just lets the inner description pass through.- Consistently use articles to begin descriptions, such as "a dictionary containing" instead of "dictionary containing".
05 Jan 2011
Improved descriptions:
- Fixed
contains
andcontainsInAnyOrder
to describe mismatch if item is not a collection. - Fixed
describedAs
andis
to use their nested matchers to generate mismatch descriptions. sameInstance
is more readable, and includes object memory addresses.- If object has a count,
hasCount
mismatch describes actual count. - Don't wrap angle brackets around a description that already has them.
- Improved readability of several matchers.
Other improvements:
instanceOf
now guards againstnil
being passed as the expected type.
03 Jan 2011
Fixes:
- Fixed assertThat to describe the diagnosis of the mismatch, not just the mismatched value.
New matchers:
hasCount
matches collections for which-count
satisfies a given matcher.hasCountOf
matches collections for which-count
equals a given count.empty
matches empty collection.
Improvements:
- Expanded helper class HCInvocationMatcher:
- New property
shortMismatchDescription
determines whether mismatch description is short or long. Default is long description. - New method
-invokeOn:
invokes stored invocation on given item.
- New property
- Since
nil
cannot be directly stored in collections, collection matchers now guard againstnil
. - Expanded BaseDescription's
-appendDescriptionOf:
to handle all types of values, not just self-describing values.
Deprecated:
- Description's
-appendValue:
no longer needed; call-appendDescriptionOf:
instead. This also means NSObject+SelfDescribingValue is no longer needed. - Renamed HCInvocation's helper class method
+createInvocationForSelector:onClass:
to+invocationForSelector:onClass:
- New helper function
HCRequireNonNilObject
should be used in place ofHCRequireNonNilString
.
28 Dec 2010
Fixes:
- Fixed crash that occurred when trying to describe the matchers
allOf
,anyOf
andisIn
on iOS. Related to-ObjC
linker flag. - Fix problems introduced in broken release v1.1:
- Added the new matchers to the master header and to the iOS target.
- Fixed distribution zip file to preserve symlinks in frameworks.
New matchers:
contains
matches collections with matching items in order.containsInAnyOrder
matches collections with matching items in any order.
Improvements:
- Changed documentation from HTML to Xcode documentation set. Run
make install
from the Documentation folder to install. - Rearranged documentation modules to make things easier to find.
- Changed convenience methods to invoke superclass and return
id
, to support possibility of subclassing matchers.
26 Oct 2010
First official release, including:
- Documentation
- Examples for
- Cocoa
- iOS
- Creating a custom matcher
07 Oct 2010
- For iOS: Added OCHamcrestIOS.framework target which provides release builds for both simulator and
device into a single framework. Yes, a framework that can be used for iOS development without
requiring users to mess with header search paths and link settings. Simply drop the framework into
your project and
#import <OCHamcrestIOS/OCHamcrestIOS.h>
Thanks to: Aaron Jacobs
06 Oct 2010
- Work around bug in iPhone simulator that causes a test failure to terminate the app. Thanks to: Aaron Jacobs
06 Sep 2010
- Added static library target and changes for iOS.
01 Dec 2009
- Added
assertThat___
andequalTo___
for all types understood by NSNumber. For example:
assertThatInt(42, equalToInt(42))
24 Nov 2009
- Changed
assertThat
behavior to work more seamlessly with OCUnit: Instead of throwing an exception, it calls the same method as OCUnit's assertion macros to fail the test. As a result, a failingassertThat
will not terminate the test, so that the test can record other failures. (Following normal OCUnit behavior, you can instruct the test case to terminate at the first failure by invokingraiseAfterFailure
.)
This change requires thatassertThat
be called only within subclasses of SenTestCase, which wasn't the case before. You will need to recompile your tests.
If you need an original-style assertion that can be called outside of a SenTestCase, email your request to [email protected]
24 Nov 2009
- Support Xcode 3.2's redesigned Build Results window by removing colons from
assertThat
description.
17 Oct 2009
- Added helper class HCInvocationMatcher for building other matchers from NSInvocations. See HCHasDescription for an example.
11 Aug 2009
- Renamed framework to OCHamcrest.
07 Jul 2009
- Added support for Mac OS X 10.4 projects.
28 Jan 2009
- Fixed compiler errors when used with Objective-C++ (.mm files).
24 Jan 2009
- Added means for matchers to describe mismatches. You can use either
matches:describingMismatchTo:
to do it one shot, or calldescribeMismatchOf:To:
once you know a particular item does not match.
18 Jul 2008
- Changed matchers whose description looks similar to a function call so that the description matches the name of the factory function.
13 Apr 2008
- Initial release