If you import a mock from another library, the function address will be different in the two libraries.
// In MyLibrary
public class MyMock: Mock {
public func doit(thing: String) {
invoke(doit, args: (thing))
}
public func getAddress() -> MemoryAddress {
address(of: doit)
}
}
// In MyLibraryTests
class GenericTests: QuickSpec {
override func spec() {
describe("memory address") {
it("should be equal") {
let obj = MyMock()
obj.doit(thing: "")
let addr1 = obj.getAddress()
let addr2 = obj.address(of: obj.doit) // Should be equal to addr1, will be different
let inv = cl.invokations(of: cl.doit) // Should be 1, will be 0
}
}
}
}
This may seem like a non-problem, but we face problems when using mocks in our monorepo, since we want to provide a set of mocks across multiple test projects.
If you import a mock from another library, the function address will be different in the two libraries.
This may seem like a non-problem, but we face problems when using mocks in our monorepo, since we want to provide a set of mocks across multiple test projects.