Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.8k stars 596 forks source link

Nimble Next #1068

Open younata opened 1 year ago

younata commented 1 year ago

This represents the work for the Nimble 13 Next version.

The idea is to keep this as a draft PR until it's ready. Nimble 13 Next betas will source from this PR.

Work for the next minor version of Nimble will continue to target main, and I'll regularly rebase this PR on top of main to keep it in sync.

Once I feel like we're ready to release this, I'll merge this PR into main.

Contents:

TODO

younata commented 1 year ago

Now that we require Sendable closures when using async toEventually/async expressions, this presents an issue integrating with Quick.

In Quick, the common/promoted styling is to declare variables as vars in an ExampleGroup (i.e. describe, context, or even the root example group in the spec method). In Swift 5.9, when you pass a var to a sendable closure, you have to explicitly declare it. i.e.:

var subject: SomeClass!

// ...

it("does something") {
    expect { [subject] in await subject!.value }.to(...)
    // Note: In the closure, the type of `subject` is changed from a force-unwrap optional to a standard optional.
    // that is, the `!` boilerplate is now required.
}

Which is a terrible experience. It would be awfully nice if Swift would let us implicitly capture that var and pass it along.