From 08f9cae13d0dce99d40a6d93432a84cb075bebfc Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Thu, 12 Dec 2024 21:02:58 -0700 Subject: Unit 3 Signed-off-by: Jack Sangdahl --- .../test/scala/jsy/tester/JavascriptyTester.scala | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lab3/src/test/scala/jsy/tester/JavascriptyTester.scala (limited to 'lab3/src/test/scala/jsy/tester/JavascriptyTester.scala') diff --git a/lab3/src/test/scala/jsy/tester/JavascriptyTester.scala b/lab3/src/test/scala/jsy/tester/JavascriptyTester.scala new file mode 100644 index 0000000..48e789c --- /dev/null +++ b/lab3/src/test/scala/jsy/tester/JavascriptyTester.scala @@ -0,0 +1,23 @@ +package jsy.tester +import java.io.File +import jsy.util.JsyApplication +import org.scalatest._ +import flatspec._ + +/* + * A ScalaTest interface for running system tests. + */ +class JavascriptyTester(rootPrefix: Option[String], testDirectory: String, jsy: JsyApplication) extends AnyFlatSpec { + val testResources = s"src${File.separator}test${File.separator}resources" + val testPrefix = rootPrefix match { + case None => testResources + case Some(p) => s"${p}${File.separator}${testResources}" + } + val testPath = s"${testPrefix}${File.separator}${testDirectory}" + jsy.test(new File(testPath)) { case (in,ans,assertion) => + s"eval on ${in}" should s"match ${ans}" in { + val (b: Boolean, msg: String) = assertion + assert(b, msg) + } + } +} -- cgit v1.2.3