mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Consistent formatting of assignment expressions and equals initializers.
This commit is contained in:
parent
cd3776c4f6
commit
1b637c4f8a
2 changed files with 89 additions and 61 deletions
|
@ -2221,6 +2221,16 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
// operand 1
|
// operand 1
|
||||||
op1.accept(this);
|
op1.accept(this);
|
||||||
|
|
||||||
|
// operator
|
||||||
|
final int nextToken= peekNextToken();
|
||||||
|
// in case of C++ alternative operators, like 'and', 'not', etc. a space
|
||||||
|
boolean forceSpace= Character.isJavaIdentifierStart(peekNextChar());
|
||||||
|
|
||||||
|
scribe.printNextToken(nextToken, forceSpace || preferences.insert_space_before_assignment_operator);
|
||||||
|
if (forceSpace || preferences.insert_space_after_assignment_operator) {
|
||||||
|
scribe.space();
|
||||||
|
}
|
||||||
|
|
||||||
Alignment expressionAlignment= scribe.createAlignment(
|
Alignment expressionAlignment= scribe.createAlignment(
|
||||||
"assignmentExpression", //$NON-NLS-1$
|
"assignmentExpression", //$NON-NLS-1$
|
||||||
preferences.alignment_for_assignment,
|
preferences.alignment_for_assignment,
|
||||||
|
@ -2233,16 +2243,6 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
try {
|
try {
|
||||||
scribe.alignFragment(expressionAlignment, 0);
|
scribe.alignFragment(expressionAlignment, 0);
|
||||||
|
|
||||||
// operator
|
|
||||||
final int nextToken= peekNextToken();
|
|
||||||
// in case of C++ alternative operators, like 'and', 'not', etc. a space
|
|
||||||
boolean forceSpace= Character.isJavaIdentifierStart(peekNextChar());
|
|
||||||
|
|
||||||
scribe.printNextToken(nextToken, forceSpace || preferences.insert_space_before_assignment_operator);
|
|
||||||
if (forceSpace || preferences.insert_space_after_assignment_operator) {
|
|
||||||
scribe.space();
|
|
||||||
}
|
|
||||||
|
|
||||||
// operand 2
|
// operand 2
|
||||||
final IASTExpression op2= node.getOperand2();
|
final IASTExpression op2= node.getOperand2();
|
||||||
op2.accept(this);
|
op2.accept(this);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.text;
|
package org.eclipse.cdt.ui.tests.text;
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@ import org.eclipse.cdt.internal.formatter.align.Alignment;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public class CodeFormatterTest extends BaseUITestCase {
|
public class CodeFormatterTest extends BaseUITestCase {
|
||||||
|
|
||||||
private Map<String, Object> fOptions;
|
private Map<String, Object> fOptions;
|
||||||
private Map<String, String> fDefaultOptions;
|
private Map<String, String> fDefaultOptions;
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
edit.apply(document);
|
edit.apply(document);
|
||||||
assertEquals(expected, document.get());
|
assertEquals(expected, document.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
//void foo(int arg);
|
//void foo(int arg);
|
||||||
//void foo(int arg){}
|
//void foo(int arg){}
|
||||||
|
|
||||||
//void foo (int arg);
|
//void foo (int arg);
|
||||||
//void foo (int arg) {
|
//void foo (int arg) {
|
||||||
//}
|
//}
|
||||||
|
@ -132,12 +132,12 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testIndentConfusionByCastExpression_Bug191021() throws Exception {
|
public void testIndentConfusionByCastExpression_Bug191021() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//int
|
//int
|
||||||
//var;
|
//var;
|
||||||
//int*
|
//int*
|
||||||
//pvar;
|
//pvar;
|
||||||
|
|
||||||
//int var;
|
//int var;
|
||||||
//int* pvar;
|
//int* pvar;
|
||||||
public void testSpaceBetweenTypeAndIdentifier_Bug194603() throws Exception {
|
public void testSpaceBetweenTypeAndIdentifier_Bug194603() throws Exception {
|
||||||
|
@ -145,7 +145,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int a = sizeof( int) ;
|
//int a = sizeof( int) ;
|
||||||
|
|
||||||
//int a = sizeof(int);
|
//int a = sizeof(int);
|
||||||
public void testSizeofExpression_Bug195246() throws Exception {
|
public void testSizeofExpression_Bug195246() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
|
@ -153,7 +153,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
|
|
||||||
//int x;
|
//int x;
|
||||||
//int a = sizeof x ;
|
//int a = sizeof x ;
|
||||||
|
|
||||||
//int x;
|
//int x;
|
||||||
//int a = sizeof x;
|
//int a = sizeof x;
|
||||||
public void testSizeofExpression_Bug201330() throws Exception {
|
public void testSizeofExpression_Bug201330() throws Exception {
|
||||||
|
@ -257,16 +257,16 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int verylooooooooooooooooooooooooooooooooooongname = 0000000000000000000000000000000;
|
//int verylooooooooooooooooooooooooooooooooooongname = 0000000000000000000000000000000;
|
||||||
|
|
||||||
//int verylooooooooooooooooooooooooooooooooooongname =
|
//int verylooooooooooooooooooooooooooooooooooongname =
|
||||||
// 0000000000000000000000000000000;
|
// 0000000000000000000000000000000;
|
||||||
public void testLineWrappingOfInitializerExpression_Bug200961() throws Exception {
|
public void testLineWrappingOfInitializerExpression_Bug200961() throws Exception {
|
||||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, Integer.toString(Alignment.M_COMPACT_SPLIT));
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, Integer.toString(Alignment.M_COMPACT_SPLIT));
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName() throw(float);
|
//void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName() throw(float);
|
||||||
|
|
||||||
//void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName()
|
//void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName()
|
||||||
// throw (float);
|
// throw (float);
|
||||||
public void testLineWrappingOfThrowSpecification_Bug200959() throws Exception {
|
public void testLineWrappingOfThrowSpecification_Bug200959() throws Exception {
|
||||||
|
@ -277,7 +277,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
//public:
|
//public:
|
||||||
//A();
|
//A();
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//class A
|
//class A
|
||||||
// {
|
// {
|
||||||
//public:
|
//public:
|
||||||
|
@ -294,7 +294,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
//public:
|
//public:
|
||||||
//A();
|
//A();
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//class A
|
//class A
|
||||||
// {
|
// {
|
||||||
// public:
|
// public:
|
||||||
|
@ -311,7 +311,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
//public:
|
//public:
|
||||||
//A();
|
//A();
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//class A
|
//class A
|
||||||
// {
|
// {
|
||||||
// public:
|
// public:
|
||||||
|
@ -373,7 +373,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int main(int argc, char const int * argv[]) { try { for (int i = 1; i < argc; ++i) { } return 0; } catch (float e) { return 1; } catch (...) { return 2; } }
|
//int main(int argc, char const int * argv[]) { try { for (int i = 1; i < argc; ++i) { } return 0; } catch (float e) { return 1; } catch (...) { return 2; } }
|
||||||
|
|
||||||
//int main(int argc, char const int * argv[]) {
|
//int main(int argc, char const int * argv[]) {
|
||||||
// try {
|
// try {
|
||||||
// for (int i = 1; i < argc; ++i) {
|
// for (int i = 1; i < argc; ++i) {
|
||||||
|
@ -401,7 +401,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testMacroAsInitializer_Bug214354() throws Exception {
|
public void testMacroAsInitializer_Bug214354() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define break_start(); { int foo;
|
//#define break_start(); { int foo;
|
||||||
//#define break_end(); foo = 0; }
|
//#define break_end(); foo = 0; }
|
||||||
//
|
//
|
||||||
|
@ -419,7 +419,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
// if(b == a)
|
// if(b == a)
|
||||||
// indentation_remains();
|
// indentation_remains();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//#define break_start(); { int foo;
|
//#define break_start(); { int foo;
|
||||||
//#define break_end(); foo = 0; }
|
//#define break_end(); foo = 0; }
|
||||||
//
|
//
|
||||||
|
@ -440,18 +440,18 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testBracesInMacros_Bug217435() throws Exception {
|
public void testBracesInMacros_Bug217435() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//int a=1+2;
|
//int a=1+2;
|
||||||
//int b= - a;
|
//int b= - a;
|
||||||
//int c =b ++/-- b;
|
//int c =b ++/-- b;
|
||||||
|
|
||||||
//int a = 1 + 2;
|
//int a = 1 + 2;
|
||||||
//int b = -a;
|
//int b = -a;
|
||||||
//int c = b++ / --b;
|
//int c = b++ / --b;
|
||||||
public void testWhitespaceSurroundingOperators() throws Exception {
|
public void testWhitespaceSurroundingOperators() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {
|
//void f() {
|
||||||
//int *px= :: new int( 0 );
|
//int *px= :: new int( 0 );
|
||||||
//int* py [] = new int [5 ] (0, 1,2,3, 4);
|
//int* py [] = new int [5 ] (0, 1,2,3, 4);
|
||||||
|
@ -542,7 +542,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//class Example: public FooClass, public virtual BarClass {};
|
//class Example: public FooClass, public virtual BarClass {};
|
||||||
|
|
||||||
//class Example:
|
//class Example:
|
||||||
// public FooClass,
|
// public FooClass,
|
||||||
// public virtual BarClass {
|
// public virtual BarClass {
|
||||||
|
@ -554,7 +554,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//class Example: public FooClass, public virtual BarClass {};
|
//class Example: public FooClass, public virtual BarClass {};
|
||||||
|
|
||||||
//class Example: public FooClass,
|
//class Example: public FooClass,
|
||||||
// public virtual BarClass {
|
// public virtual BarClass {
|
||||||
//};
|
//};
|
||||||
|
@ -580,12 +580,40 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//class ClassWithALongName {
|
||||||
|
//public:
|
||||||
|
//ClassWithALongName* methodWithAQuiteLongName();
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//void test() {
|
||||||
|
//ClassWithALongName* variable_with_a_long_name = variable_with_a_long_name->methodWithAQuiteLongName();
|
||||||
|
//variable_with_a_long_name = variable_with_a_long_name->methodWithAQuiteLongName();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//class ClassWithALongName {
|
||||||
|
//public:
|
||||||
|
// ClassWithALongName* methodWithAQuiteLongName();
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//void test() {
|
||||||
|
// ClassWithALongName* variable_with_a_long_name =
|
||||||
|
// variable_with_a_long_name->methodWithAQuiteLongName();
|
||||||
|
// variable_with_a_long_name =
|
||||||
|
// variable_with_a_long_name->methodWithAQuiteLongName();
|
||||||
|
//}
|
||||||
|
public void testAssignment() throws Exception {
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT,
|
||||||
|
Integer.toString(Alignment.M_COMPACT_SPLIT));
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
//int foo(){try{}catch(...){}}
|
//int foo(){try{}catch(...){}}
|
||||||
//float* bar();
|
//float* bar();
|
||||||
//template<typename _CharT, typename _Traits>class basic_ios : public ios_base{public:
|
//template<typename _CharT, typename _Traits>class basic_ios : public ios_base{public:
|
||||||
// // Types:
|
// // Types:
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//int
|
//int
|
||||||
//foo()
|
//foo()
|
||||||
//{
|
//{
|
||||||
|
@ -648,7 +676,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
|
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//enum Tthe3rdtestIds
|
//enum Tthe3rdtestIds
|
||||||
//{
|
//{
|
||||||
//ECommand1 = 0x6001,
|
//ECommand1 = 0x6001,
|
||||||
|
@ -683,7 +711,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() { throw 42; }
|
//void f() { throw 42; }
|
||||||
|
|
||||||
//void f() {
|
//void f() {
|
||||||
// throw 42;
|
// throw 42;
|
||||||
//}
|
//}
|
||||||
|
@ -697,7 +725,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
// // Comment
|
// // Comment
|
||||||
// for(;;);
|
// for(;;);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//struct {
|
//struct {
|
||||||
// int l;
|
// int l;
|
||||||
//} s;
|
//} s;
|
||||||
|
@ -717,7 +745,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
// // Comment
|
// // Comment
|
||||||
// for(;;);
|
// for(;;);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//struct {
|
//struct {
|
||||||
// int e;
|
// int e;
|
||||||
//} s;
|
//} s;
|
||||||
|
@ -737,7 +765,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
// // Comment
|
// // Comment
|
||||||
// for(;;);
|
// for(;;);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//struct {
|
//struct {
|
||||||
// int f;
|
// int f;
|
||||||
//} s;
|
//} s;
|
||||||
|
@ -752,7 +780,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int a = 0, b = 1, c = 2, d = 3;
|
//int a = 0, b = 1, c = 2, d = 3;
|
||||||
|
|
||||||
//int a = 0,b = 1,c = 2,d = 3;
|
//int a = 0,b = 1,c = 2,d = 3;
|
||||||
public void testSpaceAfterCommaInDeclaratorList_Bug234915() throws Exception {
|
public void testSpaceAfterCommaInDeclaratorList_Bug234915() throws Exception {
|
||||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, CCorePlugin.DO_NOT_INSERT);
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, CCorePlugin.DO_NOT_INSERT);
|
||||||
|
@ -760,7 +788,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//int a = 0,b = 1,c = 2,d = 3;
|
//int a = 0,b = 1,c = 2,d = 3;
|
||||||
|
|
||||||
//int a = 0, b = 1, c = 2, d = 3;
|
//int a = 0, b = 1, c = 2, d = 3;
|
||||||
public void testSpaceAfterCommaInDeclaratorList2_Bug234915() throws Exception {
|
public void testSpaceAfterCommaInDeclaratorList2_Bug234915() throws Exception {
|
||||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, CCorePlugin.INSERT);
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, CCorePlugin.INSERT);
|
||||||
|
@ -840,7 +868,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testNestedTemplatedArgument_Bug241058() throws Exception {
|
public void testNestedTemplatedArgument_Bug241058() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define TP_SMALLINT int32_t
|
//#define TP_SMALLINT int32_t
|
||||||
//void foo(const TP_SMALLINT &intVal) { }
|
//void foo(const TP_SMALLINT &intVal) { }
|
||||||
//void bar(const TP_SMALLINT intVal) { }
|
//void bar(const TP_SMALLINT intVal) { }
|
||||||
|
@ -853,7 +881,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testPreserveSpaceInParameterDecl_Bug241967() throws Exception {
|
public void testPreserveSpaceInParameterDecl_Bug241967() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define MY_MACRO int a; \
|
//#define MY_MACRO int a; \
|
||||||
// int b; \
|
// int b; \
|
||||||
// int c();
|
// int c();
|
||||||
|
@ -865,7 +893,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
// asdf();
|
// asdf();
|
||||||
//~asdf();
|
//~asdf();
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//#define MY_MACRO int a; \
|
//#define MY_MACRO int a; \
|
||||||
// int b; \
|
// int b; \
|
||||||
// int c();
|
// int c();
|
||||||
|
@ -884,7 +912,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
//void foo() {
|
//void foo() {
|
||||||
//for(int i=0;i<50;++i){}
|
//for(int i=0;i<50;++i){}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//void foo() {
|
//void foo() {
|
||||||
// for (int i = 0 ; i < 50 ; ++i) {
|
// for (int i = 0 ; i < 50 ; ++i) {
|
||||||
// }
|
// }
|
||||||
|
@ -895,7 +923,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//char *b, * const a;
|
//char *b, * const a;
|
||||||
|
|
||||||
//char *b, * const a;
|
//char *b, * const a;
|
||||||
public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception {
|
public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
|
@ -1139,7 +1167,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testDotStarAndArrowStarOperators_Bug257700() throws Exception {
|
public void testDotStarAndArrowStarOperators_Bug257700() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz1(unsigned char __attribute__((unused)) x, unsigned char __attribute__((unused)) y){;}
|
//void zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz1(unsigned char __attribute__((unused)) x, unsigned char __attribute__((unused)) y){;}
|
||||||
|
|
||||||
//void zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz1(
|
//void zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz1(
|
||||||
|
@ -1150,7 +1178,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void test__attribute__InParameterDecl_Bug206271() throws Exception {
|
public void test__attribute__InParameterDecl_Bug206271() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define assert(e) if(!(e)) printf("Failed assertion")
|
//#define assert(e) if(!(e)) printf("Failed assertion")
|
||||||
//void test(){assert(1 > 0);}
|
//void test(){assert(1 > 0);}
|
||||||
|
|
||||||
|
@ -1184,7 +1212,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testPreserveSpaceBetweenNameAnd__attribute__Bug261967() throws Exception {
|
public void testPreserveSpaceBetweenNameAnd__attribute__Bug261967() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//extern "C" void f(int i, char c, float x);
|
//extern "C" void f(int i, char c, float x);
|
||||||
|
|
||||||
//extern "C" void f(int i, char c, float x);
|
//extern "C" void f(int i, char c, float x);
|
||||||
|
@ -1215,12 +1243,12 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testFormatterProblemsWithTypename_Bug269590() throws Exception {
|
public void testFormatterProblemsWithTypename_Bug269590() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void
|
//void
|
||||||
//foo();
|
//foo();
|
||||||
//int*
|
//int*
|
||||||
//bar();
|
//bar();
|
||||||
|
|
||||||
//void
|
//void
|
||||||
//foo();
|
//foo();
|
||||||
//int*
|
//int*
|
||||||
|
@ -1356,7 +1384,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
|
|
||||||
//#define new new(__FILE__, __LINE__)
|
//#define new new(__FILE__, __LINE__)
|
||||||
//void func() {char* a = new char[10];}
|
//void func() {char* a = new char[10];}
|
||||||
|
|
||||||
//#define new new(__FILE__, __LINE__)
|
//#define new new(__FILE__, __LINE__)
|
||||||
//void func() {
|
//void func() {
|
||||||
// char* a = new char[10];
|
// char* a = new char[10];
|
||||||
|
@ -1367,7 +1395,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
|
|
||||||
//#define MACRO(a) class b : public a
|
//#define MACRO(a) class b : public a
|
||||||
//MACRO(aClass){ int a;};
|
//MACRO(aClass){ int a;};
|
||||||
|
|
||||||
//#define MACRO(a) class b : public a
|
//#define MACRO(a) class b : public a
|
||||||
//MACRO(aClass) {
|
//MACRO(aClass) {
|
||||||
// int a;
|
// int a;
|
||||||
|
@ -1375,12 +1403,12 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
public void testCompositeTypeSpecAsMacro_Bug298592() throws Exception {
|
public void testCompositeTypeSpecAsMacro_Bug298592() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {
|
//void f() {
|
||||||
//w_char* p = L"wide string literal";
|
//w_char* p = L"wide string literal";
|
||||||
//int x = 0;
|
//int x = 0;
|
||||||
//if (x == 0) x = 5;}
|
//if (x == 0) x = 5;}
|
||||||
|
|
||||||
//void f() {
|
//void f() {
|
||||||
// w_char* p = L"wide string literal";
|
// w_char* p = L"wide string literal";
|
||||||
// int x = 0;
|
// int x = 0;
|
||||||
|
@ -1393,13 +1421,13 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
|
|
||||||
//#define INT (int)
|
//#define INT (int)
|
||||||
//int i = INT 1;
|
//int i = INT 1;
|
||||||
|
|
||||||
//#define INT (int)
|
//#define INT (int)
|
||||||
//int i = INT 1;
|
//int i = INT 1;
|
||||||
public void testCastAsMacro_Bug285901() throws Exception {
|
public void testCastAsMacro_Bug285901() throws Exception {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//PARENT_T sample={.a=1,.b={a[2]=1,.b.c=2}};
|
//PARENT_T sample={.a=1,.b={a[2]=1,.b.c=2}};
|
||||||
|
|
||||||
//PARENT_T sample = { .a = 1, .b = { a[2] = 1, .b.c = 2 } };
|
//PARENT_T sample = { .a = 1, .b = { a[2] = 1, .b.c = 2 } };
|
||||||
|
@ -1409,7 +1437,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
||||||
|
|
||||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters,
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters,
|
||||||
// const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label,
|
// const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label,
|
||||||
// double avg, double maxh, double max_dist_double_bond);
|
// double avg, double maxh, double max_dist_double_bond);
|
||||||
|
@ -1441,7 +1469,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
||||||
|
|
||||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom,
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom,
|
||||||
// const vector<letters_t> &letters,
|
// const vector<letters_t> &letters,
|
||||||
// int n_letters, const vector<bond_t> &bond,
|
// int n_letters, const vector<bond_t> &bond,
|
||||||
|
@ -1473,7 +1501,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
//{ 1,2, 3,4 },
|
//{ 1,2, 3,4 },
|
||||||
// {1, 2,3, 4}
|
// {1, 2,3, 4}
|
||||||
// };
|
// };
|
||||||
|
|
||||||
//int table[][] = {
|
//int table[][] = {
|
||||||
// { 1, 2, 3, 4 },
|
// { 1, 2, 3, 4 },
|
||||||
// { 1, 2, 3, 4 },
|
// { 1, 2, 3, 4 },
|
||||||
|
@ -1484,7 +1512,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_JOIN_WRAPPED_LINES, DefaultCodeFormatterConstants.FALSE);
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_JOIN_WRAPPED_LINES, DefaultCodeFormatterConstants.FALSE);
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define X() { }
|
//#define X() { }
|
||||||
//void g() {
|
//void g() {
|
||||||
// X();
|
// X();
|
||||||
|
@ -1506,7 +1534,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_JOIN_WRAPPED_LINES, DefaultCodeFormatterConstants.FALSE);
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_JOIN_WRAPPED_LINES, DefaultCodeFormatterConstants.FALSE);
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void f() {
|
//void f() {
|
||||||
//double confidence = 0.316030 //
|
//double confidence = 0.316030 //
|
||||||
//- 0.016315 * C_Count //
|
//- 0.016315 * C_Count //
|
||||||
|
@ -1527,7 +1555,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
|
Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define m() f()
|
//#define m() f()
|
||||||
//void f() {
|
//void f() {
|
||||||
//if (1) f();
|
//if (1) f();
|
||||||
|
|
Loading…
Add table
Reference in a new issue