This release includes one small breaking change and new features in its Matchers. Happy testing 🎉!
Breaking Changes:
- Renamed framework target from
Nimble-OSX
toNimble-macOS
- Thanks Zigii Wong (@wongzigii)!
New Features:
- Add
containObjectSatisfying
matcher to perform order-indifferent check on collections - Thanks Jared Friese (@jwfriese)! beKindOf
matcher now supports Swift-only types - Thanks Jared Friese (@jwfriese)!
Fixes:
- Stylististic changes for SwiftLint (still on-going) - Thanks Yurii Samsoniuk (@sigito)!
- Also don't print warning about SwiftLint not being installed
- Fix Nimble not running in Swift-only environments - Thanks Syo Ikeda (@ikesyo)!
New Features
containElementSatisfying matcher
Add containElementSatisfying
matcher to perform order-indifferent check on
collections. This is convenient if you require at least one element in a
collection to pass a predicate.
// swift
expect([1, 2, 3]).to(containElementSatisfying { n in
return n == 2
})
// objc
expect(@[@1, @2, @3]).to(containElementSatisfying(^BOOL(id n) {
return [n isEqualToNumber:@2];
}));
beAKindOf and beAnInstanceOf now operates on Swift-only types
The beAKindOf
and beAnInstanceOf
matchers has been updated to support
Swift-only types. That means this is now possible:
// swift
expect("hello world").to(beAKindOf(String.self))
expect("hello world").to(beAnInstanceOf(String.self))
In older versions of Swift, casting was always self-evident and the compiler would
disallow potentially invalid coercions (eg - Any to String). But this is no
longer the case and these matchers have been updated.
Also, beAKindOf
is now available in Swift-only environments (aka - Linux).