aboutsummaryrefslogtreecommitdiff
path: root/lab2/src/test/scala/jsy/tester/JavascriptyTester.scala
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-12-12 21:02:45 -0700
committerJack Sangdahl <[email protected]>2024-12-12 21:02:45 -0700
commit0d13c649bdabafde59233609be7bd88e273c7ae6 (patch)
tree69e3a615f5c3e6a95a752161136acf00c973184d /lab2/src/test/scala/jsy/tester/JavascriptyTester.scala
parent532be33588fd033fc7f814e725372923cf79a6c4 (diff)
downloadcsci3155-0d13c649bdabafde59233609be7bd88e273c7ae6.tar.gz
csci3155-0d13c649bdabafde59233609be7bd88e273c7ae6.zip
Unit 2
Signed-off-by: Jack Sangdahl <[email protected]>
Diffstat (limited to 'lab2/src/test/scala/jsy/tester/JavascriptyTester.scala')
-rw-r--r--lab2/src/test/scala/jsy/tester/JavascriptyTester.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/lab2/src/test/scala/jsy/tester/JavascriptyTester.scala b/lab2/src/test/scala/jsy/tester/JavascriptyTester.scala
new file mode 100644
index 0000000..ab611b9
--- /dev/null
+++ b/lab2/src/test/scala/jsy/tester/JavascriptyTester.scala
@@ -0,0 +1,27 @@
+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)
+ }
+ }
+
+}