我正在使用XCTest并在TestMethod中声明类作为模拟类的一种方法。但是,似乎该类无法在其声明之外调用方法。我该如何解决这个问题?
class MyTestCase : XCTestCase {
func testExample() {
class Bar { // <-- the class declared inside a function
func Barkly() {
foo(); // <-- apparently this produces a compile error.
}
}
}
func foo() { //<-- this is the method I am trying to call
println("hello world")
}
}