File tree Expand file tree Collapse file tree 4 files changed +17
-24
lines changed
src/functionalTest/kotlin/kotlinx/validation Expand file tree Collapse file tree 4 files changed +17
-24
lines changed File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 55
66package kotlinx.validation.api
77
8- import org.gradle.testkit.runner.GradleRunner
8+ import org.gradle.testkit.runner.*
9+ import java.io.*
910
1011internal fun BaseKotlinGradleTest.test (fn : BaseKotlinScope .() -> Unit ): GradleRunner {
1112 val baseKotlinScope = BaseKotlinScope ()
1213 fn(baseKotlinScope)
1314
1415 baseKotlinScope.files.forEach { scope ->
1516 val fileWriteTo = testProjectDir.root.resolve(scope.filePath)
16- .apply {
17- parentFile.mkdirs()
18- createNewFile()
19- }
17+ .apply {
18+ parentFile.mkdirs()
19+ createNewFile()
20+ }
2021
2122 scope.files.forEach {
2223 val fileContent = readFileList(it)
@@ -25,9 +26,9 @@ internal fun BaseKotlinGradleTest.test(fn: BaseKotlinScope.() -> Unit): GradleRu
2526 }
2627
2728 return GradleRunner .create() //
28- .withProjectDir(testProjectDir.root)
29- .withPluginClasspath()
30- .withArguments(baseKotlinScope.runner.arguments)
29+ .withProjectDir(testProjectDir.root)
30+ .withPluginClasspath()
31+ .withArguments(baseKotlinScope.runner.arguments)
3132 // disabled because of: https://github.com/gradle/gradle/issues/6862
3233 // .withDebug(baseKotlinScope.runner.debug)
3334}
@@ -80,6 +81,12 @@ internal class AppendableScope(val filePath: String) {
8081}
8182
8283internal class Runner {
83- var debug = false
8484 val arguments: MutableList <String > = mutableListOf ()
8585}
86+
87+ internal fun readFileList (fileName : String ): String {
88+ val resource = BaseKotlinGradleTest ::class .java.classLoader.getResource(fileName)
89+ ? : throw IllegalStateException (" Could not find resource '$fileName '" )
90+ return File (resource.toURI()).readText()
91+ }
92+
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import kotlinx.validation.api.test
1717import org.assertj.core.api.Assertions
1818import org.junit.Test
1919
20- internal class GradlePluginFuncTest : BaseKotlinGradleTest () {
20+ internal class IngoredClassesTest : BaseKotlinGradleTest () {
2121 @Test
2222 fun `apiCheck should succeed, when no kotlin files are included in SourceSet` () {
2323 val runner = test {
You can’t perform that action at this time.
0 commit comments