aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test.validation.java7
diff options
context:
space:
mode:
authorEvgeny Mandrikov <Godin@users.noreply.github.com>2018-08-07 09:09:54 +0200
committerGitHub <noreply@github.com>2018-08-07 09:09:54 +0200
commita364dcc69503baa790e84691e4b34fc76a2e47a2 (patch)
treed072b6e29ddcce010e9286f04686100008e17461 /org.jacoco.core.test.validation.java7
parentbbee0397a1ff4e39bab42c731531d02cc404fc2b (diff)
downloadjacoco-a364dcc69503baa790e84691e4b34fc76a2e47a2.tar.gz
`assertLine(String, int)` should imply zero number of branches (#722)
Diffstat (limited to 'org.jacoco.core.test.validation.java7')
-rw-r--r--org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/StringSwitchTest.java10
-rw-r--r--org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/TryWithResourcesTest.java30
2 files changed, 22 insertions, 18 deletions
diff --git a/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/StringSwitchTest.java b/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/StringSwitchTest.java
index ddf0c061..04fe6f5d 100644
--- a/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/StringSwitchTest.java
+++ b/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/StringSwitchTest.java
@@ -36,10 +36,10 @@ public class StringSwitchTest extends ValidationTestBase {
} else {
assertLine("covered.switch", ICounter.PARTLY_COVERED, 2, 7);
}
- assertLine("covered.case1", ICounter.FULLY_COVERED, 0, 0);
- assertLine("covered.case2", ICounter.FULLY_COVERED, 0, 0);
- assertLine("covered.case3", ICounter.FULLY_COVERED, 0, 0);
- assertLine("covered.default", ICounter.FULLY_COVERED, 0, 0);
+ assertLine("covered.case1", ICounter.FULLY_COVERED);
+ assertLine("covered.case2", ICounter.FULLY_COVERED);
+ assertLine("covered.case3", ICounter.FULLY_COVERED);
+ assertLine("covered.default", ICounter.FULLY_COVERED);
}
/**
@@ -57,7 +57,7 @@ public class StringSwitchTest extends ValidationTestBase {
@Test
public void handwritten() {
assertLine("handwritten.firstSwitch", ICounter.FULLY_COVERED, 2, 1);
- assertLine("handwritten.ignored", ICounter.FULLY_COVERED);
+ assertLine("handwritten.ignored", ICounter.FULLY_COVERED, 1, 1);
assertLine("handwritten.secondSwitch", ICounter.FULLY_COVERED, 3, 1);
assertLine("handwritten.case1", ICounter.FULLY_COVERED);
assertLine("handwritten.case2", ICounter.NOT_COVERED);
diff --git a/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/TryWithResourcesTest.java b/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/TryWithResourcesTest.java
index 5d0360ce..9eb02571 100644
--- a/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/TryWithResourcesTest.java
+++ b/org.jacoco.core.test.validation.java7/src/org/jacoco/core/test/validation/java7/TryWithResourcesTest.java
@@ -89,7 +89,7 @@ public class TryWithResourcesTest extends ValidationTestBase {
// https://bugs.openjdk.java.net/browse/JDK-8134759
// javac 7 and 8 up to 8u92 are affected
if (JAVA_VERSION.isBefore("1.8.0_92")) {
- assertLine("returnInBody.close", ICounter.FULLY_COVERED, 0, 0);
+ assertLine("returnInBody.close", ICounter.FULLY_COVERED);
} else {
assertLine("returnInBody.close", ICounter.EMPTY);
}
@@ -130,10 +130,10 @@ public class TryWithResourcesTest extends ValidationTestBase {
} else {
assertLine("nested.try3", ICounter.EMPTY);
}
- assertLine("nested.open3", ICounter.FULLY_COVERED, 0, 0);
- assertLine("nested.body3", ICounter.FULLY_COVERED, 0, 0);
+ assertLine("nested.open3", ICounter.FULLY_COVERED);
+ assertLine("nested.body3", ICounter.FULLY_COVERED);
assertLine("nested.catch3", ICounter.NOT_COVERED);
- assertLine("nested.finally3", ICounter.FULLY_COVERED, 0, 0);
+ assertLine("nested.finally3", ICounter.FULLY_COVERED);
// without filter next lines have branches:
assertLine("nested.close3", ICounter.EMPTY);
@@ -186,14 +186,14 @@ public class TryWithResourcesTest extends ValidationTestBase {
assertLine("empty.try", ICounter.EMPTY);
}
assertLine("empty.open", ICounter.FULLY_COVERED);
- // empty when EJC:
- if (isJDKCompiler) {
- if (JAVA_VERSION.isBefore("9")) {
- // branches with javac 7 and 8
- assertLine("empty.close", ICounter.PARTLY_COVERED);
- } else {
- assertLine("empty.close", ICounter.FULLY_COVERED, 0, 0);
- }
+ if (!isJDKCompiler) {
+ assertLine("empty.close", ICounter.PARTLY_COVERED, 7, 1);
+ } else if (JAVA_VERSION.isBefore("8")) {
+ assertLine("empty.close", ICounter.PARTLY_COVERED, 6, 2);
+ } else if (JAVA_VERSION.isBefore("9")) {
+ assertLine("empty.close", ICounter.PARTLY_COVERED, 2, 2);
+ } else {
+ assertLine("empty.close", ICounter.FULLY_COVERED);
}
}
@@ -204,7 +204,11 @@ public class TryWithResourcesTest extends ValidationTestBase {
public void throwInBody() {
// not filtered
assertLine("throwInBody.try", ICounter.NOT_COVERED);
- if (!isJDKCompiler || JAVA_VERSION.isBefore("11")) {
+ if (!isJDKCompiler){
+ assertLine("throwInBody.close", ICounter.NOT_COVERED, 6, 0);
+ } else if (JAVA_VERSION.isBefore("9")) {
+ assertLine("throwInBody.close", ICounter.NOT_COVERED, 4, 0);
+ } else if (JAVA_VERSION.isBefore("11")) {
assertLine("throwInBody.close", ICounter.NOT_COVERED);
} else {
assertLine("throwInBody.close", ICounter.EMPTY);