Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-03-04 13:45:54 +0000
committerAnton Leherbauer2008-03-04 13:45:54 +0000
commitd860addc6d1f0336dfd4e0ddd13e9ebf99b5b257 (patch)
treebba57c7dad2d7d98b469d8fb6f9cdda003f47afc /core/org.eclipse.cdt.ui.tests
parent83a13921acd9226a7bab847717fc309ad6ec8f45 (diff)
downloadorg.eclipse.cdt-d860addc6d1f0336dfd4e0ddd13e9ebf99b5b257.tar.gz
org.eclipse.cdt-d860addc6d1f0336dfd4e0ddd13e9ebf99b5b257.tar.xz
org.eclipse.cdt-d860addc6d1f0336dfd4e0ddd13e9ebf99b5b257.zip
Use new node selection API and fix for 220392: empty macro is not highlighted as a macro reference
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java314
2 files changed, 166 insertions, 154 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp b/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
index 8a86010d10c..2f4cdaf43d9 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/semanticHighlighting/SHTest.cpp
@@ -1,5 +1,6 @@
#define INT int
#define FUNCTION_MACRO(arg) globalFunc(arg)
+#define EMPTY_MACRO(arg)
enum Enumeration {
enumerator
@@ -11,6 +12,7 @@ static int globalStaticVariable = 0;
void globalFunc(int a);
static void globalStaticFunc() {
+ EMPTY_MACRO(n);
};
class Base1 {};
@@ -134,3 +136,7 @@ int f()
{
return n;
}
+
+//http://bugs.eclipse.org/220392
+#define EMPTY
+EMPTY int f();
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
index 26c70905eed..bbfd2ce2ed6 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* 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
@@ -39,13 +39,13 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.STATIC_FIELD);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(23, 15, 14),
- createPosition(25, 21, 19),
- createPosition(42, 21, 20),
- createPosition(43, 15, 15),
- createPosition(57, 21, 20),
- createPosition(58, 15, 15),
- createPosition(118, 20, 15),
+ createPosition(25, 15, 14),
+ createPosition(27, 21, 19),
+ createPosition(44, 21, 20),
+ createPosition(45, 15, 15),
+ createPosition(59, 21, 20),
+ createPosition(60, 15, 15),
+ createPosition(120, 20, 15),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -55,31 +55,31 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.FIELD);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(23, 15, 14),
- createPosition(24, 14, 13),
- createPosition(25, 21, 19),
- createPosition(26, 8, 8),
- createPosition(42, 21, 20),
- createPosition(43, 15, 15),
- createPosition(44, 15, 14),
- createPosition(45, 8, 9),
- createPosition(57, 21, 20),
- createPosition(58, 15, 15),
- createPosition(59, 15, 14),
- createPosition(60, 8, 9),
- createPosition(75, 7, 5),
- createPosition(76, 7, 5),
- createPosition(78, 8, 5),
- createPosition(79, 8, 5),
- createPosition(87, 8, 11),
- createPosition(91, 8, 10),
- createPosition(105, 11, 9),
- createPosition(110, 11, 8),
- createPosition(115, 8, 11),
- createPosition(117, 7, 10),
- createPosition(118, 20, 15),
- createPosition(121, 11, 10),
- createPosition(121, 28, 11),
+ createPosition(25, 15, 14),
+ createPosition(26, 14, 13),
+ createPosition(27, 21, 19),
+ createPosition(28, 8, 8),
+ createPosition(44, 21, 20),
+ createPosition(45, 15, 15),
+ createPosition(46, 15, 14),
+ createPosition(47, 8, 9),
+ createPosition(59, 21, 20),
+ createPosition(60, 15, 15),
+ createPosition(61, 15, 14),
+ createPosition(62, 8, 9),
+ createPosition(77, 7, 5),
+ createPosition(78, 7, 5),
+ createPosition(80, 8, 5),
+ createPosition(81, 8, 5),
+ createPosition(89, 8, 11),
+ createPosition(93, 8, 10),
+ createPosition(107, 11, 9),
+ createPosition(112, 11, 8),
+ createPosition(117, 8, 11),
+ createPosition(119, 7, 10),
+ createPosition(120, 20, 15),
+ createPosition(123, 11, 10),
+ createPosition(123, 28, 11),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -89,16 +89,16 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.METHOD_DECLARATION);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(28, 15, 15),
- createPosition(33, 8, 9),
- createPosition(47, 15, 16),
- createPosition(48, 8, 10),
- createPosition(62, 15, 16),
- createPosition(63, 8, 10),
- createPosition(77, 4, 13),
- createPosition(104, 4, 26),
- createPosition(108, 4, 25),
- createPosition(113, 4, 32),
+ createPosition(30, 15, 15),
+ createPosition(35, 8, 9),
+ createPosition(49, 15, 16),
+ createPosition(50, 8, 10),
+ createPosition(64, 15, 16),
+ createPosition(65, 8, 10),
+ createPosition(79, 4, 13),
+ createPosition(106, 4, 26),
+ createPosition(110, 4, 25),
+ createPosition(115, 4, 32),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -107,19 +107,19 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
public void testMethodHighlighting() throws Exception {
setUpSemanticHighlighting(SemanticHighlightings.METHOD);
Position[] expected= new Position[] {
- createPosition(28, 15, 15),
- createPosition(33, 8, 9),
- createPosition(47, 15, 16),
- createPosition(48, 8, 10),
- createPosition(62, 15, 16),
- createPosition(63, 8, 10),
- createPosition(77, 4, 13),
- createPosition(104, 4, 26),
- createPosition(108, 4, 25),
- createPosition(113, 4, 32),
- createPosition(114, 23, 9),
- createPosition(118, 4, 15),
- createPosition(125, 13, 9),
+ createPosition(30, 15, 15),
+ createPosition(35, 8, 9),
+ createPosition(49, 15, 16),
+ createPosition(50, 8, 10),
+ createPosition(64, 15, 16),
+ createPosition(65, 8, 10),
+ createPosition(79, 4, 13),
+ createPosition(106, 4, 26),
+ createPosition(110, 4, 25),
+ createPosition(115, 4, 32),
+ createPosition(116, 23, 9),
+ createPosition(120, 4, 15),
+ createPosition(127, 13, 9),
};
Position[] actual= getSemanticHighlightingPositions();
if (PRINT_POSITIONS) System.out.println(toString(actual));
@@ -129,7 +129,7 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
public void testStaticMethodInvocationHighlighting() throws Exception {
setUpSemanticHighlighting(SemanticHighlightings.STATIC_METHOD_INVOCATION);
Position[] expected= new Position[] {
- createPosition(118, 4, 15),
+ createPosition(120, 4, 15),
};
Position[] actual= getSemanticHighlightingPositions();
if (PRINT_POSITIONS) System.out.println(toString(actual));
@@ -139,10 +139,10 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
public void testLocalVariableDeclarationHighlighting() throws Exception {
setUpSemanticHighlighting(SemanticHighlightings.LOCAL_VARIABLE_DECLARATION);
Position[] expected= new Position[] {
- createPosition(109, 8, 8),
- createPosition(114, 15, 2),
- createPosition(116, 13, 2),
- createPosition(124, 13, 8),
+ createPosition(111, 8, 8),
+ createPosition(116, 15, 2),
+ createPosition(118, 13, 2),
+ createPosition(126, 13, 8),
};
Position[] actual= getSemanticHighlightingPositions();
if (PRINT_POSITIONS) System.out.println(toString(actual));
@@ -152,12 +152,12 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
public void testLocalVariableReferencesHighlighting() throws Exception {
setUpSemanticHighlighting(SemanticHighlightings.LOCAL_VARIABLE);
Position[] expected= new Position[] {
- createPosition(110, 22, 8),
- createPosition(115, 4, 2),
+ createPosition(112, 22, 8),
createPosition(117, 4, 2),
- createPosition(121, 8, 2),
- createPosition(121, 24, 2),
- createPosition(125, 4, 8),
+ createPosition(119, 4, 2),
+ createPosition(123, 8, 2),
+ createPosition(123, 24, 2),
+ createPosition(127, 4, 8),
};
Position[] actual= getSemanticHighlightingPositions();
if (PRINT_POSITIONS) System.out.println(toString(actual));
@@ -168,14 +168,14 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.PARAMETER_VARIABLE);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(11, 20, 1),
- createPosition(28, 35, 3),
- createPosition(29, 23, 3),
- createPosition(30, 19, 3),
- createPosition(77, 21, 4),
- createPosition(77, 30, 4),
- createPosition(78, 16, 4),
- createPosition(79, 16, 4),
+ createPosition(12, 20, 1),
+ createPosition(30, 35, 3),
+ createPosition(31, 23, 3),
+ createPosition(32, 19, 3),
+ createPosition(79, 21, 4),
+ createPosition(79, 30, 4),
+ createPosition(80, 16, 4),
+ createPosition(81, 16, 4),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -185,16 +185,16 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.TEMPLATE_PARAMETER);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(74, 15, 2),
- createPosition(74, 25, 2),
- createPosition(75, 4, 2),
- createPosition(76, 4, 2),
- createPosition(77, 18, 2),
- createPosition(77, 27, 2),
- createPosition(83, 15, 2),
- createPosition(83, 66, 2),
- createPosition(131, 14, 1),
- createPosition(134, 9, 1),
+ createPosition(76, 15, 2),
+ createPosition(76, 25, 2),
+ createPosition(77, 4, 2),
+ createPosition(78, 4, 2),
+ createPosition(79, 18, 2),
+ createPosition(79, 27, 2),
+ createPosition(85, 15, 2),
+ createPosition(85, 66, 2),
+ createPosition(133, 14, 1),
+ createPosition(136, 9, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -204,10 +204,10 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.ENUM);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(3, 5, 11),
- createPosition(35, 9, 14),
- createPosition(50, 9, 15),
- createPosition(65, 9, 15),
+ createPosition(4, 5, 11),
+ createPosition(37, 9, 14),
+ createPosition(52, 9, 15),
+ createPosition(67, 9, 15),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -217,37 +217,37 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.CLASS);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(15, 6, 5),
- createPosition(16, 6, 5),
- createPosition(18, 6, 14),
- createPosition(18, 23, 5),
- createPosition(18, 30, 5),
- createPosition(20, 17, 11),
- createPosition(36, 10, 8),
- createPosition(37, 10, 9),
+ createPosition(17, 6, 5),
+ createPosition(18, 6, 5),
+ createPosition(20, 6, 14),
+ createPosition(20, 23, 5),
+ createPosition(20, 30, 5),
+ createPosition(22, 17, 11),
createPosition(38, 10, 8),
- createPosition(39, 12, 8),
- createPosition(51, 10, 9),
- createPosition(52, 10, 10),
+ createPosition(39, 10, 9),
+ createPosition(40, 10, 8),
+ createPosition(41, 12, 8),
createPosition(53, 10, 9),
- createPosition(54, 12, 9),
- createPosition(66, 10, 9),
- createPosition(67, 10, 10),
+ createPosition(54, 10, 10),
+ createPosition(55, 10, 9),
+ createPosition(56, 12, 9),
createPosition(68, 10, 9),
- createPosition(69, 12, 9),
- createPosition(74, 35, 13),
- createPosition(83, 25, 24),
- createPosition(83, 52, 13),
- createPosition(83, 70, 5),
- createPosition(86, 7, 9),
- createPosition(90, 6, 8),
- createPosition(94, 8, 8),
- createPosition(104, 4, 14),
- createPosition(108, 4, 14),
- createPosition(113, 4, 14),
- createPosition(114, 4, 9),
- createPosition(116, 4, 8),
- createPosition(124, 4, 8),
+ createPosition(69, 10, 10),
+ createPosition(70, 10, 9),
+ createPosition(71, 12, 9),
+ createPosition(76, 35, 13),
+ createPosition(85, 25, 24),
+ createPosition(85, 52, 13),
+ createPosition(85, 70, 5),
+ createPosition(88, 7, 9),
+ createPosition(92, 6, 8),
+ createPosition(96, 8, 8),
+ createPosition(106, 4, 14),
+ createPosition(110, 4, 14),
+ createPosition(115, 4, 14),
+ createPosition(116, 4, 9),
+ createPosition(118, 4, 8),
+ createPosition(126, 4, 8),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -257,11 +257,12 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.FUNCTION_DECLARATION);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(11, 5, 10),
- createPosition(12, 12, 16),
- createPosition(19, 16, 10),
- createPosition(98, 8, 13),
- createPosition(132, 4, 1),
+ createPosition(12, 5, 10),
+ createPosition(13, 12, 16),
+ createPosition(21, 16, 10),
+ createPosition(100, 8, 13),
+ createPosition(134, 4, 1),
+ createPosition(141, 10, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -271,14 +272,15 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.FUNCTION);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(11, 5, 10),
- createPosition(12, 12, 16),
- createPosition(19, 16, 10),
- createPosition(30, 8, 10),
- createPosition(98, 8, 13),
- createPosition(99, 1, 16),
- createPosition(126, 4, 11),
- createPosition(132, 4, 1),
+ createPosition(12, 5, 10),
+ createPosition(13, 12, 16),
+ createPosition(21, 16, 10),
+ createPosition(32, 8, 10),
+ createPosition(100, 8, 13),
+ createPosition(101, 1, 16),
+ createPosition(128, 4, 11),
+ createPosition(134, 4, 1),
+ createPosition(141, 10, 1),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -289,12 +291,12 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.GLOBAL_VARIABLE);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(7, 10, 14),
- createPosition(8, 4, 14),
- createPosition(9, 11, 20),
- createPosition(31, 15, 20),
- createPosition(97, 8, 12),
- createPosition(100, 8, 12),
+ createPosition(8, 10, 14),
+ createPosition(9, 4, 14),
+ createPosition(10, 11, 20),
+ createPosition(33, 15, 20),
+ createPosition(99, 8, 12),
+ createPosition(102, 8, 12),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -306,6 +308,8 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
Position[] expected= new Position[] {
createPosition(0, 8, 3),
createPosition(1, 8, 14),
+ createPosition(2, 8, 11),
+ createPosition(140, 8, 5),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -315,11 +319,13 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.MACRO_REFERENCE);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(29, 8, 14),
- createPosition(104, 0, 3),
- createPosition(108, 0, 3),
- createPosition(113, 0, 3),
- createPosition(120, 4, 14),
+ createPosition(14, 4, 11),
+ createPosition(31, 8, 14),
+ createPosition(106, 0, 3),
+ createPosition(110, 0, 3),
+ createPosition(115, 0, 3),
+ createPosition(122, 4, 14),
+ createPosition(141, 0, 5),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -329,10 +335,10 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.TYPEDEF);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(39, 21, 10),
- createPosition(54, 22, 11),
- createPosition(69, 22, 11),
- createPosition(94, 17, 6),
+ createPosition(41, 21, 10),
+ createPosition(56, 22, 11),
+ createPosition(71, 22, 11),
+ createPosition(96, 17, 6),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -342,7 +348,7 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.NAMESPACE);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(96, 10, 2),
+ createPosition(98, 10, 2),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -352,8 +358,8 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.LABEL);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(119, 0, 5),
- createPosition(121, 46, 5),
+ createPosition(121, 0, 5),
+ createPosition(123, 46, 5),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -363,10 +369,10 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.ENUMERATOR);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(4, 4, 10),
- createPosition(35, 25, 13),
- createPosition(50, 26, 14),
- createPosition(65, 26, 14),
+ createPosition(5, 4, 10),
+ createPosition(37, 25, 13),
+ createPosition(52, 26, 14),
+ createPosition(67, 26, 14),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -376,7 +382,7 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.PROBLEM);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(122, 4, 13),
+ createPosition(124, 4, 13),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);
@@ -386,8 +392,8 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
setUpSemanticHighlighting(SemanticHighlightings.EXTERNAL_SDK);
Position[] actual= getSemanticHighlightingPositions();
Position[] expected= new Position[] {
- createPosition(125, 13, 9),
- createPosition(126, 4, 11),
+ createPosition(127, 13, 9),
+ createPosition(128, 4, 11),
};
if (PRINT_POSITIONS) System.out.println(toString(actual));
assertEqualPositions(expected, actual);

Back to the top