1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

fix test assertion, enable kobalt logging for tests

This commit is contained in:
Juan Liska 2018-09-17 05:00:19 -06:00
parent 39801a5a24
commit 7cf19b3f95
4 changed files with 19 additions and 11 deletions

View file

@ -9,6 +9,7 @@ import com.beust.kobalt.internal.KobaltPluginXml
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.build.SingleFileBuildSources
import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.KobaltLogger
import com.beust.kobalt.misc.log
import org.testng.annotations.BeforeClass
import org.testng.annotations.Guice
@ -121,6 +122,9 @@ open class BaseTest(val compilerFactory: BuildFileCompiler.IFactory? = null) {
val main = Kobalt.INJECTOR.getInstance(Main::class.java)
val args = Args()
val jc = JCommander(args).apply { parse(*commandLine) }
KobaltLogger.setLogLevel(args)
args.buildFile = KFiles.fixSlashes(project.file.absolutePath) + "/kobalt/src/Build.kt"
val result = Main.launchMain(main, jc, args, arrayOf("assemble"))
return LaunchProjectResult(project, result)

View file

@ -19,7 +19,6 @@ class KotlinCompilerVersionTest : BaseTest() {
"""
kotlinCompiler {
version = "1.2.60"
args("-jvm-target", "1.8")
}
assemble{ jar{} }
"""
@ -30,7 +29,7 @@ class KotlinCompilerVersionTest : BaseTest() {
)
)
val result = launchProject(projectInfo, arrayOf("assemble"))
val result = launchProject(projectInfo, arrayOf("assemble", "--log", "2"))
val project = result.projectDescription
val jarFile = File(KFiles.joinDir(project.file.absolutePath, "kobaltBuild/libs", project.name + "-"
@ -49,10 +48,11 @@ class KotlinCompilerVersionTest : BaseTest() {
assemble{ jar{} }
"""
),
listOf(ProjectFile("src/main/kotlin/A.kt", "val a = \"foo\"")))
listOf(ProjectFile("src/main/kotlin/A.kt", "val a = \"foo\""))
)
val result = launchProject(projectInfo, arrayOf("assemble"))
val result = launchProject(projectInfo, arrayOf("assemble", "--log", "2"))
assertThat(result).isEqualTo(1)
assertThat(result.result).isEqualTo(1)
}
}