【发布时间】:2019-05-13 13:23:26
【问题描述】:
我刚刚在一个新项目中添加了一些单元测试。通常我使用@testable import来导入生产代码,所以我可以测试非公共方法:
@testable import My-Project
import XCTest
final class MyTests: XCTestCase {
func testOne() {
// ...
}
}
但是我看到了一些我以前从未见过的奇怪的编译错误:
Tests.swift:1:25: Consecutive statements on a line must be separated by ';'
Tests.swift:1:25: Expected expression after unary operator
Tests.swift:1:25: Expressions are not allowed at the top level
Tests.swift:1:18: No such module 'My'
我已经检查并仔细检查了所有内容,但无法弄清楚为什么会产生此编译错误。
我错过了什么?
【问题讨论】: