Skip to content

Commit d07e962

Browse files
committed
(WIP) add validation test
1 parent 726dcdf commit d07e962

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
3+
* This program and the accompanying materials are made available under
4+
* the terms of the Eclipse Public License 2.0 which is available at
5+
* http://www.eclipse.org/legal/epl-2.0
6+
*
7+
* SPDX-License-Identifier: EPL-2.0
8+
*
9+
* Contributors:
10+
* Evgeny Mandrikov - initial API and implementation
11+
*
12+
*******************************************************************************/
13+
package org.jacoco.core.test.validation.kotlin;
14+
15+
import org.jacoco.core.test.validation.ValidationTestBase;
16+
import org.jacoco.core.test.validation.kotlin.targets.KotlinInlineClassTarget;
17+
18+
/**
19+
* Test of code coverage in {@link KotlinInlineClassTarget}.
20+
*/
21+
public class KotlinInlineClassTest extends ValidationTestBase {
22+
23+
public KotlinInlineClassTest() {
24+
super(KotlinInlineClassTarget.class);
25+
}
26+
27+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
3+
* This program and the accompanying materials are made available under
4+
* the terms of the Eclipse Public License 2.0 which is available at
5+
* http://www.eclipse.org/legal/epl-2.0
6+
*
7+
* SPDX-License-Identifier: EPL-2.0
8+
*
9+
* Contributors:
10+
* Evgeny Mandrikov - initial API and implementation
11+
*
12+
*******************************************************************************/
13+
package org.jacoco.core.test.validation.kotlin.targets
14+
15+
import org.jacoco.core.test.validation.targets.Stubs.nop
16+
17+
/**
18+
* Test target for `inline class`.
19+
*/
20+
object KotlinInlineClassTarget {
21+
22+
interface Base {
23+
fun base()
24+
}
25+
26+
@JvmInline
27+
value class I1(val value: String) : Base { // assertEmpty()
28+
29+
init { // assertEmpty()
30+
nop() // assertFullyCovered()
31+
} // assertEmpty()
32+
33+
constructor(): this("") // assertFullyCovered()
34+
35+
fun function() { // assertEmpty()
36+
nop() // assertFullyCovered()
37+
} // assertFullyCovered()
38+
39+
override fun base() { // assertEmpty()
40+
nop() // assertFullyCovered()
41+
} // assertFullyCovered()
42+
43+
}
44+
45+
@JvmInline
46+
value class I2(val value: String) {
47+
48+
override fun toString(): String { // assertEmpty()
49+
return "Value: $value" // assertNotCovered()
50+
} // assertEmpty()
51+
52+
}
53+
54+
@JvmStatic
55+
fun main(args: Array<String>) {
56+
val i = I1()
57+
i.value
58+
i.function()
59+
i.base()
60+
61+
I2("")
62+
}
63+
64+
}

0 commit comments

Comments
 (0)