Skip to content

Commit

Permalink
Ensure readme contains valid code
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszkwiecinski committed Feb 4, 2023
1 parent ef45db7 commit 168d934
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,41 @@ internal class ExtensionTest : WithGradleTest.Kotlin() {
assertThat(output).contains("com.pinterest:ktlint:0.46.0")
}
}

@Test
fun `readme doc contains valid groovy code`() {
projectRoot.resolve("build.gradle") {
// language=groovy
val buildScript =
"""
plugins {
id 'kotlin'
id 'io.github.usefulness.ktlint-gradle-plugin'
}
repositories {
mavenCentral()
}
ktlint {
ignoreFailures = false
reporters = ["checkstyle", "html", "json", "plain", "sarif"]
experimentalRules = true
disabledRules = ["no-wildcard-imports", "experimental:annotation", "your-custom-rule:no-bugs"]
ktlintVersion = "0.48.2"
chunkSize = 50
baselineFile.set(file("config/ktlint_baseline.xml"))
}
""".trimIndent()
writeText(buildScript)
}
projectRoot.resolve("src/main/kotlin/FileName.kt") {
writeText(kotlinClass("FileName"))
}

build("lintKotlin", "--dry-run").apply {
assertThat(output).contains(":lintKotlin SKIPPED")
}
}
}

0 comments on commit 168d934

Please sign in to comment.