AliSoftware / AliSoftware/Reusable

Undefined symbols when compiling for unit tests

Đang mở
#86 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
Swift
Star
3k
Fork
231
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've setup unit tests for my project and want to add View/ViewController instantiation to the tests because the project is modular. When compiling this error message appears when for any methods that came from Reusable.

```
Undefined symbols for architecture x86_64:
"static (extension in Reusable):Reusable.StoryboardSceneBased< where A: __C.UIViewController>.instantiate() -> A", referenced from:
implicit closure #1 () throws -> FooProject.HomeViewController? in FooProjectTests.InstantiationTests.testInstantiations() -> () in InstantiationTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

I'm not sure why this is happening because the other frameworks can be accessed easily. This is a sample code that generates the error

```swift
@testable import FooProject
import Nimble
import XCTest

class InstantiationTests: XCTestCase {
func testInstantiations() {
expect(HomeViewController.instantiate()).notTo(raiseException())
}
}
```

## Possible Faqs

**Is the project enabled for testability**
Yes

**Do you have other tests besides this?**
Yes

**What do you mean by the project being modular?**
The project has multiple Targets and Configurations. ex

Configurations
- Release
- Release Debug
- Staging
- Staging Debug

Targets
- FooProject
- FooProjectV2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.