How do I do unit test with multiplatform app?
I created a new project and add a class with one object.
When I want to do unit test, it fails ...
Errors
I created a new project and add a class with one object.
Code Block swift class MyClass { static var apples: [Int] = [1,2,3] }
When I want to do unit test, it fails ...
Code Block import XCTest @testable import MyApp class Tests_macOS: XCTestCase { func testExample() throws { XCTAssertEqual(MyClass.apples.count, 3) } }
Errors
Code Block python 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