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.1.0.53 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.52 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.51 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.50 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.49 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.48 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.47 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.46 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.45 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.44 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.43 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.42 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.41 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.40 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.39 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.38 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.37 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.36 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.34 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala
trackler-2.1.0.33 tracks/scala/testgen/src/main/scala/FoodChainTestGenerator.scala