Skip to content

Commit f8d3b5e

Browse files
authored
Added test on copyVariant function
PR #632
1 parent 3bee2a8 commit f8d3b5e

File tree

14 files changed

+183
-7
lines changed

14 files changed

+183
-7
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
kotlin("jvm") version "1.7.10"
3+
id("org.jetbrains.kotlinx.kover") version "0.8.1"
4+
}
5+
6+
dependencies {
7+
implementation(project(":first"))
8+
implementation(project(":second"))
9+
testImplementation(kotlin("test"))
10+
}
11+
12+
kover {
13+
merge {
14+
subprojects()
15+
16+
createVariant("aggregated") {
17+
add("jvm")
18+
}
19+
}
20+
21+
currentProject {
22+
copyVariant("first", "aggregated")
23+
copyVariant("second", "aggregated")
24+
}
25+
26+
reports {
27+
variant("first") {
28+
filters.includes.projects.add(":first")
29+
}
30+
variant("second") {
31+
filters.includes.projects.add(":second")
32+
}
33+
}
34+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
kotlin("jvm")
3+
}
4+
5+
dependencies {
6+
testImplementation(kotlin("test"))
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package kotlinx.kover.examples.merged.subproject.utils
2+
3+
class SubprojectUtils {
4+
fun minus(a: Int, b: Int): Int {
5+
if (b < 0) return 0
6+
return a - b
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package kotlinx.kover.examples.merged
2+
3+
class SubprojectFirstClass {
4+
fun formatInt(i: Int): String {
5+
if (i == 0) return "ZERO"
6+
return if (i > 0) {
7+
"POSITIVE=$i"
8+
} else {
9+
"NEGATIVE=${-i}"
10+
}
11+
}
12+
13+
fun printClass() {
14+
val name = this::class.qualifiedName
15+
println(name)
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package kotlinx.kover.examples.merged.subproject
2+
3+
import kotlin.math.*
4+
5+
class SubprojectSecondClass {
6+
fun formatDouble(d: Double): String {
7+
if (d.roundToInt().toDouble() == d) {
8+
return "INTEGER=${d.roundToInt()}"
9+
} else {
10+
return "FRACTIONAL=$d"
11+
}
12+
}
13+
14+
fun printClass() {
15+
val name = this::class.qualifiedName
16+
println(name)
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package kotlinx.kover.examples.merged
2+
3+
import kotlin.test.Test
4+
5+
class TestClasses {
6+
@Test
7+
fun testThisProject() {
8+
SubprojectFirstClass().printClass()
9+
}
10+
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins {
2+
kotlin("jvm")
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package kotlinx.kover.examples.merged
2+
3+
class ClassFromSecondProject {
4+
fun foo() {
5+
println("Hello")
6+
}
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
mavenCentral()
5+
}
6+
}
7+
rootProject.name = "copy-variant"
8+
9+
include(":first")
10+
include(":second")
11+
12+
dependencyResolutionManagement {
13+
repositories {
14+
mavenCentral()
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package kotlinx.kover.examples.merged
2+
3+
class ExampleClass {
4+
fun formatInt(i: Int): String {
5+
if (i == 0) return "ZERO"
6+
return if (i > 0) {
7+
"POSITIVE=$i"
8+
} else {
9+
"NEGATIVE=${-i}"
10+
}
11+
}
12+
13+
fun printClass() {
14+
val name = this::class.qualifiedName
15+
println(name)
16+
}
17+
}

0 commit comments

Comments
 (0)