-
Notifications
You must be signed in to change notification settings - Fork 47
/
InstrumentationFilteringTests.kt
58 lines (53 loc) · 2.28 KB
/
InstrumentationFilteringTests.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package kotlinx.kover.test.functional.cases
import kotlinx.kover.api.*
import kotlinx.kover.test.functional.cases.utils.*
import kotlinx.kover.test.functional.core.*
import kotlinx.kover.test.functional.core.BaseGradleScriptTest
import kotlin.test.*
internal class InstrumentationFilteringTests : BaseGradleScriptTest() {
@Test
fun testExclude() {
builder()
.case("Test exclusion of classes from instrumentation")
.languages(GradleScriptLanguage.KOTLIN, GradleScriptLanguage.GROOVY)
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO)
.sources("simple")
.configTest(
"""excludes = listOf("org.jetbrains.*Exa?ple*")""",
"""excludes = ['org.jetbrains.*Exa?ple*']"""
)
.build()
.run("build") {
xml(DEFAULT_XML) {
assertCounterExcluded(classCounter("org.jetbrains.ExampleClass"), this@run.engine)
assertCounterCoveredAndIncluded(classCounter("org.jetbrains.SecondClass"))
}
}
}
@Test
fun testExcludeInclude() {
builder()
.case("Test inclusion and exclusion of classes in instrumentation")
.languages(GradleScriptLanguage.KOTLIN, GradleScriptLanguage.GROOVY)
.types(ProjectType.KOTLIN_JVM, ProjectType.KOTLIN_MULTIPLATFORM)
.engines(CoverageEngine.INTELLIJ, CoverageEngine.JACOCO)
.sources("simple")
.configTest(
"""includes = listOf("org.jetbrains.*Cla?s")""",
"""includes = ['org.jetbrains.*Cla?s']"""
)
.configTest(
"""excludes = listOf("org.jetbrains.*Exa?ple*")""",
"""excludes = ['org.jetbrains.*Exa?ple*']"""
)
.build()
.run("build") {
xml(DEFAULT_XML) {
assertCounterExcluded(classCounter("org.jetbrains.ExampleClass"), this@run.engine)
assertCounterExcluded(classCounter("org.jetbrains.Unused"), this@run.engine)
assertCounterCoveredAndIncluded(classCounter("org.jetbrains.SecondClass"))
}
}
}
}