Closed briancroom closed 8 years ago
There may be some dependency here on sorting out our Travis situation (#345), as Swift 2 is a requirement for some of this stuff to work properly.
Here's a full example of using this in a test target mixing Objective-C and Swift specs with Nimble matchers: https://github.com/briancroom/TastesOfCocoa/tree/master/CedarWithNimble
This is truly awesome! I had wondered if it would be possible to conditionally compile in the C++ features of Cedar, but couldn't find a way to make it work because of the strict rule of the umbrella header importing each public header.
Conditionally bringing in the contents of the header though is quite clever. :trophy:
To make progress on getting CI fixed up for this I'm intending to introduce an opt-out compile-time flag that can be included in rake's xcodebuild invocation to exclude the swift spec for older Xcode versions.
If there's anything we can do to help out, please let us know. There's a bit of a beach in SF and NY right now, and I'm really eager to help out myself as well.
Travis is now passing and I have resolved the shared examples context issue as well. I'm looking forward to more feedback on this, but I believe it's about ready to merge!
I have updated this to include Xcode snippets for the standard Cedar BDD constructs in Swift, as well as added the option to the file template to generate a Swift spec. Thanks to @modocache for the Quick spec template which I used as a reference for how to add a language picker!
With this, I feel that this is ready to be merged into master to receive broader feedback. /cc @tjarratt
(I'll defer to someone else for adding Swift snippets for AppCode when the need is felt for them!)
I don't have nearly enough emoji to express my excitement right now.
This will have to suffice. :evergreen_tree: + :bird: = :balloon: :balloon: :balloon:
As more and more projects are expressing interest in using Cedar in pure-Swift and (especially) mixed Objective-C and Swift contexts, I've taken some steps towards a maintainable approach to making the Cedar test runner, including the
describe
,it
, etc. DSL available from Swift. To be clear, Cedar matchers and doubles remain inaccessible from Swift due to their reliance on C++. (See discussion at #259)I consider this to be an evolution of great proof-of-concept work done by @tjarratt and @Jdavid1001 on the
swift-spec-runner
branch a while back. The key difference is that this branch makes the existing Cedar framework targets importable from Swift, instead of introducing additional targets dedicated to the runner.Have a look at the individual commit messages to see the whole story, but the highlights here are:
XCTAssert*
functions from specs defined in Swift, as well as out-of-the-box support for other matcher frameworks (in particular Nimble) that report failures through XCTest.With this PR, it is possible to add a Swift file like the following to an existing Cedar test suite or bundle: