I'd like to define my tests using the following function (ignore some dependencies for now e.g. fixture1
etc they are at the bottom):
multiTest("my test name", fixture1) { case (x: Double, y: Int, z: String) =>
// test body
}
and multiTest
is defined in my base custom FunSpecLike
subclass as:
def multiTest(testName: String, fixture: FixtureTable)(fun: => Unit)(implicit pos: source.Position): Unit = {
val heading = fixture.heading
fixture.values.foreach { tuple =>
it(autoGenerateDesc(heading, tuple)) {
fun tuple // <<<<<< how can I pass the tuple to the definition above?
}
}
}
How can I push the tuple to the function?
Some of the missing pieces are:
case class FixtureTable(heading: Map[String, String], values: Seq[Any])
// tableFor generates the permutations of all paramater values
val fixture1 : FixtureTable = tableFor(
("x", List(1e-1, 1e-2)),
("y", List(1, 2, 3)),
("z", List("a", "b")))