Skip to content

Releases: Quick/Nimble

v6.1.0

28 Mar 06:39
v6.1.0
Compare
Choose a tag to compare

This is a relatively small release that addresses issues for Xcode 8.3 / Swift 3.1. Merry Testing! 👾

New:

  • Add float and double overloads to beGreaterThan for ObjC (Thanks @soranoba)

Changes:

  • SwiftLint no longer runs for framework targets. Instead an internal SwiftLint target is used instead. (Thanks @wongzigii)

Bugfixes:

  • Fixes throwError matcher with the latest version of Swift (Thanks @aaroncrespo)
  • Fixes throwError matcher warning for Xcode 8.3

Nimble v6.0.1

28 Jan 05:25
v6.0.1
Compare
Choose a tag to compare

A small bugfix release to fix an installation issue for Carthage users that
have SwiftLint installed.

Nimble v6.0.0

24 Jan 08:33
v6.0.0
Compare
Choose a tag to compare

This release includes one small breaking change and new features in its Matchers. Happy testing 🎉!

Breaking Changes:

  • Renamed framework target from Nimble-OSX to Nimble-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).

Nimble v5.1.1

01 Nov 05:14
v5.1.1
Compare
Choose a tag to compare

This release is only a bugfix release.

  • Fixes umbrella header import for macOS and tvOS

Nimble v5.1.0

21 Oct 03:52
v5.1.0
Compare
Choose a tag to compare

This release includes new features and shouldn't break backwards compatibility
with 5.0.0. Thus, 5.1.0 supports Swift 3 / Xcode 8. The TL;DR list of changes:

New Features:

  • Add throwAssertion matcher to test precondition failures. Thanks @mattgallagher and @abbeycode!
  • Objective-C supports some C literals

Fixes:

  • The regular expression match matcher is available for Linux. Thanks @ikesyo!
  • Document about AsyncDefaults. Thanks @wongzigii!
  • Fix matchError incorrectly succeeding on any Error type given.

New Feature Details

ThrowAssertion Matcher

Nimble now includes a throwAssertion matcher to test if a given piece of code
fails precondition or invokes fatalError.

// swift
expect { precondition(false, "this will fail") }.to(throwAssertion())
// type-hint that this closure does not return anything
expect { () -> Void in fatalError() }.to(throwAssertion())

Due to the inherit implementation of preconditions and fatalErrors, there are
several limitations:

  • This is only available for Swift.
  • There is no validation of the failure message.
  • This only works for x86 architectures. This means Simulators + macOS only.
  • tvOS simulator requires you to disable "Debug executable" in your scheme's test configuration.

Nimble embeds CwlPreconditionTesting to implement throwAssertion. Special
thanks to @mattgallagher for CwlPreconditionTesting and @abbeycode for the bulk
of the adding the matcher for Nimble.

Go test those assertions!

Objective-C: Limited C-Literals Support

Objective-C version of Nimble now can automatically box certain C types for
you. This means you don't need to wrap them yourself:

// objective-c
expect(1).to(equal(2));
expect(98.6).to(beCloseTo(98.6));
expect(YES).to(beTrue());
expect(@[@1, @2]).to(haveCount(2));
expect("hello").toNot(equal("world"));
expect(NSMakeRange(0, 5)).to(equal(NSMakeRange(0, 5)));

Currently, not all matchers support all types. The following matchers support C types:

  • equal
  • beGreaterThan
  • beGreaterThanOrEqual
  • beLessThan
  • beLessThanOrEqual
  • beCloseTo
  • beTrue
  • beFalse
  • beTruthy
  • beFalsy
  • haveCount

The C types each supports is matcher specific. But there's here's the basic heuristics:

  • C numeric types are boxed as NSNumber *. (eg - uint64_t -> NSNumber *)
  • C booleans are boxed as NSNumber *. (eg - BOOL -> NSNumber *)
  • C strings are boxed as NSString * (eg - char * -> NSString *)
  • NSRange are boxed as NSValue * (eg - NSRange -> NSValue *)

While they shouldn't cause too many suprises in practice, note that you still
can have some gotchas with everything boxing as NSNumber * (eg -
expect(1).to(beTrue()) passes).

Please file an issue if you want more matchers.


Happy testing! 😁

Nimble v5.0.0

20 Sep 07:03
v5.0.0
Compare
Choose a tag to compare

Version 5 supports Swift 3. For older versions of swift, please use an older version of Nimble.

