scalatest - How do I unit test closures with deeply nested anonymous functions in Scala? -
i'm trying unit test method looks this:
def foo() = { val = listener.registercallback( (bar: bar, baz: baz) => { val x = bar.declare().get bar.bind(x) }) return }
i can test result of method. problem when run coverage report (with sbt-coverage plugin , scalatest) i'm bit short of meeting coverage threshold due methods holding unreachable anonymous functions local values such.
is there way can test nested anonymous function improve coverage score?
perhaps pull out out method test, let eta expansion turn method function? like:
def bippy(bar: bar, baz: baz) = { val x = bar.declare().get bar.bind(x) } def foo() = { val = listener.registercallback(bippy) return }
i.e., write unit test against bippy , score points sbt-coverage.
Comments
Post a Comment