1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 283258.

This commit is contained in:
Sergey Prigogin 2009-07-12 23:19:44 +00:00
parent 7fb944a1df
commit 6a9abf764d
3 changed files with 25 additions and 26 deletions

View file

@ -88,7 +88,7 @@ public class CIndenterTest extends BaseUITestCase {
//foo(arg, //foo(arg,
// "string"); // "string");
public void testIndentationOfStringLiteralAsLastArgument1_Bug192412() throws Exception { public void testStringLiteralAsLastArgument_Bug192412_1() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -97,7 +97,7 @@ public class CIndenterTest extends BaseUITestCase {
//a::foo(arg, //a::foo(arg,
// "string"); // "string");
public void testIndentationOfStringLiteralAsLastArgument2_Bug192412() throws Exception { public void testStringLiteralAsLastArgument_Bug192412_2() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -106,7 +106,7 @@ public class CIndenterTest extends BaseUITestCase {
//a::foo(arg, //a::foo(arg,
// "string"); // "string");
public void testIndentationOfStringLiteralAsLastArgument3_Bug192412() throws Exception { public void testStringLiteralAsLastArgument_Bug192412_3() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -117,7 +117,7 @@ public class CIndenterTest extends BaseUITestCase {
//if (1) //if (1)
// foo->bar(); // foo->bar();
//dontIndent(); //dontIndent();
public void testIndentationAfterArrowOperator_Bug192412() throws Exception { public void testIndentationAfterArrowOperator_Bug192412_4() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -128,7 +128,7 @@ public class CIndenterTest extends BaseUITestCase {
//if (1) //if (1)
// foo>>bar; // foo>>bar;
//dontIndent(); //dontIndent();
public void testIndentationAfterShiftRight_Bug192412() throws Exception { public void testIndentationAfterShiftRight_Bug192412_5() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -139,7 +139,7 @@ public class CIndenterTest extends BaseUITestCase {
//if (1) //if (1)
// foo >= bar(); // foo >= bar();
//dontIndent(); //dontIndent();
public void testIndentationAfterGreaterOrEquals_Bug192412() throws Exception { public void testIndentationAfterGreaterOrEquals_Bug192412_6() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -152,7 +152,7 @@ public class CIndenterTest extends BaseUITestCase {
// const BinFileParser::Exception& exp) // const BinFileParser::Exception& exp)
//{ //{
//} //}
public void testIndentationOfOperatorMethodBody_Bug192412_1() throws Exception { public void testOperatorMethodBody_Bug192412_7() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -165,7 +165,7 @@ public class CIndenterTest extends BaseUITestCase {
// const BinFileParser::Exception& exp) // const BinFileParser::Exception& exp)
//{ //{
//} //}
public void testIndentationOfOperatorMethodBody_Bug192412_2() throws Exception { public void testOperatorMethodBody_Bug192412_8() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT, DefaultCodeFormatterConstants.createAlignmentValue(false, DefaultCodeFormatterConstants.WRAP_COMPACT,
@ -264,7 +264,7 @@ public class CIndenterTest extends BaseUITestCase {
// int f2 : 1; // int f2 : 1;
// int f3 : 1; // int f3 : 1;
//} //}
public void testIndentationOfBitFields_Bug193298() throws Exception { public void testBitFields_Bug193298() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -281,7 +281,7 @@ public class CIndenterTest extends BaseUITestCase {
// { // {
// } // }
//}; //};
public void testIndentationOfConstructorBody_Bug194586() throws Exception { public void testConstructorBody_Bug194586() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -300,7 +300,7 @@ public class CIndenterTest extends BaseUITestCase {
// { // {
// } // }
//}; //};
public void testIndentationOfConstructorBodyWithThrow_Bug194586() throws Exception { public void testConstructorBodyWithThrow_Bug194586() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -319,7 +319,7 @@ public class CIndenterTest extends BaseUITestCase {
// { // {
// } // }
//}; //};
public void testIndentationOfConstructorBodyWithInitializer_Bug194586() throws Exception { public void testConstructorBodyWithInitializer_Bug194586() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -344,7 +344,7 @@ public class CIndenterTest extends BaseUITestCase {
// } // }
// } // }
//} //}
public void testIndentationOfCaseBlockAfterCharLiteral_Bug194710() throws Exception { public void testCaseBlockAfterCharLiteral_Bug194710() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -359,7 +359,7 @@ public class CIndenterTest extends BaseUITestCase {
// 1, // 1,
// 2 // 2
//}; //};
public void testIndentationOfInitializerLists_Bug194585() throws Exception { public void testInitializerLists_Bug194585() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -390,7 +390,7 @@ public class CIndenterTest extends BaseUITestCase {
// { 1,2,3 } // { 1,2,3 }
// } // }
//}; //};
public void testIndentationOfNestedInitializerLists_Bug194585() throws Exception { public void testNestedInitializerLists_Bug194585() throws Exception {
assertIndenterResult(); assertIndenterResult();
} }
@ -466,7 +466,7 @@ public class CIndenterTest extends BaseUITestCase {
//union DisUnion //union DisUnion
// { // {
// }; // };
public void testIndentedClassIndentation_Bug210417() throws Exception { public void testIndentedClass_Bug210417() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED); DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult(); assertIndenterResult();
@ -481,7 +481,7 @@ public class CIndenterTest extends BaseUITestCase {
//class MyClass : public Base //class MyClass : public Base
// { // {
// }; // };
public void testIndentedClassIndentation_Bug210417_2() throws Exception { public void testIndentedClass_Bug210417_2() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED); DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult(); assertIndenterResult();
@ -496,7 +496,7 @@ public class CIndenterTest extends BaseUITestCase {
//class MyClass : public Base, public OtherBase //class MyClass : public Base, public OtherBase
// { // {
// }; // };
public void testIndentedClassIndentation_Bug210417_3() throws Exception { public void testIndentedClass_Bug210417_3() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED); DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult(); assertIndenterResult();
@ -511,7 +511,7 @@ public class CIndenterTest extends BaseUITestCase {
//class MyClass : public Base, public OtherBase //class MyClass : public Base, public OtherBase
// { // {
// }; // };
public void testIndentedClassIndentation_Bug210417_4() throws Exception { public void testIndentedClass_Bug210417_4() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED); DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult(); assertIndenterResult();
@ -663,7 +663,7 @@ public class CIndenterTest extends BaseUITestCase {
//public: //public:
// A(); // A();
// }; // };
public void testWhiteSmithsAccessSpecifierIndentation1_Bug204575() throws Exception { public void testWhiteSmithsAccessSpecifier_Bug204575_1() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.FALSE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.FALSE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.TRUE);
@ -681,7 +681,7 @@ public class CIndenterTest extends BaseUITestCase {
// public: // public:
// A(); // A();
// }; // };
public void testWhiteSmithsAccessSpecifierIndentation2_Bug204575() throws Exception { public void testWhiteSmithsAccessSpecifier_Bug204575_2() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.TRUE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.FALSE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.FALSE);
@ -699,7 +699,7 @@ public class CIndenterTest extends BaseUITestCase {
// public: // public:
// A(); // A();
// }; // };
public void testWhiteSmithsAccessSpecifierIndentation3_Bug204575() throws Exception { public void testWhiteSmithsAccessSpecifier_Bug204575_3() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_ACCESS_SPECIFIER_COMPARE_TO_TYPE_HEADER, DefaultCodeFormatterConstants.TRUE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ACCESS_SPECIFIER, DefaultCodeFormatterConstants.TRUE);
@ -727,7 +727,7 @@ public class CIndenterTest extends BaseUITestCase {
// doOther(); // doOther();
// } // }
// } // }
public void testWhiteSmithsSwitchIndentation1() throws Exception { public void testWhiteSmithsSwitch1() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, DefaultCodeFormatterConstants.TRUE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, DefaultCodeFormatterConstants.FALSE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, DefaultCodeFormatterConstants.FALSE);
@ -756,7 +756,7 @@ public class CIndenterTest extends BaseUITestCase {
// doOther(); // doOther();
// } // }
// } // }
public void testWhiteSmithsSwitchIndentation2() throws Exception { public void testWhiteSmithsSwitch2() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, DefaultCodeFormatterConstants.FALSE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, DefaultCodeFormatterConstants.FALSE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, DefaultCodeFormatterConstants.TRUE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, DefaultCodeFormatterConstants.TRUE);

View file

@ -239,7 +239,6 @@ public class CAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
c.offset = lineOffset; c.offset = lineOffset;
} }
} }
} catch (BadLocationException e) { } catch (BadLocationException e) {
CUIPlugin.log(e); CUIPlugin.log(e);
} }

View file

@ -842,7 +842,7 @@ public final class CIndenter {
break; break;
case Symbols.TokenRBRACE: // closing braces get unindented case Symbols.TokenRBRACE: // closing braces get unindented
if (isFirstTokenOnLine) if (isFirstTokenOnLine || prevToken != Symbols.TokenLBRACE)
matchBrace= true; matchBrace= true;
break; break;