1

I’m unable to unit my class because Xcode doesn’t see my main class under test target.

My swift module is defined as public

public class Geohash {
    public static func encodeGeoHash(latitude: Double, longitude: Double, precision: Int = 12) -> String {

but under my tests target I can’t see the symbol,

class GeohashTests: XCTestCase {
    func testEncode() {
        Geohash // /Users/maximveksler/Developer/GeohashKit/GeohashKitTests/GeohashTests.swift:13:9: Use of unresolved identifier 'Geohash'
    }
}

My tests target does not include Geohash.swift

enter image description here

The project is at https://github.com/maximveksler/GeohashKit/blob/master/GeohashKitTests/GeohashTests.swift#L13

4

1 回答 1

2

在您的测试文件中添加以下行:

import GeohashKit

项目的测试部分是单独的模块,因此您需要导入您的应用程序模块来测试类文件才能访问其类。

于 2015-05-05T13:20:42.477 回答