Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2016-06-30 18:06:07 -0400
committerGerrit Code Review @ Eclipse.org2016-07-06 23:16:22 -0400
commit53448937562673adcc8dcb1ade8f7bd5f4001984 (patch)
tree3acbcbc1f9e707ed582a179947bba12813b88c07 /codan/org.eclipse.cdt.codan.core.test
parent7a4d4fdb95b1a85f4edad65c56ac23de2de93b1e (diff)
downloadorg.eclipse.cdt-53448937562673adcc8dcb1ade8f7bd5f4001984.tar.gz
org.eclipse.cdt-53448937562673adcc8dcb1ade8f7bd5f4001984.tar.xz
org.eclipse.cdt-53448937562673adcc8dcb1ade8f7bd5f4001984.zip
Bug 496628 - Avoid codan markers that cover an entire class declaration
This fixes a regression from bug 486610 which introduced these in some cases. Change-Id: I791528ce7f0bc061386aaa97dd9cecb7abeecd72
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/NonVirtualDestructorCheckerTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/NonVirtualDestructorCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/NonVirtualDestructorCheckerTest.java
index 89629e2f10..d795824f41 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/NonVirtualDestructorCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/NonVirtualDestructorCheckerTest.java
@@ -14,6 +14,7 @@ package org.eclipse.cdt.codan.core.internal.checkers;
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
import org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructor;
+import org.eclipse.core.resources.IMarker;
/**
* Test for {@link NonVirtualDestructor} class.
@@ -203,4 +204,18 @@ public class NonVirtualDestructorCheckerTest extends CheckerTestCase {
loadCodeAndRun(getAboveComment());
assertMessageContains("Foo", markers[0]);
}
+
+ // class Foo {
+ // virtual void bar();
+ // };
+ public void testBug496628_MarkerBounds() throws Exception {
+ String code = getAboveComment();
+ loadCodeAndRun(code);
+ IMarker marker = checkErrorLine(1);
+ int start = marker.getAttribute(IMarker.CHAR_START, -1);
+ int end = marker.getAttribute(IMarker.CHAR_END, -1);
+ // The error should not cover the entire class
+ assertTrue((start == -1 && end == -1) || // ok, not multi-line
+ !code.substring(start, end).contains("\n"));
+ }
}

Back to the top