Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp8
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/search/include.h5
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java37
-rw-r--r--core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java9
5 files changed, 65 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index 8166d6ea03..51e85e5c44 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,4 +1,9 @@
-2003-09-17 Bogdan Gheorghe
+2003-09-16 Andrew Niefer
+ - modified resources/search/classDecl.cpp & include.h to include some operators
+ - added testOperators_bug43063_bug42979() to MethodDeclarationPatternTests
+ - added testParameterREferences to OtherPatternTests
+
+2003-09-16 Bogdan Gheorghe
Added asserts to all index lookups in IndexManagerTests
Fixed testAddNewFileToIndex
diff --git a/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp
index f670b73781..e2ea84c577 100644
--- a/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp
+++ b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp
@@ -53,4 +53,12 @@ class AClassForFoo {};
AClassForFoo foo( AClassForFoo ){
AClassForFoo b;
return b;
+}
+
+Head * Head::operator *= ( int index ){
+ return array[ index ];
+}
+
+Head * Head::operator += ( int index ){
+ return array[ index ];
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/resources/search/include.h b/core/org.eclipse.cdt.core.tests/resources/search/include.h
index 687e442ef9..dedd7c8ca6 100644
--- a/core/org.eclipse.cdt.core.tests/resources/search/include.h
+++ b/core/org.eclipse.cdt.core.tests/resources/search/include.h
@@ -2,6 +2,11 @@
#define INCLUDE_H
class Head {
+ Head * operator *= ( int index );
+ Head * operator * ( int index ){ return array[ index ]; }
+ Head * operator += ( int index );
+
+ Head ** array;
};
#endif \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java
index 31d9bc9a58..0eb12a7765 100644
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java
+++ b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java
@@ -16,6 +16,7 @@ package org.eclipse.cdt.core.search.tests;
import java.util.Set;
import org.eclipse.cdt.core.search.ICSearchPattern;
+import org.eclipse.cdt.core.search.IMatch;
import org.eclipse.cdt.core.search.SearchEngine;
import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.search.matching.MethodDeclarationPattern;
@@ -103,4 +104,40 @@ public class FunctionMethodPatternTests extends BaseSearchTest {
matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 1 );
}
+
+ public void testOperators_bug43063_bug42979(){
+ ICSearchPattern pattern = SearchEngine.createSearchPattern( "operator \\*", METHOD, DECLARATIONS, true );
+
+ search( workspace, pattern, scope, resultCollector );
+ Set matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 1 );
+ IMatch match1 = (IMatch) matches.iterator().next();
+
+ pattern = SearchEngine.createSearchPattern( "operator \\*", METHOD, DEFINITIONS, true );
+ search( workspace, pattern, scope, resultCollector );
+ matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 1 );
+ IMatch match2 = (IMatch) matches.iterator().next();
+
+ assertTrue( match1.getStartOffset() == match2.getStartOffset() );
+
+ pattern = SearchEngine.createSearchPattern( "operator \\*=", METHOD, DECLARATIONS, true );
+ search( workspace, pattern, scope, resultCollector );
+ matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 1 );
+ match1 = (IMatch) matches.iterator().next();
+
+ pattern = SearchEngine.createSearchPattern( "operator \\*=", METHOD, DEFINITIONS, true );
+ search( workspace, pattern, scope, resultCollector );
+ matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 1 );
+ match2 = (IMatch) matches.iterator().next();
+
+ assertTrue( match1.getStartOffset() != match2.getStartOffset() );
+
+ pattern = SearchEngine.createSearchPattern( "operator *", METHOD, DECLARATIONS, true );
+ search( workspace, pattern, scope, resultCollector );
+ matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 5 ); //3 in classDecl.cpp, 2 in mail.cpp
+ }
}
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
index ac27a5db40..bd82287d19 100644
--- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
+++ b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/OtherPatternTests.java
@@ -228,4 +228,13 @@ public class OtherPatternTests extends BaseSearchTest {
assertTrue( match.getName().equals( "eE" ) );
assertTrue( match.getParentName().equals( "NS3::C" ));
}
+
+ public void testParameterReferences(){
+ ICSearchPattern pattern = SearchEngine.createSearchPattern( "index", VAR, REFERENCES, true );
+
+ search( workspace, pattern, scope, resultCollector );
+
+ Set matches = resultCollector.getSearchResults();
+ assertEquals( matches.size(), 3 );
+ }
}

Back to the top