1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-09 19:43:27 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-05-12 11:07:19 -07:00
parent a28d05b77c
commit f70ab948fc

View file

@ -14,7 +14,9 @@
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion) * Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
* Nathan Ridge * Nathan Ridge
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist2;import java.io.File; package org.eclipse.cdt.ui.tests.text.contentassist2;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -27,7 +29,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.core.testplugin.TestScannerProvider; import org.eclipse.cdt.core.testplugin.TestScannerProvider;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase; import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
;
/** /**
* A collection of code completion tests. * A collection of code completion tests.
@ -44,7 +45,6 @@ public class CompletionTests extends AbstractContentAssistTest {
private boolean fCheckExtraResults= true; private boolean fCheckExtraResults= true;
private IProject fProject; private IProject fProject;
// {DisturbWith.cpp} // {DisturbWith.cpp}
// int gTemp; // int gTemp;
// void gFunc(); // void gFunc();
@ -92,7 +92,6 @@ public class CompletionTests extends AbstractContentAssistTest {
// }; // };
// typedef C1 T1; // typedef C1 T1;
// //
//
// class C2 : public T1 { // class C2 : public T1 {
// public: // public:
// C2* fMySelf; // C2* fMySelf;
@ -112,7 +111,6 @@ public class CompletionTests extends AbstractContentAssistTest {
// }; // };
// typedef C2 T2; // typedef C2 T2;
// //
//
// class C3 : public C2 { // class C3 : public C2 {
// public: // public:
// C3* fMySelf; // C3* fMySelf;
@ -191,10 +189,10 @@ public class CompletionTests extends AbstractContentAssistTest {
fProject= project; fProject= project;
String headerContent= readTaggedComment(HEADER_FILE_NAME); String headerContent= readTaggedComment(HEADER_FILE_NAME);
StringBuilder sourceContent= getContentsForTest(1)[0]; StringBuilder sourceContent= getContentsForTest(1)[0];
sourceContent.insert(0, "#include \""+HEADER_FILE_NAME+"\"\n"); sourceContent.insert(0, "#include \"" + HEADER_FILE_NAME + "\"\n");
fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG); fCursorOffset= sourceContent.indexOf(CURSOR_LOCATION_TAG);
assertTrue("No cursor location specified", fCursorOffset >= 0); assertTrue("No cursor location specified", fCursorOffset >= 0);
sourceContent.delete(fCursorOffset, fCursorOffset+CURSOR_LOCATION_TAG.length()); sourceContent.delete(fCursorOffset, fCursorOffset + CURSOR_LOCATION_TAG.length());
assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent)); assertNotNull(createFile(project, HEADER_FILE_NAME, headerContent));
return createFile(project, SOURCE_FILE_NAME, sourceContent.toString()); return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
} }
@ -330,17 +328,13 @@ public class CompletionTests extends AbstractContentAssistTest {
//void f() {C2* cLocal1; cLocal1->f/*cursor*/ //void f() {C2* cLocal1; cLocal1->f/*cursor*/
public void testDataMembers_GlobalScope() throws Exception { public void testDataMembers_GlobalScope() throws Exception {
final String[] expected= { final String[] expected= { "fMySelf" };
"fMySelf"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void C2::f() {while(true) {f/*cursor*/ //void C2::f() {while(true) {f/*cursor*/
public void testDataMembers_MethodScope() throws Exception { public void testDataMembers_MethodScope() throws Exception {
final String[] expected= { final String[] expected= { "fMySelf" };
"fMySelf"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
@ -379,9 +373,7 @@ public class CompletionTests extends AbstractContentAssistTest {
//void f() {C/*cursor*/ //void f() {C/*cursor*/
public void testTypes_GlobalScope() throws Exception { public void testTypes_GlobalScope() throws Exception {
final String[] expected= { final String[] expected= { "C1", "C2", "C3" };
"C1", "C2", "C3"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
@ -413,284 +405,222 @@ public class CompletionTests extends AbstractContentAssistTest {
//void _friend_function(C2* x) { x->m/*cursor*/ // Not a friend due to parameter type mismatch //void _friend_function(C2* x) { x->m/*cursor*/ // Not a friend due to parameter type mismatch
public void testTypes_FakeFriendFunction() throws Exception { public void testTypes_FakeFriendFunction() throws Exception {
final String[] expected= { final String[] expected= { "m123(void)", "m12(void)", "m13(void)", "m23(void)" };
"m123(void)", "m12(void)", "m13(void)", "m23(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void C2::f() {T/*cursor*/ //void C2::f() {T/*cursor*/
public void testTypes_MethodScope() throws Exception { public void testTypes_MethodScope() throws Exception {
final String[] expected= { final String[] expected= { "T1", "T2", "T3", "TClass" };
"T1", "T2", "T3", "TClass"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//namespace ns {void nsfunc(){C/*cursor*/ //namespace ns {void nsfunc(){C/*cursor*/
public void testTypes_NamespaceScope() throws Exception { public void testTypes_NamespaceScope() throws Exception {
final String[] expected= { final String[] expected= { "C1", "C2", "C3", "CNS" };
"C1", "C2", "C3", "CNS"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//namespace ns {void gfunc(){::C/*cursor*/ //namespace ns {void gfunc(){::C/*cursor*/
public void testTypes_GlobalQualification() throws Exception { public void testTypes_GlobalQualification() throws Exception {
final String[] expected= { final String[] expected= { "C1", "C2", "C3" };
"C1", "C2", "C3"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {e/*cursor*/ //void f() {e/*cursor*/
public void testEnums_GlobalScope() throws Exception { public void testEnums_GlobalScope() throws Exception {
final String[] expected= { final String[] expected= { "e11", "e12", "E1" };
"e11", "e12", "E1"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void C3::f() {e/*cursor*/ //void C3::f() {e/*cursor*/
public void testEnums_MethodScope() throws Exception { public void testEnums_MethodScope() throws Exception {
final String[] expected= { final String[] expected= { "e11", "e12", "e21", "e22", "E1", "E2" };
"e11", "e12", "e21", "e22", "E1", "E2"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->C/*cursor*/ //void f() {C3* l1; l1->C/*cursor*/
public void testQualificationForAccess1() throws Exception { public void testQualificationForAccess1() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "C3", "C2", "C1" };
"C3", "C2", "C1"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C2* l1; l1->C/*cursor*/ //void f() {C2* l1; l1->C/*cursor*/
public void testQualificationForAccess2() throws Exception { public void testQualificationForAccess2() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "C2", "C1" };
"C2", "C1"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->C3::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->C3::fMySelf->iam/*cursor*/
public void testQualifiedAccess1() throws Exception { public void testQualifiedAccess1() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "iam3(void)", "iam2(void)", "iam1(void)" };
"iam3(void)", "iam2(void)", "iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->C2::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->C2::fMySelf->iam/*cursor*/
public void testQualifiedAccess2() throws Exception { public void testQualifiedAccess2() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "iam2(void)", "iam1(void)" };
"iam2(void)", "iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->C1::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->C1::fMySelf->iam/*cursor*/
public void testQualifiedAccess3() throws Exception { public void testQualifiedAccess3() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->T3::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->T3::fMySelf->iam/*cursor*/
public void testQualifiedAccess_TypedefAsQualifier1() throws Exception { public void testQualifiedAccess_TypedefAsQualifier1() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "iam3(void)", "iam2(void)", "iam1(void)" };
"iam3(void)", "iam2(void)", "iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->T2::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->T2::fMySelf->iam/*cursor*/
public void testQualifiedAccess_TypedefAsQualifier2() throws Exception { public void testQualifiedAccess_TypedefAsQualifier2() throws Exception {
// TLETODO ordering is significant here (currently ignored) // TLETODO ordering is significant here (currently ignored)
final String[] expected= { final String[] expected= { "iam2(void)", "iam1(void)" };
"iam2(void)", "iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C3* l1; l1->T1::fMySelf->iam/*cursor*/ //void f() {C3* l1; l1->T1::fMySelf->iam/*cursor*/
public void testQualifiedAccess_TypedefAsQualifier3() throws Exception { public void testQualifiedAccess_TypedefAsQualifier3() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1().iam/*cursor*/ //void f() {C1().iam/*cursor*/
public void testTemporaryObject() throws Exception { public void testTemporaryObject() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1 c; (&c)->iam/*cursor*/ //void f() {C1 c; (&c)->iam/*cursor*/
public void testAddressOf() throws Exception { public void testAddressOf() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; (*c).iam/*cursor*/ //void f() {C1* c; (*c).iam/*cursor*/
public void testDereferencingOperator1() throws Exception { public void testDereferencingOperator1() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1** c; (**c).iam/*cursor*/ //void f() {C1** c; (**c).iam/*cursor*/
public void testDereferencingOperator2() throws Exception { public void testDereferencingOperator2() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1** c; (*c)->iam/*cursor*/ //void f() {C1** c; (*c)->iam/*cursor*/
public void testDereferencingOperator3() throws Exception { public void testDereferencingOperator3() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; c[0].iam/*cursor*/ //void f() {C1* c; c[0].iam/*cursor*/
public void testArrayAccessOperator1() throws Exception { public void testArrayAccessOperator1() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1** c; c[0][1].iam/*cursor*/ //void f() {C1** c; c[0][1].iam/*cursor*/
public void testArrayAccessOperator2() throws Exception { public void testArrayAccessOperator2() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1** c; c[0]->iam/*cursor*/ //void f() {C1** c; c[0]->iam/*cursor*/
public void testArrayAccessOperator3() throws Exception { public void testArrayAccessOperator3() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; (&c[0])->iam/*cursor*/ //void f() {C1* c; (&c[0])->iam/*cursor*/
public void testArrayAccessOperator4() throws Exception { public void testArrayAccessOperator4() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {void* c; ((C1*)c)->iam/*cursor*/ //void f() {void* c; ((C1*)c)->iam/*cursor*/
public void testCasts1() throws Exception { public void testCasts1() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void g(int a) {}; void f() {void* c; g(((C1*)c)->iam/*cursor*/ //void g(int a) {}; void f() {void* c; g(((C1*)c)->iam/*cursor*/
public void testCasts2() throws Exception { public void testCasts2() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; c++->iam/*cursor*/ //void f() {C1* c; c++->iam/*cursor*/
public void testPointerArithmetic1() throws Exception { public void testPointerArithmetic1() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; (*++c).iam/*cursor*/ //void f() {C1* c; (*++c).iam/*cursor*/
public void testPointerArithmetic2() throws Exception { public void testPointerArithmetic2() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1* c; c--->iam/*cursor*/ //void f() {C1* c; c--->iam/*cursor*/
public void testPointerArithmetic3() throws Exception { public void testPointerArithmetic3() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1 c; (&c+1)->iam/*cursor*/ //void f() {C1 c; (&c+1)->iam/*cursor*/
public void testPointerArithmetic4() throws Exception { public void testPointerArithmetic4() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {C1 c; (&c-1)->iam/*cursor*/ //void f() {C1 c; (&c-1)->iam/*cursor*/
public void testPointerArithmetic5() throws Exception { public void testPointerArithmetic5() throws Exception {
final String[] expected= { final String[] expected= { "iam1(void)" };
"iam1(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void f() {int localVar=0; if (*cond && somefunc(&local/*cursor*/ //void f() {int localVar=0; if (*cond && somefunc(&local/*cursor*/
public void testNestedCalls() throws Exception { public void testNestedCalls() throws Exception {
final String[] expected= { final String[] expected= { "localVar" };
"localVar"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//int a[] = {1,2}; void f(int _0306_b) {_0306_b/*cursor*/ //int a[] = {1,2}; void f(int _0306_b) {_0306_b/*cursor*/
public void testCuttingInput1() throws Exception { public void testCuttingInput1() throws Exception {
final String[] expected= { final String[] expected= { "_0306_b" };
"_0306_b"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//int a[] = {1,2}; void f(int b) {int _0306_b[] = {2,3}; _0306_b/*cursor*/ //int a[] = {1,2}; void f(int b) {int _0306_b[] = {2,3}; _0306_b/*cursor*/
public void testCuttingInput2() throws Exception { public void testCuttingInput2() throws Exception {
final String[] expected= { final String[] expected= { "_0306_b" };
"_0306_b"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//enum EnumType function() {int _031209_v; _031209/*cursor*/ //enum EnumType function() {int _031209_v; _031209/*cursor*/
public void testDisturbingMacros() throws Exception { public void testDisturbingMacros() throws Exception {
final String[] expected= { final String[] expected= { "_031209_v" };
"_031209_v"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//namespace ns {void x() {NSCO/*cursor*/ //namespace ns {void x() {NSCO/*cursor*/
public void testAccessToNamespaceFromClassMember1() throws Exception { public void testAccessToNamespaceFromClassMember1() throws Exception {
final String[] expected= { final String[] expected= { "NSCONST" };
"NSCONST"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void ns::CNS::mcns(){NSCO/*cursor*/ //void ns::CNS::mcns(){NSCO/*cursor*/
public void testAccessToNamespaceFromClassMember2() throws Exception { public void testAccessToNamespaceFromClassMember2() throws Exception {
final String[] expected= { final String[] expected= { "NSCONST" };
"NSCONST"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
@ -704,60 +634,46 @@ public class CompletionTests extends AbstractContentAssistTest {
//# d/*cursor*/ //# d/*cursor*/
public void testCompletePreprocessorDirective2() throws Exception { public void testCompletePreprocessorDirective2() throws Exception {
final String[] expected= { final String[] expected= { "define " };
"define "
};
assertCompletionResults(fCursorOffset, expected, assertCompletionResults(fCursorOffset, expected,
AbstractContentAssistTest.COMPARE_REP_STRINGS); AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
//# if d/*cursor*/ //# if d/*cursor*/
public void testCompletePreprocessorDirective3() throws Exception { public void testCompletePreprocessorDirective3() throws Exception {
final String[] expected= { final String[] expected= { "defined" };
"defined"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void gfunc(){TClass<int> t(0); t.a/*cursor*/ //void gfunc(){TClass<int> t(0); t.a/*cursor*/
public void testTemplateClassMethod() throws Exception { public void testTemplateClassMethod() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172436 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172436
final String[] expected= { final String[] expected= { "add(int)" };
"add(int)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void gfunc(){C3 c3; c3.t/*cursor*/ //void gfunc(){C3 c3; c3.t/*cursor*/
public void testTemplateMethod() throws Exception { public void testTemplateMethod() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172436 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172436
final String[] expected= { final String[] expected= { "tConvert(void)" };
"tConvert(void)"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//using namespace ns;void gfunc(){NSC/*cursor*/ //using namespace ns;void gfunc(){NSC/*cursor*/
public void testUsingDirective() throws Exception { public void testUsingDirective() throws Exception {
final String[] expected= { final String[] expected= { "NSCONST" };
"NSCONST"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
//void gfunc(){n/*cursor*/ //void gfunc(){n/*cursor*/
public void testAutoColons() throws Exception { public void testAutoColons() throws Exception {
final String[] expected= { final String[] expected= { "ns::" };
"ns::"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
//using namespace n/*cursor*/ //using namespace n/*cursor*/
public void testAutoColons2() throws Exception { public void testAutoColons2() throws Exception {
final String[] expected= { final String[] expected= { "ns" };
"ns"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -774,9 +690,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// fEditor.doSave(new NullProgressMonitor()); // fEditor.doSave(new NullProgressMonitor());
// EditorTestHelper.joinBackgroundActivities((AbstractTextEditor)fEditor); // EditorTestHelper.joinBackgroundActivities((AbstractTextEditor)fEditor);
final String[] expected= { final String[] expected= { "aNewGlobalVar" };
"aNewGlobalVar"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
} }
@ -784,9 +698,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// Printer::/*cursor*/ // Printer::/*cursor*/
public void testPrivateStaticMember_Bug109480() throws Exception { public void testPrivateStaticMember_Bug109480() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109480 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109480
final String[] expected= { final String[] expected= { "InitPrinter()", "port" };
"InitPrinter()", "port"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -797,9 +709,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// }; // };
public void testForwardMembersInInlineMethods_Bug103857a() throws Exception { public void testForwardMembersInInlineMethods_Bug103857a() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=103857 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=103857
final String[] expected= { final String[] expected= { "x" };
"x"
};
assertMinimumCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertMinimumCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -815,18 +725,14 @@ public class CompletionTests extends AbstractContentAssistTest {
// }; // };
public void testForwardMembersInInlineMethods_Bug103857b() throws Exception { public void testForwardMembersInInlineMethods_Bug103857b() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185652 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185652
final String[] expected= { final String[] expected= { "mem" };
"mem"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
// void Pri/*cursor*/ // void Pri/*cursor*/
public void testMethodDefinitionClassName_Bug190296() throws Exception { public void testMethodDefinitionClassName_Bug190296() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=190296 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=190296
final String[] expected= { final String[] expected= { "Printer::" };
"Printer::"
};
assertMinimumCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertMinimumCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -840,9 +746,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// fun/*cursor*/ // fun/*cursor*/
public void testFunctionWithTypedefToAnonymousType_bug192787() throws Exception { public void testFunctionWithTypedefToAnonymousType_bug192787() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=192787 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=192787
final String[] expected= { final String[] expected= { "func(my_struct s) : void" };
"func(my_struct s) : void"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_DISP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_DISP_STRINGS);
} }
@ -857,7 +761,7 @@ public class CompletionTests extends AbstractContentAssistTest {
"gFunc()", "gTemp" "gFunc()", "gTemp"
}; };
final String[] expected2= { final String[] expected2= {
"gC1", "gC2", "gfC1()", "gfC2()", "gns::" "gC1", "gC2", "gfC1()", "gfC2()", "gns::"
}; };
String disturbContent= readTaggedComment(DISTURB_FILE_NAME); String disturbContent= readTaggedComment(DISTURB_FILE_NAME);
IFile dfile= createFile(fProject, DISTURB_FILE_NAME, disturbContent); IFile dfile= createFile(fProject, DISTURB_FILE_NAME, disturbContent);
@ -939,7 +843,6 @@ public class CompletionTests extends AbstractContentAssistTest {
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
// #ifdef __cplusplus__ // #ifdef __cplusplus__
// extern "C" { // extern "C" {
// #endif // #endif
@ -1004,19 +907,19 @@ public class CompletionTests extends AbstractContentAssistTest {
}; };
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
getDocument().replace(fCursorOffset-1, 1, "sub1/"); getDocument().replace(fCursorOffset - 1, 1, "sub1/");
expected= new String[] { expected= new String[] {
"\"sub1/inc11.h" "\"sub1/inc11.h"
}; };
assertCompletionResults(fCursorOffset+=4, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset += 4, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
// bug 278967 // bug 278967
getDocument().replace(fCursorOffset-5, 5, "../"); getDocument().replace(fCursorOffset - 5, 5, "../");
expected= new String[] { expected= new String[] {
"\"../h1/", "\"../h1/",
"\"../h2/", "\"../h2/",
}; };
assertCompletionResults(fCursorOffset-=2, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset -= 2, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} finally { } finally {
deleteDir(tempDir); deleteDir(tempDir);
} }
@ -1055,20 +958,15 @@ public class CompletionTests extends AbstractContentAssistTest {
// int local; // int local;
// switch(loc/*cursor*/ // switch(loc/*cursor*/
public void testSwitchStatement() throws Exception { public void testSwitchStatement() throws Exception {
final String[] expected= { final String[] expected= { "local" };
"local"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
// void test() { // void test() {
// int local; // int local;
// while(loc/*cursor*/ // while(loc/*cursor*/
public void testWhileStatement() throws Exception { public void testWhileStatement() throws Exception {
final String[] expected= { final String[] expected= { "local" };
"local"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1076,9 +974,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// int local; // int local;
// for(loc/*cursor*/ // for(loc/*cursor*/
public void testForStatement1() throws Exception { public void testForStatement1() throws Exception {
final String[] expected= { final String[] expected= { "local" };
"local"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1086,9 +982,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// int local; // int local;
// for(int i=0;i<loc/*cursor*/ // for(int i=0;i<loc/*cursor*/
public void testForStatement2() throws Exception { public void testForStatement2() throws Exception {
final String[] expected= { final String[] expected= { "local" };
"local"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1096,9 +990,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// int local; // int local;
// for(int i=0;i<local;loc/*cursor*/ // for(int i=0;i<local;loc/*cursor*/
public void testForStatement3() throws Exception { public void testForStatement3() throws Exception {
final String[] expected= { final String[] expected= { "local" };
"local"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1114,7 +1006,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// INIT_PTR(pTh/*cursor*/); // INIT_PTR(pTh/*cursor*/);
// } // }
public void testCompletionInMacroArguments1_Bug200208() throws Exception { public void testCompletionInMacroArguments1_Bug200208() throws Exception {
final String[] expected= {"pThis"}; final String[] expected= { "pThis" };
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1133,7 +1025,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// COPY_PTR(pThis->pIShell, pThis->pI/*cursor*/) // COPY_PTR(pThis->pIShell, pThis->pI/*cursor*/)
// } // }
public void testCompletionInMacroArguments2_Bug200208() throws Exception { public void testCompletionInMacroArguments2_Bug200208() throws Exception {
final String[] expected= {"pIShell"}; final String[] expected= { "pIShell" };
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1141,7 +1033,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// int alocal, blocal; // int alocal, blocal;
// if (alocal < b/*cursor*/ // if (alocal < b/*cursor*/
public void testCompletionAfterLessThan_Bug229062() throws Exception { public void testCompletionAfterLessThan_Bug229062() throws Exception {
final String[] expected= {"blocal"}; final String[] expected= { "blocal" };
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
} }
@ -1152,7 +1044,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// } MYSTRUCT_TYPE; // } MYSTRUCT_TYPE;
// static const MYSTRUCT_TYPE myArrayOfStructs[] = {{enum/*cursor*/ // static const MYSTRUCT_TYPE myArrayOfStructs[] = {{enum/*cursor*/
public void testCompletionInInitializerList_Bug230389() throws Exception { public void testCompletionInInitializerList_Bug230389() throws Exception {
final String[] expected= {"enum0", "enum1", "enum2"}; final String[] expected= { "enum0", "enum1", "enum2" };
assertCompletionResults(expected); assertCompletionResults(expected);
} }
@ -1160,19 +1052,19 @@ public class CompletionTests extends AbstractContentAssistTest {
// C2 c2; // C2 c2;
// c2(1)->iam/*cursor*/ // c2(1)->iam/*cursor*/
public void testUserdefinedCallOperator_Bug231277() throws Exception { public void testUserdefinedCallOperator_Bug231277() throws Exception {
final String[] expected= {"iam1()"}; final String[] expected= { "iam1()" };
assertCompletionResults(expected); assertCompletionResults(expected);
} }
// void test() {struct s206450 x; x./*cursor*/ // void test() {struct s206450 x; x./*cursor*/
public void testNestedAnonymousStructs_Bug206450() throws Exception { public void testNestedAnonymousStructs_Bug206450() throws Exception {
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b", "s206450"}; final String[] expected= { "a1", "a2", "u1", "u2", "a4", "b", "s206450" };
assertCompletionResults(expected); assertCompletionResults(expected);
} }
// void test() {_f204758/*cursor*/ // void test() {_f204758/*cursor*/
public void testTypedefToAnonymous_Bug204758() throws Exception { public void testTypedefToAnonymous_Bug204758() throws Exception {
final String[] expected= {"_f204758(_e204758 x) : void"}; final String[] expected= { "_f204758(_e204758 x) : void" };
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS); assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
} }
@ -1185,7 +1077,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// } // }
// } // }
public void testContentAssistWithBraceInMacro_Bug257915() throws Exception { public void testContentAssistWithBraceInMacro_Bug257915() throws Exception {
final String[] expected= {"var : float"}; final String[] expected= { "var : float" };
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS); assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
} }
@ -1196,7 +1088,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// X::T/*cursor*/ // content assist does not propose TInt // X::T/*cursor*/ // content assist does not propose TInt
// } // }
public void testNestedTypesInQualifiedNames_Bug255898() throws Exception { public void testNestedTypesInQualifiedNames_Bug255898() throws Exception {
final String[] expected= {"TInt"}; final String[] expected= { "TInt" };
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS); assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
} }
@ -1212,7 +1104,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// } // }
//}; //};
public void testContentAssistInDeferredClassInstance_Bug194592() throws Exception { public void testContentAssistInDeferredClassInstance_Bug194592() throws Exception {
final String[] expected= {"add()"}; final String[] expected= { "add()" };
assertCompletionResults(fCursorOffset, expected, COMPARE_REP_STRINGS); assertCompletionResults(fCursorOffset, expected, COMPARE_REP_STRINGS);
} }
@ -1236,13 +1128,13 @@ public class CompletionTests extends AbstractContentAssistTest {
// InitializerListTest() : /*cursor*/ // InitializerListTest() : /*cursor*/
//}; //};
public void testConstructorInitializerList_EmptyInput_Bug266586() throws Exception { public void testConstructorInitializerList_EmptyInput_Bug266586() throws Exception {
final String[] expected= {"mOne", "Base", final String[] expected= { "mOne", "Base",
"Base(int)", "Base(const Base<Helper> &)", "Helper", "Base(int)", "Base(const Base<Helper> &)", "Helper",
"Helper(void)", "Helper(const Helper &)", "_A_331056", "_B_331056", "Helper(void)", "Helper(const Helper &)", "_A_331056", "_B_331056",
// Namespaces must be offered as well. In order for this code // Namespaces must be offered as well. In order for this code
// to compile with gcc (e.g. 4.1.2), you need to write // to compile with gcc (e.g. 4.1.2), you need to write
// ::ns::Base<Helper>() instead of just Base<Helper>(). // ::ns::Base<Helper>() instead of just Base<Helper>().
"ns"}; "ns" };
assertCompletionResults(fCursorOffset, expected, COMPARE_ID_STRINGS); assertCompletionResults(fCursorOffset, expected, COMPARE_ID_STRINGS);
} }
@ -1400,5 +1292,4 @@ public class CompletionTests extends AbstractContentAssistTest {
final String[] expected = { "Cat", "meow(void)" }; final String[] expected = { "Cat", "meow(void)" };
assertContentAssistResults(fCursorOffset, expected, true, COMPARE_ID_STRINGS); assertContentAssistResults(fCursorOffset, expected, true, COMPARE_ID_STRINGS);
} }
} }