Features / Breaking Changes:

  • Convert to Swift 3
  • Change NMBOrderedCollection to use -[objectForIndex:] / object(at index: Int). See bugfix.
  • beCloseTo supports CGFloat

Bugfixes:

  • Fix endsWith matcher not working if the expected value was repeated
    multiple times for strings and NMBOrderedCollection-conforming types.

Special thanks to @NachoSoto, @andersio, @briancroom, @ikesyo, @liscio,
@mokagio, @norio-nomura, @raphaelcruzeiro for all the effort in getting
Nimble to Swift 3!

v4.1.0

18 Jun 22:55
v4.1.0
b4a0f9d
Compare
Choose a tag to compare

v4.1.0

Added:

  • NSDate is now supported when using the beCloseTo & beCloseWithin matchers (#295 - thanks @mishimay!).
  • Expectation's expression property is now public, for use when creating custom matchers (#300 - thanks @akashivskyy!).

Improved:

  • The contain matcher now accepts sequences, in addition to the existing variadic form (#297 - thanks @stigi!).
  • The documentation for beIdenticalTo has been improved (#299 - thanks @lukeredpath!).

Fixed:

  • Bitcode is now disabled for the tvOS platform (#287 - thanks @phatblat!).
  • Nimble can now be compiled under Xcode 8 with Swift 2.3 (#302). Swift 3 support will be part of a future release.

v4.0.1

22 Apr 08:00
v4.0.1
0cf1291
Compare
Choose a tag to compare

Bug Fixes

  • Fixes a race condition in Xcode 7.3 that would prevent Nimble from writing output to the Xcode console during a test run. See #273.
  • Fixes a problem with CocoaPods integration concerning header files that can't be found. See #280.

v4.0.0

05 Apr 19:38
v4.0.0
Compare
Choose a tag to compare

Breaking Changes

  • Remove FullMatcherFunc. Use Matcher or MatcherFunc instead. More
    breaking changes around the protocols will probably occur in the future.

Features

  • beEmpty() supports NSIndexSet
  • Expose stringify() which Nimble matchers use to convert values to string.
    • You can add custom support to stringify by conforming your type to
      TestDebugStringConvertible

Bug Fixes

  • Fix bug where exceptions weren't properly caught for cocoapods users
  • Resolve warnings for Xcode 7.3

Nimble v3.2.0

17 Mar 07:21
Compare
Choose a tag to compare

Nimble v3.2.0

This release includes bug fixes, minor enhancements, and a couple of new matchers. This release targets Xcode 7.2.x and Swift 2.1. It also generally works with Xcode 7.3 betas and Swift 2.2 (thanks @NachoSoto!), although many deprecation warnings are emitted.

Additionally, initial support is available for using Nimble with the Swift Package Manager on both OS X and Linux. This should be considered a technical preview as SwiftPM and the do not yet have any stable releases.

New Matcher: postNotifications

This matcher allows testing that an expression causes one or more NSNotifications to be posted to a notification center. Thanks to @bgerstle for this work! (#228)

expect {
    NSNotificationCenter.defaultCenter().postNotification(myNotification)
}.to(postNotifications(equal([myNotification]))

New Matcher: beVoid

This matcher allows testing whether an optional value of type Void? contains a value, or is nil. Thanks to @inamiy for this! (#250)

expect(() as ()?).to(beVoid())

Asynchronous Expectation Defaults

It is now possible to modify the global default values for the timeout and poll interval used by toEventually. Thanks @mjbeauregard! (#256)

AsyncDefaults.Timeout = 2
AsyncDefaults.PollInterval = 0.05

Swift Package Manager

It is now possible to reference Nimble as a package dependency in a Package.swift file for use with the Swift Package Manager. As SwiftPM is not yet stable, this integration should be considered an early preview and may break.

Linux Support

Complementing SwiftPM support, Nimble can now be used on Linux, with the caveat that not all behaviors and matchers are supported. Features that rely on the Objective-C runtime are disabled in this environment. On Linux, Nimble integrates with the swift-corelibs-xctest library.

Miscellaneous

  • be can now be used as an alias for the beIdenticalTo matcher. Thanks @jwfriese! (#241)
  • The compiler will now produce a warning if expect is used without being followed up by to, toNot, etc. Thanks @pcantrell! (#245)
  • NSData now has a special string representation to prevent failure messages from including excessively long data descriptions. Thanks @inket! (#263)