mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Better ProfileTest.
This commit is contained in:
parent
50f8e2fa10
commit
f7dd354b27
1 changed files with 9 additions and 13 deletions
|
@ -8,6 +8,7 @@ import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.app.BuildFileCompiler
|
import com.beust.kobalt.app.BuildFileCompiler
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.testng.annotations.DataProvider
|
||||||
import org.testng.annotations.Guice
|
import org.testng.annotations.Guice
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
|
@ -26,24 +27,19 @@ class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFa
|
||||||
|
|
||||||
val args = Args()
|
val args = Args()
|
||||||
if (enabled) args.profiles = "profile"
|
if (enabled) args.profiles = "profile"
|
||||||
// val jvmCompilerPlugin = Kobalt.findPlugin("JvmCompiler") as JvmCompilerPlugin
|
|
||||||
// val pluginInfo = PluginInfo(KobaltPluginXml(), null, null).apply {
|
|
||||||
// projectContributors.add(jvmCompilerPlugin)
|
|
||||||
// }
|
|
||||||
// val projects = buildScriptUtil.runBuildScriptJarFile()
|
|
||||||
val compileResult = compileBuildFile(buildFileString, args, compilerFactory)
|
val compileResult = compileBuildFile(buildFileString, args, compilerFactory)
|
||||||
return compileResult.projects[0]
|
return compileResult.projects[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@DataProvider
|
||||||
fun profilesShouldWork() {
|
fun dp() = arrayOf(
|
||||||
|
arrayOf(false, "profileOff"),
|
||||||
|
arrayOf(true, "profileOn"))
|
||||||
|
|
||||||
|
@Test(dataProvider = "dp")
|
||||||
|
fun profilesShouldWork(enabled: Boolean, expected: String) {
|
||||||
Kobalt.init(TestModule())
|
Kobalt.init(TestModule())
|
||||||
assertThat(runTestWithProfile(true).name).isEqualTo("profileOn")
|
assertThat(runTestWithProfile(enabled).name).isEqualTo(expected)
|
||||||
// Kobalt.INJECTOR.getInstance(Plugins::class.java).shutdownPlugins()
|
|
||||||
// Kobalt.init(TestModule())
|
|
||||||
// val success = File(KFiles.KOBALT_DOT_DIR).deleteRecursively()
|
|
||||||
// println("DELETING " + File(KFiles.KOBALT_DOT_DIR).absolutePath + ": $success")
|
|
||||||
// assertThat(runTestWithProfile(false).name).isEqualTo("profileOff")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue