Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-26 12:34:46 +0000
committerAnton Leherbauer2008-02-26 12:34:46 +0000
commit8bc306225d38f902620127d102ac74b93b6b846f (patch)
tree73e25b291a9371fd3071d8b054a5420dfeffc49a /core/org.eclipse.cdt.ui.tests
parent3d58d666af3589fce339190affaa39b3138fa3cc (diff)
downloadorg.eclipse.cdt-8bc306225d38f902620127d102ac74b93b6b846f.tar.gz
org.eclipse.cdt-8bc306225d38f902620127d102ac74b93b6b846f.tar.xz
org.eclipse.cdt-8bc306225d38f902620127d102ac74b93b6b846f.zip
Fix for 217918: CDT code formatter problems
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/templates/After.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/templates/Before.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java30
3 files changed, 32 insertions, 6 deletions
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 e82c29c4db3..b3f9156faee 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,7 @@ class Foo {
};
// TEMPLATE_STRUCT
-template<class Key, class Value, class SortAlgorithm=DefaultSort>
+template<class Key, class Value, class SortAlgorithm = DefaultSort>
struct Map {
Key* keys;
Value* values;
@@ -35,7 +35,7 @@ public:
};
// TEMPLATE_UNION
-template<class X, class Y, int size=16>
+template<class X, class Y, int size = 16>
union ArrayOverlay {
public:
X x[size];
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 09696f13e9a..b8370d40698 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
@@ -6,9 +6,7 @@ class T;
class X;
class Y;
class Bar;
-class Foo {
- template<class Bar> void fum(int i);
-};
+class Foo { template<class Bar> void fum(int i); };
// TEMPLATE_STRUCT
template<class Key, class Value, class SortAlgorithm=DefaultSort>
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 11bdeecbfa3..56da77b73ed 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
@@ -280,7 +280,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//template<typename T> class B {
//};
- //template<typename T1, typename T2=B<T1> > class A {
+ //template<typename T1, typename T2 = B<T1> > class A {
//};
public void testNestedTemplateParameters_Bug206801() throws Exception {
assertFormatterResult();
@@ -463,4 +463,32 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult();
}
+ //typedef signed int TInt;
+ //extern void Bar(); // should not have space between parens
+ //
+ //void Foo() // should not have space between parens
+ //{
+ // TInt a(3); // should become TInt a( 3 );
+ // Bar(); // should not have space between parens
+ //}
+
+ //typedef signed int TInt;
+ //extern void Bar(); // should not have space between parens
+ //
+ //void Foo() // should not have space between parens
+ // {
+ // TInt a( 3 ); // should become TInt a( 3 );
+ // Bar(); // should not have space between parens
+ // }
+ public void testSpaceBetweenParen_Bug217918() throws Exception {
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, DefaultCodeFormatterConstants.FALSE);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, CCorePlugin.INSERT);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, CCorePlugin.INSERT);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, CCorePlugin.DO_NOT_INSERT);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, CCorePlugin.INSERT);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, CCorePlugin.INSERT);
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, CCorePlugin.DO_NOT_INSERT);
+ assertFormatterResult();
+ }
}

Back to the top