I'm developing a command line application for macOS and I have the following issue: I have the following test case in Xcode
import XCTest
@testable import Assembler
class ParserTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func test_commandType_returnRightTypeForAcommands() {
let parser = Parser()
// Invocation
let commandType = "A_COMMAND"
// Assertion
XCTAssertEqual(commandType, "A_COMMAND")
}
}
And this is the Parser
class:
import Foundation
class Parser {
func commandType(for command: String) -> String {
return "A_COMMAND"
}
}
When I run the tests, the following compilation error appears:
Undefined symbols for architecture x86_64:
"Assembler.Parser.__allocating_init() -> Assembler.Parser", referenced from:
AssemblerTests.ParserTests.test_commandType_returnRightTypeForAcommands() -> () in AssemblerTests.o
"type metadata accessor for Assembler.Parser", referenced from:
AssemblerTests.ParserTests.test_commandType_returnRightTypeForAcommands() -> () in AssemblerTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's happening?