Lines 10603-10614
Link Here
|
10603 |
"\n" + |
10603 |
"\n" + |
10604 |
" void foo() {\n" + |
10604 |
" void foo() {\n" + |
10605 |
" String x = \"select x \"\n" + |
10605 |
" String x = \"select x \"\n" + |
10606 |
" + \"from y \"\n" + |
10606 |
" + \"from y \"\n" + |
10607 |
" + \"where z=a\";\n" + |
10607 |
" + \"where z=a\";\n" + |
10608 |
" }\n" + |
10608 |
" }\n" + |
10609 |
"}\n" |
10609 |
"}\n" |
10610 |
); |
10610 |
); |
10611 |
} |
10611 |
} |
|
|
10612 |
public void testBug198074b() throws JavaModelException { |
10613 |
this.formatterPrefs.join_wrapped_lines = false; |
10614 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
10615 |
String source = |
10616 |
"public class Test {\n" + |
10617 |
"\n" + |
10618 |
" void foo() {\n" + |
10619 |
"String x = \"select x \"\n" + |
10620 |
" + \"from y \"\n" + |
10621 |
" + \"where z=a\";\n" + |
10622 |
" }\n" + |
10623 |
"}\n"; |
10624 |
formatSource(source, |
10625 |
"public class Test {\n" + |
10626 |
"\n" + |
10627 |
" void foo() {\n" + |
10628 |
" String x = \"select x \"\n" + |
10629 |
" + \"from y \"\n" + |
10630 |
" + \"where z=a\";\n" + |
10631 |
" }\n" + |
10632 |
"}\n" |
10633 |
); |
10634 |
} |
10612 |
// another test case put in bug's comment 1 |
10635 |
// another test case put in bug's comment 1 |
10613 |
public void testBug198074_c1() throws JavaModelException { |
10636 |
public void testBug198074_c1() throws JavaModelException { |
10614 |
this.formatterPrefs.join_wrapped_lines = false; |
10637 |
this.formatterPrefs.join_wrapped_lines = false; |
Lines 10632-10644
Link Here
|
10632 |
" // we need x\n" + |
10655 |
" // we need x\n" + |
10633 |
" // we need a select\n" + |
10656 |
" // we need a select\n" + |
10634 |
" return \"select x \"\n" + |
10657 |
" return \"select x \"\n" + |
10635 |
" + \"from X\";\n" + |
10658 |
" + \"from X\";\n" + |
10636 |
" }\n" + |
10659 |
" }\n" + |
10637 |
" return null;\n" + |
10660 |
" return null;\n" + |
10638 |
" }\n" + |
10661 |
" }\n" + |
10639 |
"}\n" |
10662 |
"}\n" |
10640 |
); |
10663 |
); |
10641 |
} |
10664 |
} |
|
|
10665 |
public void testBug198074_c1b() throws JavaModelException { |
10666 |
this.formatterPrefs.join_wrapped_lines = false; |
10667 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
10668 |
String source = |
10669 |
"public class Test {\n" + |
10670 |
"\n" + |
10671 |
" String foo(boolean enabled) {\n" + |
10672 |
"if (enabled)\n" + |
10673 |
"{\n" + |
10674 |
" // we need x\n" + |
10675 |
" // we need a select\n" + |
10676 |
" return \"select x \"\n" + |
10677 |
" + \"from X\";}\n" + |
10678 |
" return null;}\n" + |
10679 |
"}\n"; |
10680 |
formatSource(source, |
10681 |
"public class Test {\n" + |
10682 |
"\n" + |
10683 |
" String foo(boolean enabled) {\n" + |
10684 |
" if (enabled) {\n" + |
10685 |
" // we need x\n" + |
10686 |
" // we need a select\n" + |
10687 |
" return \"select x \"\n" + |
10688 |
" + \"from X\";\n" + |
10689 |
" }\n" + |
10690 |
" return null;\n" + |
10691 |
" }\n" + |
10692 |
"}\n" |
10693 |
); |
10694 |
} |
10642 |
// another test case put in bug's comment 3 |
10695 |
// another test case put in bug's comment 3 |
10643 |
public void testBug198074_c3() throws JavaModelException { |
10696 |
public void testBug198074_c3() throws JavaModelException { |
10644 |
this.formatterPrefs.join_wrapped_lines = false; |
10697 |
this.formatterPrefs.join_wrapped_lines = false; |
Lines 10660-10674
Link Here
|
10660 |
"\n" + |
10713 |
"\n" + |
10661 |
" public String toString() {\n" + |
10714 |
" public String toString() {\n" + |
10662 |
" return \"YAD01: \"\n" + |
10715 |
" return \"YAD01: \"\n" + |
10663 |
" + \" nommbr=\'\" + getName() + \"\'\"\n" + |
10716 |
" + \" nommbr=\'\" + getName() + \"\'\"\n" + |
10664 |
" + \" nomgrp=\'\" + getService().getArgtbl() + \"\'\"\n" + |
10717 |
" + \" nomgrp=\'\" + getService().getArgtbl() + \"\'\"\n" + |
10665 |
" + \" typmbr=\'\" + getMemberType().getArgument() + \"\'\"\n" + |
10718 |
" + \" typmbr=\'\" + getMemberType().getArgument() + \"\'\"\n" + |
10666 |
" + \" srcpat=\'\" + getPhysicalPath() + \"\'\"\n" + |
10719 |
" + \" srcpat=\'\" + getPhysicalPath() + \"\'\"\n" + |
10667 |
" + \" nommdl=\'\" + getModel() + \"\'\";\n" + |
10720 |
" + \" nommdl=\'\" + getModel() + \"\'\";\n" + |
10668 |
" }\n" + |
10721 |
" }\n" + |
10669 |
"}\n" |
10722 |
"}\n" |
10670 |
); |
10723 |
); |
10671 |
} |
10724 |
} |
|
|
10725 |
public void testBug198074_c3b() throws JavaModelException { |
10726 |
this.formatterPrefs.join_wrapped_lines = false; |
10727 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
10728 |
String source = |
10729 |
"public class Test {\n" + |
10730 |
"\n" + |
10731 |
"public String toString() {\n" + |
10732 |
" return \"YAD01: \"\n" + |
10733 |
" + \" nommbr=\'\"+getName()+\"\'\"\n" + |
10734 |
" + \" nomgrp=\'\"+getService().getArgtbl()+\"\'\"\n" + |
10735 |
" + \" typmbr=\'\"+getMemberType().getArgument()+\"\'\"\n" + |
10736 |
" + \" srcpat=\'\"+getPhysicalPath()+\"\'\"\n" + |
10737 |
" + \" nommdl=\'\"+getModel()+\"\'\"\n" + |
10738 |
" ;\n" + |
10739 |
"}\n" + |
10740 |
"}\n"; |
10741 |
formatSource(source, |
10742 |
"public class Test {\n" + |
10743 |
"\n" + |
10744 |
" public String toString() {\n" + |
10745 |
" return \"YAD01: \"\n" + |
10746 |
" + \" nommbr=\'\" + getName() + \"\'\"\n" + |
10747 |
" + \" nomgrp=\'\" + getService().getArgtbl() + \"\'\"\n" + |
10748 |
" + \" typmbr=\'\" + getMemberType().getArgument() + \"\'\"\n" + |
10749 |
" + \" srcpat=\'\" + getPhysicalPath() + \"\'\"\n" + |
10750 |
" + \" nommdl=\'\" + getModel() + \"\'\";\n" + |
10751 |
" }\n" + |
10752 |
"}\n" |
10753 |
); |
10754 |
} |
10672 |
public void testBug198074_comments() throws JavaModelException { |
10755 |
public void testBug198074_comments() throws JavaModelException { |
10673 |
this.formatterPrefs.join_lines_in_comments = false; |
10756 |
this.formatterPrefs.join_lines_in_comments = false; |
10674 |
String source = |
10757 |
String source = |
Lines 10764-10771
Link Here
|
10764 |
" void foo() {\n" + |
10847 |
" void foo() {\n" + |
10765 |
" int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0;\n" + |
10848 |
" int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0;\n" + |
10766 |
" if ((a == b && b == c) &&\n" + |
10849 |
" if ((a == b && b == c) &&\n" + |
10767 |
" (d == e) &&\n" + |
10850 |
" (d == e) &&\n" + |
10768 |
" (f == g && h == i)) {\n" + |
10851 |
" (f == g && h == i)) {\n" + |
10769 |
" }\n" + |
10852 |
" }\n" + |
10770 |
" }\n" + |
10853 |
" }\n" + |
10771 |
"}\n" |
10854 |
"}\n" |
Lines 10914-10917
Link Here
|
10914 |
"}\n" |
10997 |
"}\n" |
10915 |
); |
10998 |
); |
10916 |
} |
10999 |
} |
|
|
11000 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=286668 |
11001 |
//static { TESTS_PREFIX = "testBug286608"; } |
11002 |
public void testBug286608() throws JavaModelException { |
11003 |
this.formatterPrefs.join_wrapped_lines = false; |
11004 |
String source = |
11005 |
"public class Test {\n" + |
11006 |
"\n" + |
11007 |
" void foo() {\n" + |
11008 |
" StringBuilder builder = new StringBuilder();\n" + |
11009 |
" builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11010 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11011 |
" }\n" + |
11012 |
"}\n"; |
11013 |
formatSource(source, |
11014 |
"public class Test {\n" + |
11015 |
"\n" + |
11016 |
" void foo() {\n" + |
11017 |
" StringBuilder builder = new StringBuilder();\n" + |
11018 |
" builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\").append(\n" + |
11019 |
" \"mno\")\n" + |
11020 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11021 |
" }\n" + |
11022 |
"}\n" |
11023 |
); |
11024 |
} |
11025 |
public void testBug286608b() throws JavaModelException { |
11026 |
this.formatterPrefs.join_wrapped_lines = false; |
11027 |
String source = |
11028 |
"public class Test {\n" + |
11029 |
"\n" + |
11030 |
" void foo() {\n" + |
11031 |
" StringBuilder builder = new StringBuilder();\n" + |
11032 |
" builder.append(\"abc\").append(\"def\")\n" + |
11033 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11034 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11035 |
" }\n" + |
11036 |
"}\n"; |
11037 |
formatSource(source); |
11038 |
} |
11039 |
public void testBug286608c() throws JavaModelException { |
11040 |
this.formatterPrefs.join_wrapped_lines = false; |
11041 |
String source = |
11042 |
"public class Test {\n" + |
11043 |
"\n" + |
11044 |
" void foo() {\n" + |
11045 |
" StringBuilder builder = new StringBuilder();\n" + |
11046 |
" builder.append(\"abc\").append(\"def\")\n" + |
11047 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11048 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\")\n" + |
11049 |
" .append(\"yz\");\n" + |
11050 |
" }\n" + |
11051 |
"}\n"; |
11052 |
formatSource(source); |
11053 |
} |
11054 |
public void testBug286608_40w() throws JavaModelException { |
11055 |
this.formatterPrefs.join_wrapped_lines = false; |
11056 |
this.formatterPrefs.page_width = 40; |
11057 |
String source = |
11058 |
"public class Test {\n" + |
11059 |
"\n" + |
11060 |
" void foo() {\n" + |
11061 |
" StringBuilder builder = new StringBuilder();\n" + |
11062 |
" builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11063 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11064 |
" }\n" + |
11065 |
"}\n"; |
11066 |
formatSource(source, |
11067 |
"public class Test {\n" + |
11068 |
"\n" + |
11069 |
" void foo() {\n" + |
11070 |
" StringBuilder builder = new StringBuilder();\n" + |
11071 |
" builder.append(\"abc\").append(\n" + |
11072 |
" \"def\").append(\"ghi\")\n" + |
11073 |
" .append(\"jkl\").append(\n" + |
11074 |
" \"mno\")\n" + |
11075 |
" .append(\"pqr\").append(\"stu\")\n" + |
11076 |
" .append(\"vwx\").append(\n" + |
11077 |
" \"yz\");\n" + |
11078 |
" }\n" + |
11079 |
"}\n" |
11080 |
); |
11081 |
} |
11082 |
public void testBug286608b_40w() throws JavaModelException { |
11083 |
this.formatterPrefs.join_wrapped_lines = false; |
11084 |
this.formatterPrefs.page_width = 40; |
11085 |
String source = |
11086 |
"public class Test {\n" + |
11087 |
"\n" + |
11088 |
" void foo() {\n" + |
11089 |
" StringBuilder builder = new StringBuilder();\n" + |
11090 |
" builder.append(\"abc\").append(\"def\")\n" + |
11091 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11092 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11093 |
" }\n" + |
11094 |
"}\n"; |
11095 |
formatSource(source, |
11096 |
"public class Test {\n" + |
11097 |
"\n" + |
11098 |
" void foo() {\n" + |
11099 |
" StringBuilder builder = new StringBuilder();\n" + |
11100 |
" builder.append(\"abc\").append(\n" + |
11101 |
" \"def\")\n" + |
11102 |
" .append(\"ghi\").append(\"jkl\")\n" + |
11103 |
" .append(\"mno\")\n" + |
11104 |
" .append(\"pqr\").append(\"stu\")\n" + |
11105 |
" .append(\"vwx\").append(\n" + |
11106 |
" \"yz\");\n" + |
11107 |
" }\n" + |
11108 |
"}\n" |
11109 |
); |
11110 |
} |
11111 |
public void testBug286608c_40w() throws JavaModelException { |
11112 |
this.formatterPrefs.join_wrapped_lines = false; |
11113 |
this.formatterPrefs.page_width = 40; |
11114 |
String source = |
11115 |
"public class Test {\n" + |
11116 |
"\n" + |
11117 |
" void foo() {\n" + |
11118 |
" StringBuilder builder = new StringBuilder();\n" + |
11119 |
" builder.append(\"abc\").append(\"def\")\n" + |
11120 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11121 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\")\n" + |
11122 |
" .append(\"yz\");\n" + |
11123 |
" }\n" + |
11124 |
"}\n"; |
11125 |
formatSource(source, |
11126 |
"public class Test {\n" + |
11127 |
"\n" + |
11128 |
" void foo() {\n" + |
11129 |
" StringBuilder builder = new StringBuilder();\n" + |
11130 |
" builder.append(\"abc\").append(\n" + |
11131 |
" \"def\")\n" + |
11132 |
" .append(\"ghi\").append(\"jkl\")\n" + |
11133 |
" .append(\"mno\")\n" + |
11134 |
" .append(\"pqr\").append(\"stu\")\n" + |
11135 |
" .append(\"vwx\")\n" + |
11136 |
" .append(\"yz\");\n" + |
11137 |
" }\n" + |
11138 |
"}\n" |
11139 |
); |
11140 |
} |
11141 |
public void testBug286608_60w() throws JavaModelException { |
11142 |
this.formatterPrefs.join_wrapped_lines = false; |
11143 |
this.formatterPrefs.page_width = 60; |
11144 |
String source = |
11145 |
"public class Test {\n" + |
11146 |
"\n" + |
11147 |
" void foo() {\n" + |
11148 |
" StringBuilder builder = new StringBuilder();\n" + |
11149 |
" builder.append(\"abc\").append(\"def\").append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11150 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11151 |
" }\n" + |
11152 |
"}\n"; |
11153 |
formatSource(source, |
11154 |
"public class Test {\n" + |
11155 |
"\n" + |
11156 |
" void foo() {\n" + |
11157 |
" StringBuilder builder = new StringBuilder();\n" + |
11158 |
" builder.append(\"abc\").append(\"def\").append(\"ghi\")\n" + |
11159 |
" .append(\"jkl\").append(\"mno\")\n" + |
11160 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\n" + |
11161 |
" \"yz\");\n" + |
11162 |
" }\n" + |
11163 |
"}\n" |
11164 |
); |
11165 |
} |
11166 |
public void testBug286608b_60w() throws JavaModelException { |
11167 |
this.formatterPrefs.join_wrapped_lines = false; |
11168 |
this.formatterPrefs.page_width = 60; |
11169 |
String source = |
11170 |
"public class Test {\n" + |
11171 |
"\n" + |
11172 |
" void foo() {\n" + |
11173 |
" StringBuilder builder = new StringBuilder();\n" + |
11174 |
" builder.append(\"abc\").append(\"def\")\n" + |
11175 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11176 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\"yz\");\n" + |
11177 |
" }\n" + |
11178 |
"}\n"; |
11179 |
formatSource(source, |
11180 |
"public class Test {\n" + |
11181 |
"\n" + |
11182 |
" void foo() {\n" + |
11183 |
" StringBuilder builder = new StringBuilder();\n" + |
11184 |
" builder.append(\"abc\").append(\"def\")\n" + |
11185 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11186 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\").append(\n" + |
11187 |
" \"yz\");\n" + |
11188 |
" }\n" + |
11189 |
"}\n" |
11190 |
); |
11191 |
} |
11192 |
public void testBug286608c_60w() throws JavaModelException { |
11193 |
this.formatterPrefs.join_wrapped_lines = false; |
11194 |
this.formatterPrefs.page_width = 60; |
11195 |
String source = |
11196 |
"public class Test {\n" + |
11197 |
"\n" + |
11198 |
" void foo() {\n" + |
11199 |
" StringBuilder builder = new StringBuilder();\n" + |
11200 |
" builder.append(\"abc\").append(\"def\")\n" + |
11201 |
" .append(\"ghi\").append(\"jkl\").append(\"mno\")\n" + |
11202 |
" .append(\"pqr\").append(\"stu\").append(\"vwx\")\n" + |
11203 |
" .append(\"yz\");\n" + |
11204 |
" }\n" + |
11205 |
"}\n"; |
11206 |
formatSource(source); |
11207 |
} |
10917 |
} |
11208 |
} |