Skip to content

Commit 8004965

Browse files
committed
Apply our code-style to introduced test sourceset
1 parent c4818ad commit 8004965

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

src/functionalTest/kotlin/kotlinx/validation/api/resourceExt.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/functionalTest/kotlin/kotlinx/validation/api/testDsl.kt

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55

66
package kotlinx.validation.api
77

8-
import org.gradle.testkit.runner.GradleRunner
8+
import org.gradle.testkit.runner.*
9+
import java.io.*
910

1011
internal 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

8283
internal 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+

src/functionalTest/kotlin/kotlinx/validation/test/GradlePluginFuncTest.kt renamed to src/functionalTest/kotlin/kotlinx/validation/test/IngoredClassesTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import kotlinx.validation.api.test
1717
import org.assertj.core.api.Assertions
1818
import 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 {

0 commit comments

Comments
 (0)