diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2019-01-06 18:43:45 +0100 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2019-01-06 18:43:45 +0100 |
commit | e6414191630a30f6f90ea12c755b54f423c15f0b (patch) | |
tree | b032596bce601771b272a0da9f2508c3dfcc409e | |
parent | 514a27db58feed4c15d9655e733da7ed221c6ea4 (diff) | |
download | platform_external_jacoco-e6414191630a30f6f90ea12c755b54f423c15f0b.tar.gz platform_external_jacoco-e6414191630a30f6f90ea12c755b54f423c15f0b.tar.bz2 platform_external_jacoco-e6414191630a30f6f90ea12c755b54f423c15f0b.zip |
Add validation test for Kotlin safe call operator
It can be fully covered without any filters.
2 files changed, 55 insertions, 0 deletions
diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinSafeCallOperatorTest.java b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinSafeCallOperatorTest.java new file mode 100644 index 00000000..e4e45557 --- /dev/null +++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinSafeCallOperatorTest.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * 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.KotlinSafeCallOperatorTarget; + +/** + * Test of safe call operator. + */ +public class KotlinSafeCallOperatorTest extends ValidationTestBase { + + public KotlinSafeCallOperatorTest() { + super(KotlinSafeCallOperatorTarget.class); + } + +} diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinSafeCallOperatorTarget.kt b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinSafeCallOperatorTarget.kt new file mode 100644 index 00000000..c620cac0 --- /dev/null +++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinSafeCallOperatorTarget.kt @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Evgeny Mandrikov - initial API and implementation + * + *******************************************************************************/ +package org.jacoco.core.test.validation.kotlin.targets + +/** + * Test target for safe call operator. + */ +object KotlinSafeCallOperatorTarget { + + private fun example(x: String?): Int? { + return x?.length // assertFullyCovered(0, 2) + } + + @JvmStatic + fun main(args: Array<String>) { + example("") + example(null) + } + +} |