tests: Add assert tests

This commit is contained in:
Ilya Matveev
2017-07-24 15:41:06 +07:00
committed by ilmat192
parent a2e9fa324b
commit 0e67fbb7ad
4 changed files with 23 additions and 4 deletions
+13 -2
View File
@@ -1516,9 +1516,20 @@ task main_exception(type: RunKonanTest) {
source = "runtime/basic/main_exception.kt"
}
task failed_assert(type: RunKonanTest) {
task runtime_basic_assert_failed(type: RunKonanTest) {
expectedExitStatus = 1
source = "runtime/basic/failed_assert.kt"
source = "runtime/basic/assert_failed.kt"
}
task runtime_basic_assert_passed(type: RunKonanTest) {
expectedExitStatus = 0
source = "runtime/basic/assert_passed.kt"
}
task runtime_basic_assert_disabled(type: RunKonanTest) {
expectedExitStatus = 0
enableKonanAssertions = false
source = "runtime/basic/assert_failed.kt"
}
task initializers0(type: RunKonanTest) {
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
assert(true)
}
@@ -38,6 +38,7 @@ abstract class KonanTest extends JavaExec {
def konanc = new File("${dist.canonicalPath}/bin/$konancDriver").absolutePath
def mainC = 'main.c'
def outputSourceSetName = "testOutputLocal"
def enableKonanAssertions = true
String outputDirectory = null
String goldValue = null
String testData = null
@@ -97,13 +98,15 @@ abstract class KonanTest extends JavaExec {
classpath = project.configurations.cli_bc
enableAssertions = true
args = ["-output", output,
"-ea",
*filesToCompile,
*moreArgs,
*project.globalTestArgs]
if (project.testTarget) {
args "-target", project.testTarget
}
if (enableKonanAssertions) {
args "-ea"
}
standardOutput = log
errorOutput = log
super.exec()
@@ -282,13 +285,15 @@ class RunDriverKonanTest extends KonanTest {
project.exec {
commandLine konanc
args = ["-output", output,
"-ea",
*filesToCompile,
*moreArgs,
*project.globalTestArgs]
if (project.testTarget) {
args "-target", project.testTarget
}
if (enableKonanAssertions) {
args "-ea"
}
standardOutput = log
errorOutput = log
}