Skip to content

Commit

Permalink
Also allow file
Browse files Browse the repository at this point in the history
  • Loading branch information
marzipankaiser committed Jul 4, 2023
1 parent c418413 commit 8700f5f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions effekt/jvm/src/test/scala/effekt/TyperTests.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package effekt
import effekt.context.Annotations
import effekt.context.Context
import kiama.util.StringSource
import kiama.util.{Source, StringSource, FileSource}
import effekt.typer.{Typer,Wellformedness}
import effekt.namer.Namer
import effekt.lifted.ModuleDecl
Expand All @@ -10,10 +10,10 @@ import effekt.context.IOModuleDB

abstract class AbstractTyperTests extends munit.FunSuite {


/** A test that first runs the frontend on `input` and then `body`, where the [[Context]] is made available */
def testTyper(name: String)(input: String)(body: Context => Unit): Unit = {
def testTyper(name: String)(src: Source)(body: Context => Unit): Unit = {
test(name) {
val src = StringSource(input, name)
val compiler = new effekt.Driver {}
val configs = compiler.createConfig(Seq(
"--server"
Expand All @@ -34,6 +34,10 @@ abstract class AbstractTyperTests extends munit.FunSuite {
}
}
}
def testTyper(name: String)(input: String)(body: Context => Unit): Unit =
testTyper(name)(StringSource(input, name))(body)
def testTyperFile(name: String)(filename: String)(body: Context => Unit): Unit =
testTyper(name)(FileSource(filename))(body)
extension(C: Context) {
/** Assert that the unique symbol named `name` has the expected value type */
def assertValueType(name: String, expected: String, clue: => Any = "value types don't match"): Unit = {
Expand Down

0 comments on commit 8700f5f

Please sign in to comment.