aboutsummaryrefslogtreecommitdiff
path: root/lab4/src/test/scala/jsy/tester
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-12-12 21:03:17 -0700
committerJack Sangdahl <[email protected]>2024-12-12 21:03:17 -0700
commitae554ab7d4d425fa821c1167e734db3425a881f6 (patch)
tree0962144c05070d5cf4303133c8e5ccd756d4cee9 /lab4/src/test/scala/jsy/tester
parent08f9cae13d0dce99d40a6d93432a84cb075bebfc (diff)
downloadcsci3155-ae554ab7d4d425fa821c1167e734db3425a881f6.tar.gz
csci3155-ae554ab7d4d425fa821c1167e734db3425a881f6.zip
Unit 4
Signed-off-by: Jack Sangdahl <[email protected]>
Diffstat (limited to 'lab4/src/test/scala/jsy/tester')
-rw-r--r--lab4/src/test/scala/jsy/tester/JavascriptyTester.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/lab4/src/test/scala/jsy/tester/JavascriptyTester.scala b/lab4/src/test/scala/jsy/tester/JavascriptyTester.scala
new file mode 100644
index 0000000..48e789c
--- /dev/null
+++ b/lab4/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)
+ }
+ }
+}