aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2019-01-06 19:05:03 +0100
committerEvgeny Mandrikov <mandrikov@gmail.com>2019-01-06 19:05:03 +0100
commit07474471a5274b71ae3a98e54d2aa0cdacd7c612 (patch)
tree2794bef904611c1561efb792dd49dec746caa850
parente6414191630a30f6f90ea12c755b54f423c15f0b (diff)
downloadplatform_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.
-rw-r--r--org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/KotlinElvisOperatorTest.java26
-rw-r--r--org.jacoco.core.test.validation.kotlin/src/org/jacoco/core/test/validation/kotlin/targets/KotlinElvisOperatorTarget.kt29
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)
+ }
+
+}