diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2019-01-06 19:05:03 +0100 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2019-01-06 19:05:03 +0100 |
commit | 07474471a5274b71ae3a98e54d2aa0cdacd7c612 (patch) | |
tree | 2794bef904611c1561efb792dd49dec746caa850 | |
parent | e6414191630a30f6f90ea12c755b54f423c15f0b (diff) | |
download | platform_external_jacoco-07474471a5274b71ae3a98e54d2aa0cdacd7c612.tar.gz platform_external_jacoco-07474471a5274b71ae3a98e54d2aa0cdacd7c612.tar.bz2 platform_external_jacoco-07474471a5274b71ae3a98e54d2aa0cdacd7c612.zip |
Add validation test for Kotlin elvis 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/KotlinElvisOperatorTest.java b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinElvisOperatorTest.java new file mode 100644 index 00000000..d1a6ead4 --- /dev/null +++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinElvisOperatorTest.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.KotlinElvisOperatorTarget; + +/** + * Test of elvis operator. + */ +public class KotlinElvisOperatorTest extends ValidationTestBase { + + public KotlinElvisOperatorTest() { + super(KotlinElvisOperatorTarget.class); + } + +} diff --git a/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinElvisOperatorTarget.kt b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinElvisOperatorTarget.kt new file mode 100644 index 00000000..b088daf7 --- /dev/null +++ b/org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinElvisOperatorTarget.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 elvis operator. + */ +object KotlinElvisOperatorTarget { + + private fun example(x: String?): String { + return x ?: "" // assertFullyCovered(0, 2) + } + + @JvmStatic + fun main(args: Array<String>) { + example("") + example(null) + } + +} |