Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp23
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/Before.cpp6
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp28
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/sample/Before.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp16
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CHeuristicScannerTest.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java78
10 files changed, 129 insertions, 36 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
index 986e6c031db..f6cb5823fd8 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
@@ -4,28 +4,28 @@ struct x {
struct x getX() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=171520
-int bug=sizeof(int);
+int bug = sizeof(int);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=173837
class ABaseClass {
protected:
ABaseClass(int x);
};
-class AClass : public ABaseClass {
+class AClass: public ABaseClass {
AClass(int x) throw(int);
void test1() const throw(int);
void test2() throw();
};
AClass::AClass(int x) throw(int) :
ABaseClass(x) {
- for (int i=0; i < 12; i++) {
+ for (int i = 0; i < 12; i++) {
}
}
// keep space between decl spec and declarator
int main(int argc, char **argv) {
}
// handling of string concat
-char* s1= "this " "is " "one " "string.";
-char* s2= "this " "is "
+char* s1 = "this " "is " "one " "string.";
+char* s2 = "this " "is "
"one " "string.";
// macro definition with line comment
#define ID(x) x // identity
@@ -34,7 +34,7 @@ int main() {
}
// semicolons inside for
void g() {
- for (int i=0; i<10; ++i) {
+ for (int i = 0; i < 10; ++i) {
}
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183220
@@ -43,18 +43,17 @@ void bug183220() {
rtc_s2000_src_pending, rtc_s2000_cr_sync_pending,
rtc_hdw_cr_sync_next, rtc_hdw_current_clock;
int rtc_s2000_clock_source_state, RTC_CLOCK_PLL;
- if (( ( rtc_hdw_cr_sync_next != rtc_hdw_cr_sync )
- || rtc_hdw_cr_resync_enable )&& !rtc_s2000_src_pending
- && !rtc_s2000_cr_sync_pending) {
+ if (((rtc_hdw_cr_sync_next != rtc_hdw_cr_sync) || rtc_hdw_cr_resync_enable)
+ && !rtc_s2000_src_pending && !rtc_s2000_cr_sync_pending) {
if (!identify_hdw_fvr_master() || !rtc_hdw_current_clock->external
- || !rtc_hdw_cr_sync_next ||( ( rtc_hdw_current_clock->external
+ || !rtc_hdw_cr_sync_next || ((rtc_hdw_current_clock->external
&& rtc_hdw_cr_sync_next && rtc_s2000_clock_source_state
- != RTC_CLOCK_PLL ) )) {
+ != RTC_CLOCK_PLL))) {
}
}
}
// declaration with array initializer
-long dummy[]= { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+long dummy[] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/Before.cpp
index 30437af2f4b..70ba3bdacac 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/Before.cpp
@@ -9,16 +9,16 @@ class AClass : public ABaseClass {AClass(int x) throw(int); void test1() const t
AClass::AClass(int x)throw(int):ABaseClass(x){for (int i=0;i < 12;i++) {}}
// keep space between decl spec and declarator
int
-main(int argc, char **argv) {}
+main(int argc,char **argv) {}
// handling of string concat
char* s1= "this " "is " "one ""string.";
char* s2= "this " "is "
"one " "string.";
// macro definition with line comment
#define ID(x) x // identity
-int main() {return ID(0);}
+int main(){return ID(0);}
// semicolons inside for
-void g() {for(int i=0;i<10;++i){}}
+void g(){for(int i=0;i<10;++i){}}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=183220
void bug183220()
{
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
index 1d1714954f9..07d43c21b4d 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
@@ -44,11 +44,11 @@ int foo(int bar) const {
/*
* Line Wrapping
*/
-int array[]= { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1000,
- 2000, 3000, 4000, 5000 };
-int compare(int argument, int otherArgument) {
- return argument+otherArgument > argument*otherArgument+1000000 ? 100000
- +50000 : 200000-30000;
+int array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 1000, 2000, 3000, 4000, 5000 };
+int compare(int argument, int otherArg) {
+ return argument + otherArg > argument * otherArg + 1000000 ? 100000 + 50000
+ : 200000 - 30000;
}
class Other {
static void bar(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6,
@@ -59,3 +59,21 @@ void foo() {
Other::bar(100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000,
900000);
}
+enum EEEE {
+ ONE,
+ TWO,
+ THREE,
+ FOUR,
+ FIVE,
+ SIX,
+ SEVEN = 7,
+ EIGHT,
+ NINE,
+ TEN,
+ HUNDRED,
+ THOUSAND,
+ AMILLION
+};
+template<typename T1, typename T2> class map {
+};
+map<int, int> m;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
index 97138157acc..461ecc0a9cc 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
@@ -7,6 +7,8 @@ class Point {public:Point(double xc, double yc) : x(xc), y(yc) {}double distance
* Line Wrapping
*/
int array[]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1000, 2000, 3000, 4000, 5000};
-int compare(int argument, int otherArgument) {return argument+otherArgument > argument*otherArgument+1000000 ? 100000+50000 : 200000-30000;}
+int compare(int argument, int otherArg) {return argument+otherArg > argument*otherArg+1000000 ? 100000+50000 : 200000-30000;}
class Other {static void bar(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) {}};
void foo() {Other::bar(100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000);}
+enum EEEE{ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN=7,EIGHT,NINE,TEN,HUNDRED,THOUSAND,AMILLION};
+template<typename T1,typename T2> class map {};map<int,int> m;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
index da4d8fe71ee..89ede2db0a6 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
@@ -4,7 +4,7 @@
struct SimpleStruct {
int num;
- char name[ ];
+ char name[];
float floatNum;
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/Before.cpp
index 772cee09500..5a012a8591d 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/Before.cpp
@@ -5,7 +5,7 @@
struct SimpleStruct
{
int num;
- char name[ ];
+ char name [ ];
float floatNum;
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
index 1fcaa2a11cd..e82c29c4db3 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp
@@ -11,7 +11,8 @@ class Foo {
};
// TEMPLATE_STRUCT
-template<class Key, class Value, class SortAlgorithm=DefaultSort> struct Map {
+template<class Key, class Value, class SortAlgorithm=DefaultSort>
+struct Map {
Key* keys;
Value* values;
SortAlgorithm* sortAlgorithm;
@@ -25,7 +26,7 @@ private:
public:
nonVector() {
- head =new T();
+ head = new T();
}
int length() {
return 1;
@@ -34,7 +35,8 @@ public:
};
// TEMPLATE_UNION
-template<class X, class Y, int size=16> union ArrayOverlay {
+template<class X, class Y, int size=16>
+union ArrayOverlay {
public:
X x[size];
Y y[size];
@@ -46,7 +48,8 @@ public:
class TemplateContainer {
// these are in an enclosing class
template<class Bar> void fum(int i);
- template<int> void scrum(void) {
+ template<int>
+ void scrum(void) {
}
;
};
@@ -62,12 +65,11 @@ template<class Bar> void Foo::fum(int i) {
}
// TEMPLATE_VARIABLES
-template <bool threads, int inst> char
+template<bool threads, int inst> char
* default_alloc_template<threads, inst>::S_start_free = 0;
// an instantiation, not a template:
-complex
-<float> cf(0, 0);
+complex<float> cf(0, 0);
//template<class Language, class CharacterSet, class SortAlgorithm<CharacterSet> >
//Dictionary* TheSpellCheckDictionary;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp
index 6873eca767e..09696f13e9a 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp
@@ -25,7 +25,7 @@ template<class T> class nonVector {
private: T* head;
public:
- nonVector() {head =new T();}
+ nonVector() {head=new T();}
int length() {return 1;}
const T& first() const;
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CHeuristicScannerTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CHeuristicScannerTest.java
index f84629e60c1..684ef69fb85 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CHeuristicScannerTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CHeuristicScannerTest.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
@@ -56,7 +56,7 @@ public class CHeuristicScannerTest extends TestCase {
final String indentOnColumn= DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_NO_SPLIT, DefaultCodeFormatterConstants.INDENT_ON_COLUMN);
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, indentOnColumn);
- options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, indentOnColumn);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_INITIALIZER_LIST, indentOnColumn);
options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, "1");
CCorePlugin.setOptions(options);
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
index ebe74289424..11bdeecbfa3 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
@@ -104,7 +104,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// switch (confusefomatter) {
//
// case START_CONFUSION:
- // SomeFunctionCallWithTypecast(( castConfusion_t)myvar1,
+ // SomeFunctionCallWithTypecast((castConfusion_t) myvar1,
// (castNoAdditionalConfusion_t) myvar2);
// break;
//
@@ -171,7 +171,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//void foo() {
// for (;;) {
- // int a=0;
+ // int a = 0;
// switch (a) {
// case 0:
// ++a;
@@ -380,7 +380,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// indentation_remains();
// }
//
- // if (b>a)
+ // if (b > a)
// indentation_vanishes();
//
// break_end();
@@ -391,4 +391,76 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testBracesInMacros_Bug217435() throws Exception {
assertFormatterResult();
}
+
+ //int a=1+2;
+ //int b= - a;
+ //int c =b ++/-- b;
+
+ //int a = 1 + 2;
+ //int b = -a;
+ //int c = b++ / --b;
+ public void testWhitespaceSurroundingOperators() throws Exception {
+ assertFormatterResult();
+ }
+
+ //void f() {
+ //int *px= :: new int( 0 );
+ //int py [] = new int [5 ] (0, 1,2,3, 4);
+ //int *pz[ ] =new ( px)int(0);
+ //delete [] py;
+ //:: delete px;}
+
+ //void f() {
+ // int *px = ::new int(0);
+ // int py[] = new int[5](0, 1, 2, 3, 4);
+ // int *pz[] = new(px) int(0);
+ // delete[] py;
+ // ::delete px;
+ //}
+ public void testNewAndDeleteExpressions() throws Exception {
+ assertFormatterResult();
+ }
+
+ //namespace X=
+ // Y ::
+ // Z ;
+
+ //namespace X = Y::Z;
+ public void testNamespaceAlias() throws Exception {
+ assertFormatterResult();
+ }
+
+ //using
+ // typename:: T
+ //;
+ //using X::
+ // T ;
+
+ //using typename ::T;
+ //using X::T;
+ public void testUsingDeclaration() throws Exception {
+ assertFormatterResult();
+ }
+
+ //using
+ // namespace
+ // X ;
+
+ //using namespace X;
+ public void testUsingDirective() throws Exception {
+ assertFormatterResult();
+ }
+
+ //static void *f(){}
+ //static void * g();
+ //static void* h();
+
+ //static void *f() {
+ //}
+ //static void * g();
+ //static void* h();
+ public void testSpaceBetweenDeclSpecAndDeclarator() throws Exception {
+ assertFormatterResult();
+ }
+
}

Back to the top