jeffh / Fox

Property Based Testing Library for Objective-C and Swift. QuickCheck for Apple's Platforms.
http://fox-testing.rtfd.org
Other
624 stars 30 forks source link

Show failures inline in the editor #32

Open loufranco opened 9 years ago

loufranco commented 9 years ago

I am using Swift -- not sure what happens in Obj-C.

If you call XCTFail instead of throwing an exception, Xcode will show the error inline in the editor at the appropriate line.

I'm willing to make a PR to implement this, but asking for guidance. It feels like I need to pass a closure to use instead of raising, potentially in FOXOptions.

Any thoughts on whether this is a desired PR and how to go about it?

jeffh commented 9 years ago

I think this is a good change to make. For mostly experimental reasons, I've avoided integrating XCTest since that is the only function required and it's harder to integrate it in other contexts beside XCTestCases in objective-c (since the objc version of XCTFail requires self to be an XCTestCase instance).

That being said, the Fox's Assert function in Swift can be expanded to include the implementation of _FOXAssert that uses XCTest instead of raising an exception.

loufranco commented 9 years ago

Ok, I'll propose something soon. I saw that problem in Obj-C. Perhaps Fox needs a configuration -- that might address #20 and also allow a failWith:(msg:String, file:String, line:Int)->() that you could pass in. In Objective-C, if you are in a XCTestCase, you can capture self.