Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2011-04-07 21:27:36 +0000
committerSergey Prigogin2011-04-07 21:27:36 +0000
commit8697be076e423cb31ebc4f5aca56e1a0f5415c6f (patch)
treec76867a26efcfff7ed106ef6a6070fef10940f54 /core/org.eclipse.cdt.ui.tests
parent234560eef4a0f696a2515fac41479f6e066545e2 (diff)
downloadorg.eclipse.cdt-8697be076e423cb31ebc4f5aca56e1a0f5415c6f.tar.gz
org.eclipse.cdt-8697be076e423cb31ebc4f5aca56e1a0f5415c6f.tar.xz
org.eclipse.cdt-8697be076e423cb31ebc4f5aca56e1a0f5415c6f.zip
Formatting of chained conditional expressions and streamlining of formatting code.
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java49
1 files changed, 35 insertions, 14 deletions
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 03b146dc723..788dc08c87e 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
@@ -1137,9 +1137,8 @@ public class CodeFormatterTest extends BaseUITestCase {
//int function_with_a_long_name(int, int);
//
//void test() {
- // function_with_a_long_name(function(1000000, 2000000, 3000000, 4000000,
- // 5000000),
- // 6000000);
+ // function_with_a_long_name(
+ // function(1000000, 2000000, 3000000, 4000000, 5000000), 6000000);
//}
public void testFunctionCall_2() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
@@ -2089,21 +2088,43 @@ public class CodeFormatterTest extends BaseUITestCase {
//void test() {
// int variable1 = 1000000 < 2000000 ? 3000000 + 40000000 : 8000000 + 90000000;
- // int variable2 = 1000000 < 2000000 ?
- // 3000000 + 40000000 : 8000000 + 900000000;
- // int variable3 = 1000000 < 2000000 ?
- // 3000000 + 4000000 + 5000000 + 6000000 + 7000000 : 8000000 + 9000000;
- // int variable4 = 1000000 < 2000000 ?
- // 3000000 + 4000000 + 5000000 + 6000000 + 7000000 :
- // 8000000 + 90000000;
- //}
+ // int variable2 =
+ // 1000000 < 2000000 ? 3000000 + 40000000 : 8000000 + 900000000;
+ // int variable3 =
+ // 1000000 < 2000000 ?
+ // 3000000 + 4000000 + 5000000 + 6000000 + 7000000 :
+ // 8000000 + 9000000;
+ // int variable4 =
+ // 1000000 < 2000000 ?
+ // 3000000 + 4000000 + 5000000 + 6000000 + 7000000 :
+ // 8000000 + 90000000;
+ //}
public void testConditionalExpression() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
- fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
- Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
assertFormatterResult();
}
+ //int variable_with_a_long_name, another_variable_with_a_long_name;
+ //
+ //int variable = variable_with_a_long_name < another_variable_with_a_long_name ?
+ //variable_with_a_long_name + another_variable_with_a_long_name :
+ //variable_with_a_long_name * 2 > another_variable_with_a_long_name ?
+ //variable_with_a_long_name + another_variable_with_a_long_name :
+ //variable_with_a_long_name - another_variable_with_a_long_name;
+
+ //int variable_with_a_long_name, another_variable_with_a_long_name;
+ //
+ //int variable =
+ // variable_with_a_long_name < another_variable_with_a_long_name ?
+ // variable_with_a_long_name + another_variable_with_a_long_name :
+ // variable_with_a_long_name * 2 > another_variable_with_a_long_name ?
+ // variable_with_a_long_name + another_variable_with_a_long_name :
+ // variable_with_a_long_name - another_variable_with_a_long_name;
+ public void testConditionalExpressionChain() throws Exception {
+ fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
+ assertFormatterResult();
+ }
+
//// Breaking at '<=' is preferred to breaking at '+'.
//bool x = 1000000 + 2000000 + 3000000 + 4000000 <= 5000000 + 6000000 + 7000000 + 8000000;
@@ -2293,7 +2314,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//
//void test() {
// stream << (variable_with_a_long_name + another_variable_with_a_long_name)
- // * variable_with_a_long_name
+ // * variable_with_a_long_name
// << "01234567890123456789";
//}
public void testOverloadedLeftShiftChain_4() throws Exception {

Back to the top