dimanche 25 décembre 2016

Swift test give error "Undefined symbols for architecture x86_64"

I'm running swift test from command line to run the test cases. This is the test case:

import XCTest
@testable import vnk_swift

class KeyMappingTests: XCTestCase {
    static var allTests : [(String, (KeyMappingTests) -> () throws -> Void)] {
        return [
            // ("testExample", testExample),
        ]
    }

    func testExample() {
        let keyMapping = KeyMapping()
        XCTAssertNotNil(keyMapping , "PASS")
    }
}

And here is the output message.

image

If I remove the usage of KeyMapping, everything works fine:

    func testExample() {
        // let keyMapping = KeyMapping()
        XCTAssertNotNil(true , "PASS")
    }

image

Looks like there is a problem when I'm trying to use a class. How do I fix this?

(I did not use XCode for this project as I started with swift package init, the source code for this project is here: http://ift.tt/2is4otg)

Aucun commentaire:

Enregistrer un commentaire