Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Added a test for invalid literal breaking the compiler #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.avsystem.scex.compiler

import com.avsystem.scex.compiler.ScexCompiler.CompilationFailedException
import com.avsystem.scex.japi.{DefaultJavaScexCompiler, JavaScexCompiler}
import org.scalatest.funsuite.AnyFunSuite

class InvalidLiteralTest extends AnyFunSuite with CompilationTest {
override protected def createCompiler: JavaScexCompiler = {
val settings = new ScexSettings
settings.classfileDirectory.value = "testClassfileCache"
//evaluating getter adapters fixes the problem (since the invalid expression isn't the first thing compiled)
settings.noGetterAdapters.value = true
new DefaultJavaScexCompiler(settings)
}

test("Invalid literal should not break the scex compiler") {
intercept[CompilationFailedException] {
evaluate[String]("11compilation_fail11")
}
evaluate[Unit]("()")
}
}
Loading