0
나는 다음과 같은 기능 (지금 예를 들면
fixture1
등 그들이 맨 아래에있는 일부 종속 무시)를 사용하여 내 테스트를 정의하고 싶습니다
을 :
multiTest("my test name", fixture1) { case (x: Double, y: Int, z: String) =>
// test body
}
및 multiTest
는 다음과 같이 정의 FunSpecLike
서브 클래스 내 기지에 정의를
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?
}
}
}
어떻게 튜플을 함수에 푸시 할 수 있습니까?
누락 된 조각 중 일부는
은 다음과 같습니다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")))
이 질문에 대한 답변이 있습니까? http://stackoverflow.com/questions/1987820/how-to-apply-a-function-to-a-tuple –
확실하지 않은 답변을 제공 할 수 있습니까? –