Danil
Danil

Reputation: 2537

Swift Mocking Classes in XCTest

I'm trying to mock a class in my test suite and getting segmentation fault 11 error.

  1. While silgen emitConstructor SIL function @_TFVSC20NSJSONReadingOptionsCfMS_FT_S_ for 'init' at

Here is a piece of code which makes Xcode crush my test suite:

func testSetup() {
    class MockEngine: Engine {
        var setupCoreDataCalled = false
        override func setupCoreData(){
            setupCoreDataCalled = true
        }
    }
    let me = MockEngine()
    me.setup()
    XCTAssertTrue(me.setupCoreDataCalled, "setupCoreData must be called at setup")
}

What Am I doing wrong?

Upvotes: 1

Views: 613

Answers (1)

Danil
Danil

Reputation: 2537

Ok I think I got it. It's related to SwiftyJSON library.

here is more info: https://github.com/SwiftyJSON/SwiftyJSON/issues/67

Upvotes: 1

Related Questions