Skip to content

Commit

Permalink
(WIP) add validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Godin committed May 8, 2024
1 parent 3bba375 commit 9651891
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.core.test.validation.kotlin;

import org.jacoco.core.test.validation.ValidationTestBase;
import org.jacoco.core.test.validation.kotlin.targets.KotlinInlineClassTarget;

/**
* Test of code coverage in {@link KotlinInlineClassTarget}.
*/
public class KotlinInlineClassTest extends ValidationTestBase {

public KotlinInlineClassTest() {
super(KotlinInlineClassTarget.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.core.test.validation.kotlin.targets

import org.jacoco.core.test.validation.targets.Stubs.nop

/**
* Test target for `inline class`.
*/
object KotlinInlineClassTarget {

interface Base {
fun base()
}

@JvmInline
value class I1(val value: String) : Base { // assertEmpty()

init { // assertEmpty()
nop() // assertFullyCovered()
} // assertEmpty()

constructor() : this("") { // assertFullyCovered()
nop() // assertFullyCovered()
} // assertEmpty()

val length: Int // assertEmpty()
get() = value.length // assertFullyCovered()

fun f(p: String) { // assertEmpty()
nop(p) // assertFullyCovered()
} // assertFullyCovered()

fun f(p: I1) { // assertEmpty()
nop(p) // assertFullyCovered()
} // assertFullyCovered()

override fun base() { // assertEmpty()
nop() // assertFullyCovered()
} // assertFullyCovered()

} // assertEmpty()

@JvmInline
value class I2(val value: String) { // assertEmpty()

override fun toString(): String { // assertEmpty()
return "Value: $value" // assertNotCovered()
} // assertEmpty()

} // assertEmpty()

@JvmStatic
fun main(args: Array<String>) {
val i = I1()
i.value
i.length
i.f("")
i.f(i)
i.base()

I2("")
}

}

0 comments on commit 9651891

Please sign in to comment.