Sha256: 5c5f04083ae22640f35044ec8fec7e7a04fb3e4c79e768d3fcee13962b95b263

Contents?: true

Size: 1.03 KB

Versions: 92

Compression:

Stored size: 1.03 KB

Contents

import testgen._
import TestSuiteBuilder._
import java.io.File

object FoodChainTestGenerator {
  def main(args: Array[String]): Unit = {
    val file = new File("src/main/resources/food-chain.json")

    val RawQuote = "\"\"\""
    def asRawString(str: String): String = s"$RawQuote$str$RawQuote"

    def fromLabeledTest(argNames: String*)(
      implicit sutFunction: LabeledTest => String = _.property): ToTestCaseData =
      withLabeledTest { sut =>
        labeledTest =>
          val sutFunction = labeledTest.property
          val args = sutArgs(labeledTest.result, argNames: _*)
          val sutCall = s"$sut.$sutFunction(${args})"
          val expectedLines = labeledTest.expected.right.get.asInstanceOf[List[String]]
          val expected = expectedLines mkString ("", "\n", "\n\n")

          TestCaseData(labeledTest.description, sutCall, asRawString(expected))
      }

    val code = TestSuiteBuilder.build(file,
      fromLabeledTest("start verse"))
    println(s"-------------")
    println(code)
    println(s"-------------")
  }
}

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
trackler-2.2.1.10 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.9 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.8 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.7 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.6 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.5 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.4 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.3 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.2 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.1 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.1.0 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.6 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.5 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.4 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.3 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.2 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.1 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.2.0.0 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.55 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.54 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala