Skip to content

Partial spies

Pre-release
Pre-release

Choose a tag to compare

@seanhenry seanhenry released this 26 Oct 08:19
· 60 commits to master since this release
  • Adds more logging around SourceKit errors
  • Adds a new test double - "partial spy"

What is a partial spy?

Partial spies are spies which can also forward calls to the original implementation.

E.g.

class MyClass {
  func myMethod() {
    print("original implementation")
  }
}

class MyClassPartialSpy: MyClass {
... // generated partial spy
}

let mySpy = MyClassPartialSpy()

mySpy.myMethod() // does not print "original implementation"

mySpy.forwardToOriginalMyMethod = true

mySpy.myMethod() // prints "original implementation"