Post marked as solved
Post marked as solved with 2 replies, 2,302 views
How do I do unit test with multiplatform app?
I created a new project and add a class with one object.
class MyClass {
static var apples: [Int] = [1,2,3]
}
When I want to do unit test, it fails ...
import XCTest
@testable import MyApp
class Tests_macOS: XCTestCase {
		func testExample() throws {
				XCTAssertEqual(MyClass.apples.count, 3)
		}
}
Errors
Undefined symbols for architecture x86_64:
"MyApp.MyClass.apples.unsafeMutableAddressor : [Swift.String]", referenced from:
implicit closure #1 () throws -> Swift.Int in Tests_macOS.Tests_macOS.testExample() throws -> () in Tests_macOS.o
"type metadata accessor for MyApp.MyClass", referenced from:
implicit closure #1 () throws -> Swift.Int in Tests_macOS.Tests_macOS.testExample() throws -> () in Tests_macOS.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: MyApp.MyClass.apples.unsafeMutableAddressor : [Swift.String]
Undefined symbol: type metadata accessor for MyApp.MyClass