Link Here
|
84 |
formatUnit("bugs.b230944", "X01.java"); |
84 |
formatUnit("bugs.b230944", "X01.java"); |
85 |
} |
85 |
} |
86 |
public void testBug230944b() throws JavaModelException { |
86 |
public void testBug230944b() throws JavaModelException { |
87 |
this.preferences.comment_line_length = 40; |
87 |
this.formatterPrefs.comment_line_length = 40; |
88 |
formatUnit("bugs.b230944", "X02.java"); |
88 |
formatUnit("bugs.b230944", "X02.java"); |
89 |
} |
89 |
} |
90 |
|
90 |
|
Link Here
|
97 |
formatUnit("bugs.b231263", "BadFormattingSample.java"); |
97 |
formatUnit("bugs.b231263", "BadFormattingSample.java"); |
98 |
} |
98 |
} |
99 |
public void testBug231263a() throws JavaModelException { |
99 |
public void testBug231263a() throws JavaModelException { |
100 |
this.preferences.comment_line_length = 40; |
100 |
this.formatterPrefs.comment_line_length = 40; |
101 |
formatUnit("bugs.b231263", "X.java"); |
101 |
formatUnit("bugs.b231263", "X.java"); |
102 |
} |
102 |
} |
103 |
|
103 |
|
Link Here
|
107 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=231297" |
107 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=231297" |
108 |
*/ |
108 |
*/ |
109 |
public void testBug231297() throws JavaModelException { |
109 |
public void testBug231297() throws JavaModelException { |
110 |
this.preferences.comment_line_length = 40; |
110 |
this.formatterPrefs.comment_line_length = 40; |
111 |
formatUnit("bugs.b231297", "X.java"); |
111 |
formatUnit("bugs.b231297", "X.java"); |
112 |
} |
112 |
} |
113 |
public void testBug231297a() throws JavaModelException { |
113 |
public void testBug231297a() throws JavaModelException { |
114 |
this.preferences.comment_line_length = 30; |
114 |
this.formatterPrefs.comment_line_length = 30; |
115 |
formatUnit("bugs.b231297", "X01.java"); |
115 |
formatUnit("bugs.b231297", "X01.java"); |
116 |
} |
116 |
} |
117 |
public void testBug231297b() throws JavaModelException { |
117 |
public void testBug231297b() throws JavaModelException { |
118 |
// Difference with old formatter: |
118 |
// Difference with old formatter: |
119 |
// 1) fixed non formatted inline tag description |
119 |
// 1) fixed non formatted inline tag description |
120 |
this.preferences.comment_line_length = 40; |
120 |
this.formatterPrefs.comment_line_length = 40; |
121 |
formatUnit("bugs.b231297", "X02.java"); |
121 |
formatUnit("bugs.b231297", "X02.java"); |
122 |
} |
122 |
} |
123 |
public void testBug231297c() throws JavaModelException { |
123 |
public void testBug231297c() throws JavaModelException { |
124 |
// Difference with old formatter: |
124 |
// Difference with old formatter: |
125 |
// 1) fixed non formatted inline tag description |
125 |
// 1) fixed non formatted inline tag description |
126 |
this.preferences.comment_line_length = 40; |
126 |
this.formatterPrefs.comment_line_length = 40; |
127 |
formatUnit("bugs.b231297", "X03.java"); |
127 |
formatUnit("bugs.b231297", "X03.java"); |
128 |
} |
128 |
} |
129 |
public void testBug231297d() throws JavaModelException { |
129 |
public void testBug231297d() throws JavaModelException { |
130 |
// Difference with old formatter: |
130 |
// Difference with old formatter: |
131 |
// 1) fixed non formatted inline tag description |
131 |
// 1) fixed non formatted inline tag description |
132 |
this.preferences.comment_line_length = 40; |
132 |
this.formatterPrefs.comment_line_length = 40; |
133 |
formatUnit("bugs.b231297", "X03b.java"); |
133 |
formatUnit("bugs.b231297", "X03b.java"); |
134 |
} |
134 |
} |
135 |
|
135 |
|
Link Here
|
139 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232285" |
139 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232285" |
140 |
*/ |
140 |
*/ |
141 |
public void testBug232285a() throws JavaModelException { |
141 |
public void testBug232285a() throws JavaModelException { |
142 |
this.preferences.comment_line_length = 40; |
142 |
this.formatterPrefs.comment_line_length = 40; |
143 |
formatUnit("bugs.b232285", "X01.java"); |
143 |
formatUnit("bugs.b232285", "X01.java"); |
144 |
} |
144 |
} |
145 |
public void testBug232285b() throws JavaModelException { |
145 |
public void testBug232285b() throws JavaModelException { |
146 |
this.preferences.comment_line_length = 40; |
146 |
this.formatterPrefs.comment_line_length = 40; |
147 |
formatUnit("bugs.b232285", "X01b.java"); |
147 |
formatUnit("bugs.b232285", "X01b.java"); |
148 |
} |
148 |
} |
149 |
public void testBug232285c() throws JavaModelException { |
149 |
public void testBug232285c() throws JavaModelException { |
150 |
this.preferences.comment_line_length = 40; |
150 |
this.formatterPrefs.comment_line_length = 40; |
151 |
formatUnit("bugs.b232285", "X01c.java"); |
151 |
formatUnit("bugs.b232285", "X01c.java"); |
152 |
} |
152 |
} |
153 |
public void testBug232285d() throws JavaModelException { |
153 |
public void testBug232285d() throws JavaModelException { |
154 |
this.preferences.comment_line_length = 40; |
154 |
this.formatterPrefs.comment_line_length = 40; |
155 |
formatUnit("bugs.b232285", "X01d.java"); |
155 |
formatUnit("bugs.b232285", "X01d.java"); |
156 |
} |
156 |
} |
157 |
public void testBug232285e() throws JavaModelException { |
157 |
public void testBug232285e() throws JavaModelException { |
158 |
this.preferences.comment_line_length = 40; |
158 |
this.formatterPrefs.comment_line_length = 40; |
159 |
formatUnit("bugs.b232285", "X01e.java"); |
159 |
formatUnit("bugs.b232285", "X01e.java"); |
160 |
} |
160 |
} |
161 |
public void testBug232285f() throws JavaModelException { |
161 |
public void testBug232285f() throws JavaModelException { |
162 |
this.preferences.comment_line_length = 40; |
162 |
this.formatterPrefs.comment_line_length = 40; |
163 |
formatUnit("bugs.b232285", "X01f.java"); |
163 |
formatUnit("bugs.b232285", "X01f.java"); |
164 |
} |
164 |
} |
165 |
public void testBug232285g() throws JavaModelException { |
165 |
public void testBug232285g() throws JavaModelException { |
166 |
this.preferences.comment_line_length = 40; |
166 |
this.formatterPrefs.comment_line_length = 40; |
167 |
formatUnit("bugs.b232285", "X02.java"); |
167 |
formatUnit("bugs.b232285", "X02.java"); |
168 |
} |
168 |
} |
169 |
public void testBug232285h() throws JavaModelException { |
169 |
public void testBug232285h() throws JavaModelException { |
170 |
this.preferences.comment_line_length = 40; |
170 |
this.formatterPrefs.comment_line_length = 40; |
171 |
formatUnit("bugs.b232285", "X03.java"); |
171 |
formatUnit("bugs.b232285", "X03.java"); |
172 |
} |
172 |
} |
173 |
public void testBug232285i() throws JavaModelException { |
173 |
public void testBug232285i() throws JavaModelException { |
174 |
this.preferences.comment_line_length = 40; |
174 |
this.formatterPrefs.comment_line_length = 40; |
175 |
formatUnit("bugs.b232285", "X04.java"); |
175 |
formatUnit("bugs.b232285", "X04.java"); |
176 |
} |
176 |
} |
177 |
public void testBug232285j() throws JavaModelException { |
177 |
public void testBug232285j() throws JavaModelException { |
178 |
this.preferences.comment_line_length = 40; |
178 |
this.formatterPrefs.comment_line_length = 40; |
179 |
formatUnit("bugs.b232285", "X04b.java"); |
179 |
formatUnit("bugs.b232285", "X04b.java"); |
180 |
} |
180 |
} |
181 |
|
181 |
|
Link Here
|
185 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232488" |
185 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232488" |
186 |
*/ |
186 |
*/ |
187 |
public void testBug232488() throws JavaModelException { |
187 |
public void testBug232488() throws JavaModelException { |
188 |
this.preferences.comment_line_length = 40; |
188 |
this.formatterPrefs.comment_line_length = 40; |
189 |
formatUnit("bugs.b232488", "X01.java"); |
189 |
formatUnit("bugs.b232488", "X01.java"); |
190 |
} |
190 |
} |
191 |
|
191 |
|
Link Here
|
195 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232466" |
195 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232466" |
196 |
*/ |
196 |
*/ |
197 |
public void testBug232466a() throws JavaModelException { |
197 |
public void testBug232466a() throws JavaModelException { |
198 |
this.preferences.comment_line_length = 40; |
198 |
this.formatterPrefs.comment_line_length = 40; |
199 |
formatUnit("bugs.b232466", "X01.java"); |
199 |
formatUnit("bugs.b232466", "X01.java"); |
200 |
} |
200 |
} |
201 |
public void testBug232466b() throws JavaModelException { |
201 |
public void testBug232466b() throws JavaModelException { |
202 |
this.preferences.comment_line_length = 40; |
202 |
this.formatterPrefs.comment_line_length = 40; |
203 |
formatUnit("bugs.b232466", "X02.java"); |
203 |
formatUnit("bugs.b232466", "X02.java"); |
204 |
} |
204 |
} |
205 |
|
205 |
|
Link Here
|
218 |
"\r\n#]" + |
218 |
"\r\n#]" + |
219 |
"}\r\n" + |
219 |
"}\r\n" + |
220 |
""; |
220 |
""; |
221 |
// TODO fix the incorrect indentation before the javadoc comment (also in 3.3 and 3.4M6) |
|
|
222 |
formatSource(source, |
221 |
formatSource(source, |
223 |
"public class A {\n" + |
222 |
"public class A {\n" + |
224 |
"\n" + |
223 |
"\n" + |
225 |
" /*\n" + |
224 |
" /*\n" + |
226 |
" * A block comment on two lines\n" + |
225 |
" * A block comment on two lines\n" + |
227 |
" */\n" + |
226 |
" */\n" + |
228 |
"\n" + |
227 |
"\n" + |
Link Here
|
247 |
" public void foo() {\n" + |
246 |
" public void foo() {\n" + |
248 |
" }\n" + |
247 |
" }\n" + |
249 |
"\n" + |
248 |
"\n" + |
250 |
" /*\n" + |
249 |
" /*\r\n" + |
251 |
" * A block comment \n" + |
250 |
" * A block comment \n" + |
252 |
" * on two lines\n" + |
251 |
" * on two lines\n" + |
253 |
" */\n" + |
252 |
" */\n" + |
Link Here
|
272 |
"#]\n" + |
271 |
"#]\n" + |
273 |
"\n" + |
272 |
"\n" + |
274 |
"}"; |
273 |
"}"; |
275 |
// TODO fix the incorrect indentation before the javadoc comment (also in 3.3 and 3.4M6) |
|
|
276 |
formatSource(source, |
274 |
formatSource(source, |
277 |
"public class C {\n" + |
275 |
"public class C {\n" + |
278 |
" \n" + |
276 |
" \n" + |
279 |
" /**\n" + |
277 |
" /**\n" + |
280 |
" * a b c d .\n" + |
278 |
" * a b c d .\n" + |
281 |
" */\n" + |
279 |
" */\n" + |
282 |
" void m1() {\n" + |
280 |
" void m1() {\n" + |
283 |
"\n" + |
281 |
"\n" + |
284 |
" } \n" + |
282 |
" }\n" + |
285 |
"\n" + |
|
|
286 |
"\n" + |
283 |
"\n" + |
287 |
"}" |
284 |
"}" |
288 |
); |
285 |
); |
Link Here
|
313 |
" * a b c d .\n" + |
310 |
" * a b c d .\n" + |
314 |
" */\n" + |
311 |
" */\n" + |
315 |
" void m1() {\n" + |
312 |
" void m1() {\n" + |
316 |
" \n" + |
313 |
"\n" + |
317 |
" } \n" + |
314 |
" } \n" + |
318 |
"\n" + |
315 |
"\n" + |
319 |
"\n" + |
316 |
"\n" + |
Link Here
|
370 |
"\n" + |
367 |
"\n" + |
371 |
"\n" + |
368 |
"\n" + |
372 |
"}"; |
369 |
"}"; |
373 |
// TODO fix the incorrect indentation before the javadoc comment (also in 3.3 and 3.4M6) |
|
|
374 |
formatSource(source, |
370 |
formatSource(source, |
375 |
"public class C {\n" + |
371 |
"public class C {\n" + |
376 |
" \n" + |
372 |
"\n" + |
377 |
" /**\n" + |
373 |
" /**\n" + |
378 |
" * a b c d .\n" + |
374 |
" * a b c d .\n" + |
379 |
" */\n" + |
375 |
" */\n" + |
380 |
" void m1 ( ) {\n" + |
376 |
" void m1 ( ) {\n" + |
Link Here
|
468 |
"#]\n" + |
464 |
"#]\n" + |
469 |
"\n" + |
465 |
"\n" + |
470 |
"}"; |
466 |
"}"; |
471 |
// TODO fix the incorrect indentation before the block comment (also in 3.3 and 3.4M6) |
|
|
472 |
formatSource(source, |
467 |
formatSource(source, |
473 |
"public class D {\n" + |
468 |
"public class D {\n" + |
474 |
" \n" + |
469 |
" \n" + |
475 |
" /*\n" + |
470 |
" /*\n" + |
476 |
" * a b c d .\n" + |
471 |
" * a b c d .\n" + |
477 |
" */\n" + |
472 |
" */\n" + |
478 |
" void m2() {\n" + |
473 |
" void m2() {\n" + |
479 |
"\n" + |
474 |
"\n" + |
480 |
" } \n" + |
475 |
" }\n" + |
481 |
"\n" + |
|
|
482 |
"\n" + |
476 |
"\n" + |
483 |
"}" |
477 |
"}" |
484 |
); |
478 |
); |
Link Here
|
509 |
" * a b c d .\n" + |
503 |
" * a b c d .\n" + |
510 |
" */\n" + |
504 |
" */\n" + |
511 |
" void m2() {\n" + |
505 |
" void m2() {\n" + |
512 |
" \n" + |
506 |
"\n" + |
513 |
" } \n" + |
507 |
" } \n" + |
514 |
"\n" + |
508 |
"\n" + |
515 |
"\n" + |
509 |
"\n" + |
Link Here
|
566 |
"\n" + |
560 |
"\n" + |
567 |
"\n" + |
561 |
"\n" + |
568 |
"}"; |
562 |
"}"; |
569 |
// TODO fix the incorrect indentation before the block comment (also in 3.3 and 3.4M6) |
|
|
570 |
formatSource(source, |
563 |
formatSource(source, |
571 |
"public class D {\n" + |
564 |
"public class D {\n" + |
572 |
" \n" + |
565 |
"\n" + |
573 |
" /*\n" + |
566 |
" /*\n" + |
574 |
" * a b c d .\n" + |
567 |
" * a b c d .\n" + |
575 |
" */\n" + |
568 |
" */\n" + |
576 |
" void m2 ( ) {\n" + |
569 |
" void m2 ( ) {\n" + |
Link Here
|
657 |
" }\n" + |
650 |
" }\n" + |
658 |
"#] \n" + |
651 |
"#] \n" + |
659 |
"}"; |
652 |
"}"; |
660 |
// TODO fix the incorrect indentation before the method declaration (also in 3.3 and 3.4M6) |
|
|
661 |
// Note that the line comment wasn't formatted using 3.3 and 3.4 M6 |
662 |
formatSource(source, |
653 |
formatSource(source, |
663 |
"public class E {\n" + |
654 |
"public class E {\n" + |
664 |
" \n" + |
655 |
" \n" + |
665 |
"\n" + |
656 |
"\n" + |
666 |
" void m3() { // this is a bug\n" + |
657 |
" void m3() { // this is a bug\n" + |
667 |
"\n" + |
658 |
"\n" + |
668 |
" }\n" + |
659 |
" }\n" + |
669 |
" \n" + |
660 |
" \n" + |
Link Here
|
707 |
"public class E {\n" + |
698 |
"public class E {\n" + |
708 |
" \n" + |
699 |
" \n" + |
709 |
"\n" + |
700 |
"\n" + |
710 |
" void m3() { // this is a bug\n" + |
701 |
" void m3() { // this is a bug\n" + |
711 |
"\n" + |
702 |
"\n" + |
712 |
" }\n" + |
703 |
" }\n" + |
713 |
"\n" + |
704 |
"\n" + |
Link Here
|
750 |
"public class E { \n" + |
741 |
"public class E { \n" + |
751 |
" \n" + |
742 |
" \n" + |
752 |
"\n" + |
743 |
"\n" + |
753 |
" void m3() { // this is a bug\n" + |
744 |
" void m3() { // this is a bug\n" + |
754 |
"\n" + |
745 |
"\n" + |
755 |
" }\n" + |
746 |
" }\n" + |
756 |
" \n" + |
747 |
" \n" + |
Link Here
|
772 |
"public class E { \n" + |
763 |
"public class E { \n" + |
773 |
" \n" + |
764 |
" \n" + |
774 |
"\n" + |
765 |
"\n" + |
775 |
" void m3() { // this is a bug\n" + |
766 |
" void m3() { // this is a bug\n" + |
776 |
"\n" + |
767 |
"\n" + |
777 |
" }\n" + |
768 |
" }\n" + |
778 |
" \n" + |
769 |
" \n" + |
Link Here
|
796 |
" \n" + |
787 |
" \n" + |
797 |
"\n" + |
788 |
"\n" + |
798 |
" void m3() { \n" + |
789 |
" void m3() { \n" + |
799 |
" // this is a bug\n" + |
790 |
" // this is a bug\n" + |
800 |
"\n" + |
791 |
"\n" + |
801 |
" }\n" + |
792 |
" }\n" + |
802 |
" \n" + |
793 |
" \n" + |
Link Here
|
832 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232788" |
823 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=232788" |
833 |
*/ |
824 |
*/ |
834 |
public void testBug232788_Tabs01() throws JavaModelException { |
825 |
public void testBug232788_Tabs01() throws JavaModelException { |
835 |
this.preferences.comment_line_length = 40; |
826 |
this.formatterPrefs.comment_line_length = 40; |
836 |
this.preferences.tab_size = 1; |
827 |
this.formatterPrefs.tab_size = 1; |
837 |
this.preferences.indentation_size = 1; |
828 |
this.formatterPrefs.indentation_size = 1; |
838 |
formatUnit("bugs.b232788", "X01_tabs.java"); |
829 |
formatUnit("bugs.b232788", "X01_tabs.java"); |
839 |
} |
830 |
} |
840 |
public void testBug232788_Spaces01() throws JavaModelException { |
831 |
public void testBug232788_Spaces01() throws JavaModelException { |
841 |
this.preferences.comment_line_length = 40; |
832 |
this.formatterPrefs.comment_line_length = 40; |
842 |
this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; |
833 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
843 |
this.preferences.tab_size = 1; |
834 |
this.formatterPrefs.tab_size = 1; |
844 |
this.preferences.indentation_size = 1; |
835 |
this.formatterPrefs.indentation_size = 1; |
845 |
formatUnit("bugs.b232788", "X01_spaces.java"); |
836 |
formatUnit("bugs.b232788", "X01_spaces.java"); |
846 |
} |
837 |
} |
847 |
public void testBug232788_Mixed01() throws JavaModelException { |
838 |
public void testBug232788_Mixed01() throws JavaModelException { |
848 |
this.preferences.comment_line_length = 40; |
839 |
this.formatterPrefs.comment_line_length = 40; |
849 |
this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; |
840 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; |
850 |
this.preferences.tab_size = 1; |
841 |
this.formatterPrefs.tab_size = 1; |
851 |
this.preferences.indentation_size = 1; |
842 |
this.formatterPrefs.indentation_size = 1; |
852 |
formatUnit("bugs.b232788", "X01_mixed.java"); |
843 |
formatUnit("bugs.b232788", "X01_mixed.java"); |
853 |
} |
844 |
} |
854 |
public void testBug232788_Tabs02() throws JavaModelException { |
845 |
public void testBug232788_Tabs02() throws JavaModelException { |
855 |
this.preferences.comment_line_length = 40; |
846 |
this.formatterPrefs.comment_line_length = 40; |
856 |
this.preferences.tab_size = 0; |
847 |
this.formatterPrefs.tab_size = 0; |
857 |
this.preferences.indentation_size = 0; |
848 |
this.formatterPrefs.indentation_size = 0; |
858 |
formatUnit("bugs.b232788", "X02_tabs.java"); |
849 |
formatUnit("bugs.b232788", "X02_tabs.java"); |
859 |
} |
850 |
} |
860 |
public void testBug232788_Spaces02() throws JavaModelException { |
851 |
public void testBug232788_Spaces02() throws JavaModelException { |
861 |
this.preferences.comment_line_length = 40; |
852 |
this.formatterPrefs.comment_line_length = 40; |
862 |
this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; |
853 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
863 |
this.preferences.tab_size = 0; |
854 |
this.formatterPrefs.tab_size = 0; |
864 |
this.preferences.indentation_size = 0; |
855 |
this.formatterPrefs.indentation_size = 0; |
865 |
formatUnit("bugs.b232788", "X02_spaces.java"); |
856 |
formatUnit("bugs.b232788", "X02_spaces.java"); |
866 |
} |
857 |
} |
867 |
public void testBug232788_Mixed02() throws JavaModelException { |
858 |
public void testBug232788_Mixed02() throws JavaModelException { |
868 |
this.preferences.comment_line_length = 40; |
859 |
this.formatterPrefs.comment_line_length = 40; |
869 |
this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; |
860 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; |
870 |
this.preferences.tab_size = 0; |
861 |
this.formatterPrefs.tab_size = 0; |
871 |
this.preferences.indentation_size = 0; |
862 |
this.formatterPrefs.indentation_size = 0; |
872 |
formatUnit("bugs.b232788", "X02_mixed.java"); |
863 |
formatUnit("bugs.b232788", "X02_mixed.java"); |
873 |
} |
864 |
} |
874 |
public void testBug232788_Tabs03() throws JavaModelException { |
865 |
public void testBug232788_Tabs03() throws JavaModelException { |
875 |
this.preferences.comment_line_length = 40; |
866 |
this.formatterPrefs.comment_line_length = 40; |
876 |
this.preferences.tab_size = 1; |
867 |
this.formatterPrefs.tab_size = 1; |
877 |
this.preferences.indentation_size = 1; |
868 |
this.formatterPrefs.indentation_size = 1; |
878 |
formatUnit("bugs.b232788", "X03_tabs.java"); |
869 |
formatUnit("bugs.b232788", "X03_tabs.java"); |
879 |
} |
870 |
} |
880 |
public void testBug232788_Spaces03() throws JavaModelException { |
871 |
public void testBug232788_Spaces03() throws JavaModelException { |
881 |
this.preferences.comment_line_length = 40; |
872 |
this.formatterPrefs.comment_line_length = 40; |
882 |
this.preferences.tab_char = DefaultCodeFormatterOptions.SPACE; |
873 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE; |
883 |
this.preferences.tab_size = 1; |
874 |
this.formatterPrefs.tab_size = 1; |
884 |
this.preferences.indentation_size = 1; |
875 |
this.formatterPrefs.indentation_size = 1; |
885 |
formatUnit("bugs.b232788", "X03_spaces.java"); |
876 |
formatUnit("bugs.b232788", "X03_spaces.java"); |
886 |
} |
877 |
} |
887 |
public void testBug232788_Mixed03() throws JavaModelException { |
878 |
public void testBug232788_Mixed03() throws JavaModelException { |
888 |
this.preferences.comment_line_length = 40; |
879 |
this.formatterPrefs.comment_line_length = 40; |
889 |
this.preferences.tab_char = DefaultCodeFormatterOptions.MIXED; |
880 |
this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED; |
890 |
this.preferences.tab_size = 1; |
881 |
this.formatterPrefs.tab_size = 1; |
891 |
this.preferences.indentation_size = 1; |
882 |
this.formatterPrefs.indentation_size = 1; |
892 |
formatUnit("bugs.b232788", "X03_mixed.java"); |
883 |
formatUnit("bugs.b232788", "X03_mixed.java"); |
893 |
} |
884 |
} |
894 |
|
885 |
|
Link Here
|
908 |
" * block [# #] \n" + |
899 |
" * block [# #] \n" + |
909 |
" * comment\n" + |
900 |
" * comment\n" + |
910 |
" */\n" + |
901 |
" */\n" + |
911 |
" // single [# #] line comment\n" + |
902 |
" // [#single line#] comment\n" + |
912 |
"}"; |
903 |
"}"; |
913 |
formatSource(source, |
904 |
formatSource(source, |
914 |
"\n" + |
905 |
"\n" + |
Link Here
|
916 |
" /**\n" + |
907 |
" /**\n" + |
917 |
" * Javadoc comment\n" + |
908 |
" * Javadoc comment\n" + |
918 |
" */\n" + |
909 |
" */\n" + |
919 |
" /*\n" + |
910 |
" /*\n" + |
920 |
" * block comment\n" + |
911 |
" * block comment\n" + |
921 |
" */\n" + |
912 |
" */\n" + |
922 |
" // single line comment\n" + |
913 |
" // single line comment\n" + |
923 |
"}" |
914 |
"}" |
924 |
); |
915 |
); |
925 |
} |
916 |
} |
Link Here
|
951 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233224" |
942 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233224" |
952 |
*/ |
943 |
*/ |
953 |
public void testBug233224() throws JavaModelException { |
944 |
public void testBug233224() throws JavaModelException { |
954 |
this.preferences.comment_line_length = 40; |
945 |
this.formatterPrefs.comment_line_length = 40; |
955 |
formatUnit("bugs.b233224", "X01.java"); |
946 |
formatUnit("bugs.b233224", "X01.java"); |
956 |
} |
947 |
} |
957 |
|
948 |
|
Link Here
|
961 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233259" |
952 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=233259" |
962 |
*/ |
953 |
*/ |
963 |
public void testBug233259a() throws JavaModelException { |
954 |
public void testBug233259a() throws JavaModelException { |
964 |
this.preferences.comment_line_length = 40; |
955 |
this.formatterPrefs.comment_line_length = 40; |
965 |
String source = |
956 |
String source = |
966 |
"public class X {\n" + |
957 |
"public class X {\n" + |
967 |
" /**\n" + |
958 |
" /**\n" + |
Link Here
|
981 |
); |
972 |
); |
982 |
} |
973 |
} |
983 |
public void testBug233259b() throws JavaModelException { |
974 |
public void testBug233259b() throws JavaModelException { |
984 |
this.preferences.comment_line_length = 40; |
975 |
this.formatterPrefs.comment_line_length = 40; |
985 |
// difference with 3.3 formatter: |
976 |
// difference with 3.3 formatter: |
986 |
// split html reference as this allow not to go over the max line width |
977 |
// split html reference as this allow not to go over the max line width |
987 |
String source = |
978 |
String source = |
Link Here
|
1004 |
); |
995 |
); |
1005 |
} |
996 |
} |
1006 |
public void testBug233259c() throws JavaModelException { |
997 |
public void testBug233259c() throws JavaModelException { |
1007 |
this.preferences.comment_line_length = 40; |
998 |
this.formatterPrefs.comment_line_length = 40; |
1008 |
String source = |
999 |
String source = |
1009 |
"public class X {\n" + |
1000 |
"public class X {\n" + |
1010 |
" /**\n" + |
1001 |
" /**\n" + |
Link Here
|
1025 |
); |
1016 |
); |
1026 |
} |
1017 |
} |
1027 |
public void testBug233259d() throws JavaModelException { |
1018 |
public void testBug233259d() throws JavaModelException { |
1028 |
this.preferences.comment_line_length = 40; |
1019 |
this.formatterPrefs.comment_line_length = 40; |
1029 |
String source = |
1020 |
String source = |
1030 |
"public class X {\n" + |
1021 |
"public class X {\n" + |
1031 |
" /**\n" + |
1022 |
" /**\n" + |
Link Here
|
1052 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=237942" |
1043 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=237942" |
1053 |
*/ |
1044 |
*/ |
1054 |
public void testBug237942a() throws JavaModelException { |
1045 |
public void testBug237942a() throws JavaModelException { |
1055 |
this.preferences.comment_line_length = 40; |
1046 |
this.formatterPrefs.comment_line_length = 40; |
1056 |
String source = |
1047 |
String source = |
1057 |
"public class X {\n" + |
1048 |
"public class X {\n" + |
1058 |
" /**\n" + |
1049 |
" /**\n" + |
Link Here
|
1072 |
); |
1063 |
); |
1073 |
} |
1064 |
} |
1074 |
public void testBug237942b() throws JavaModelException { |
1065 |
public void testBug237942b() throws JavaModelException { |
1075 |
this.preferences.comment_line_length = 40; |
1066 |
this.formatterPrefs.comment_line_length = 40; |
1076 |
// difference with 3.3 formatter: |
1067 |
// difference with 3.3 formatter: |
1077 |
// do not split string reference as this can lead to javadoc syntax error |
1068 |
// do not split string reference as this can lead to javadoc syntax error |
1078 |
String source = |
1069 |
String source = |
Link Here
|
1094 |
); |
1085 |
); |
1095 |
} |
1086 |
} |
1096 |
public void testBug237942c() throws JavaModelException { |
1087 |
public void testBug237942c() throws JavaModelException { |
1097 |
this.preferences.comment_line_length = 40; |
1088 |
this.formatterPrefs.comment_line_length = 40; |
1098 |
// difference with 3.3 formatter: |
1089 |
// difference with 3.3 formatter: |
1099 |
// do not split string reference as this can lead to javadoc syntax error |
1090 |
// do not split string reference as this can lead to javadoc syntax error |
1100 |
String source = |
1091 |
String source = |
Link Here
|
1116 |
); |
1107 |
); |
1117 |
} |
1108 |
} |
1118 |
public void testBug237942d() throws JavaModelException { |
1109 |
public void testBug237942d() throws JavaModelException { |
1119 |
this.preferences.comment_line_length = 40; |
1110 |
this.formatterPrefs.comment_line_length = 40; |
1120 |
// difference with 3.3 formatter: |
1111 |
// difference with 3.3 formatter: |
1121 |
// do not split string reference as this can lead to javadoc syntax error |
1112 |
// do not split string reference as this can lead to javadoc syntax error |
1122 |
String source = |
1113 |
String source = |
Link Here
|
1162 |
); |
1153 |
); |
1163 |
} |
1154 |
} |
1164 |
|
1155 |
|
|
|
1156 |
//static { TESTS_PREFIX = "testBug234583"; } |
1157 |
/** |
1158 |
* @bug 234583: [formatter] Code formatter should adapt edits instead of regions |
1159 |
* @test Ensure that selected region(s) are correctly formatted |
1160 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=234583" |
1161 |
*/ |
1162 |
public void testBug234583a() throws JavaModelException { |
1163 |
String source = |
1164 |
"public class X {\n" + |
1165 |
"[# int i= 1; #]\n" + |
1166 |
"}\n"; |
1167 |
formatSource(source, |
1168 |
"public class X {\n" + |
1169 |
" int i = 1;\n" + |
1170 |
"}\n" |
1171 |
); |
1172 |
} |
1173 |
public void testBug234583b() throws JavaModelException { |
1174 |
String source = |
1175 |
"public class X { \n" + |
1176 |
"\n" + |
1177 |
"\n" + |
1178 |
"\n" + |
1179 |
"[# int i= 1; #]\n" + |
1180 |
"\n" + |
1181 |
"\n" + |
1182 |
"\n" + |
1183 |
"\n" + |
1184 |
" }\n"; |
1185 |
formatSource(source, |
1186 |
"public class X { \n" + |
1187 |
"\n" + |
1188 |
"\n" + |
1189 |
"\n" + |
1190 |
" int i = 1;\n" + |
1191 |
"\n" + |
1192 |
"\n" + |
1193 |
"\n" + |
1194 |
"\n" + |
1195 |
" }\n" |
1196 |
); |
1197 |
} |
1198 |
public void testBug234583c() throws JavaModelException { |
1199 |
String source = |
1200 |
"public class X { \n" + |
1201 |
"\n" + |
1202 |
"\n" + |
1203 |
"\n" + |
1204 |
"[# int i= 1; \n" + |
1205 |
"#]\n" + |
1206 |
"\n" + |
1207 |
"\n" + |
1208 |
"\n" + |
1209 |
" }\n"; |
1210 |
formatSource(source, |
1211 |
"public class X { \n" + |
1212 |
"\n" + |
1213 |
"\n" + |
1214 |
"\n" + |
1215 |
" int i = 1;\n" + |
1216 |
"\n" + |
1217 |
"\n" + |
1218 |
"\n" + |
1219 |
" }\n" |
1220 |
); |
1221 |
} |
1222 |
public void testBug234583d() throws JavaModelException { |
1223 |
String source = |
1224 |
"public class X { \n" + |
1225 |
"\n" + |
1226 |
"\n" + |
1227 |
"[#\n" + |
1228 |
" int i= 1; \n" + |
1229 |
"\n" + |
1230 |
"#]\n" + |
1231 |
"\n" + |
1232 |
"\n" + |
1233 |
" }\n"; |
1234 |
formatSource(source, |
1235 |
"public class X { \n" + |
1236 |
"\n" + |
1237 |
"\n" + |
1238 |
" int i = 1;\n" + |
1239 |
"\n" + |
1240 |
"\n" + |
1241 |
" }\n" |
1242 |
); |
1243 |
} |
1244 |
public void testBug234583e() throws JavaModelException { |
1245 |
String source = |
1246 |
"public class X { \n" + |
1247 |
"\n" + |
1248 |
"[#\n" + |
1249 |
"\n" + |
1250 |
" int i= 1; \n" + |
1251 |
"\n" + |
1252 |
"\n" + |
1253 |
"#]\n" + |
1254 |
"\n" + |
1255 |
" }\n"; |
1256 |
formatSource(source, |
1257 |
"public class X { \n" + |
1258 |
"\n" + |
1259 |
" int i = 1;\n" + |
1260 |
"\n" + |
1261 |
" }\n" |
1262 |
); |
1263 |
} |
1264 |
public void testBug234583f() throws JavaModelException { |
1265 |
String source = |
1266 |
"public class X { \n" + |
1267 |
"[#\n" + |
1268 |
"\n" + |
1269 |
"\n" + |
1270 |
" int i= 1; \n" + |
1271 |
"\n" + |
1272 |
"\n" + |
1273 |
"\n" + |
1274 |
"#]\n" + |
1275 |
" }\n"; |
1276 |
formatSource(source, |
1277 |
"public class X { \n" + |
1278 |
"\n" + |
1279 |
" int i = 1;\n" + |
1280 |
"\n" + |
1281 |
" }\n" |
1282 |
); |
1283 |
} |
1284 |
public void testBug234583g() throws JavaModelException { |
1285 |
String source = |
1286 |
"public class X { [#\n" + |
1287 |
"\n" + |
1288 |
"\n" + |
1289 |
"\n" + |
1290 |
" int i= 1; \n" + |
1291 |
"\n" + |
1292 |
"\n" + |
1293 |
"\n" + |
1294 |
"\n" + |
1295 |
"#] }\n"; |
1296 |
formatSource(source, |
1297 |
"public class X { \n" + |
1298 |
"\n" + |
1299 |
" int i = 1;\n" + |
1300 |
"\n" + |
1301 |
" }\n" |
1302 |
); |
1303 |
} |
1304 |
public void testBug234583h() throws JavaModelException { |
1305 |
String source = |
1306 |
"public class X { [# \n" + |
1307 |
"\n" + |
1308 |
"\n" + |
1309 |
"\n" + |
1310 |
" int i= 1; \n" + |
1311 |
"\n" + |
1312 |
"\n" + |
1313 |
"\n" + |
1314 |
"\n" + |
1315 |
" #] }\n"; |
1316 |
formatSource(source, |
1317 |
"public class X { \n" + |
1318 |
"\n" + |
1319 |
" int i = 1;\n" + |
1320 |
"\n" + |
1321 |
" }\n" |
1322 |
); |
1323 |
} |
1324 |
public void testBug234583i() throws JavaModelException { |
1325 |
String source = |
1326 |
"public class X {[# \n" + |
1327 |
"\n" + |
1328 |
"\n" + |
1329 |
"\n" + |
1330 |
" int i= 1; \n" + |
1331 |
"\n" + |
1332 |
"\n" + |
1333 |
"\n" + |
1334 |
"\n" + |
1335 |
" #]}\n"; |
1336 |
formatSource(source, |
1337 |
"public class X {\n" + |
1338 |
"\n" + |
1339 |
" int i = 1;\n" + |
1340 |
"\n" + |
1341 |
"}\n" |
1342 |
); |
1343 |
} |
1344 |
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=239447 |
1345 |
public void testBug234583_Bug239447() throws JavaModelException { |
1346 |
String source = |
1347 |
"public class Bug239447 {\n" + |
1348 |
" private static final String CONTENT = \"test.ObjectB {\\n\"\n" + |
1349 |
"[# + \" multiEle = { name=\\\"Foo\\\" }\\n\"#]\n" + |
1350 |
" + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + |
1351 |
" + \"}\";\n" + |
1352 |
"\n" + |
1353 |
"}\n"; |
1354 |
formatSource(source, |
1355 |
"public class Bug239447 {\n" + |
1356 |
" private static final String CONTENT = \"test.ObjectB {\\n\"\n" + |
1357 |
" + \" multiEle = { name=\\\"Foo\\\" }\\n\"\n" + |
1358 |
" + \" multiEle = :x { name=\\\"Bar\\\" }\\n\" + \" singleEle = x;\\n\"\n" + |
1359 |
" + \"}\";\n" + |
1360 |
"\n" + |
1361 |
"}\n" |
1362 |
); |
1363 |
} |
1364 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=237453 |
1365 |
public void testBug234583_Bug237453a() throws JavaModelException { |
1366 |
String source = |
1367 |
"package test1;\n" + |
1368 |
"\n" + |
1369 |
"public class E1 {\n" + |
1370 |
" void foo() {\n" + |
1371 |
" }\n" + |
1372 |
" [#\n" + |
1373 |
" #]\n" + |
1374 |
" void bar() {\n" + |
1375 |
" }\n" + |
1376 |
"}"; |
1377 |
formatSource(source, |
1378 |
"package test1;\n" + |
1379 |
"\n" + |
1380 |
"public class E1 {\n" + |
1381 |
" void foo() {\n" + |
1382 |
" }\n" + |
1383 |
" \n" + |
1384 |
" void bar() {\n" + |
1385 |
" }\n" + |
1386 |
"}" |
1387 |
); |
1388 |
} |
1389 |
public void testBug234583_Bug237453b() throws JavaModelException { |
1390 |
String source = |
1391 |
"package test1;\n" + |
1392 |
"\n" + |
1393 |
"public class E1 {\n" + |
1394 |
" void foo() {\n" + |
1395 |
" }\n" + |
1396 |
" \n" + |
1397 |
"[# #]\n" + |
1398 |
" void bar() {\n" + |
1399 |
" }\n" + |
1400 |
"}"; |
1401 |
formatSource(source, |
1402 |
"package test1;\n" + |
1403 |
"\n" + |
1404 |
"public class E1 {\n" + |
1405 |
" void foo() {\n" + |
1406 |
" }\n" + |
1407 |
" \n" + |
1408 |
" \n" + |
1409 |
" void bar() {\n" + |
1410 |
" }\n" + |
1411 |
"}" |
1412 |
); |
1413 |
} |
1414 |
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=237592 |
1415 |
public void testBug234583_Bug237592() throws JavaModelException { |
1416 |
String source = |
1417 |
"package test;\n" + |
1418 |
"\n" + |
1419 |
"public class Test {\n" + |
1420 |
"\n" + |
1421 |
" void foo() {\n" + |
1422 |
" }\n" + |
1423 |
"\n" + |
1424 |
"[# #]\n" + |
1425 |
" \n" + |
1426 |
" \n" + |
1427 |
" \n" + |
1428 |
" \n" + |
1429 |
" \n" + |
1430 |
"[# #]\n" + |
1431 |
" \n" + |
1432 |
" \n" + |
1433 |
" \n" + |
1434 |
" \n" + |
1435 |
" \n" + |
1436 |
" void bar() {\n" + |
1437 |
" }\n" + |
1438 |
"\n" + |
1439 |
"}\n"; |
1440 |
formatSource(source, |
1441 |
"package test;\n" + |
1442 |
"\n" + |
1443 |
"public class Test {\n" + |
1444 |
"\n" + |
1445 |
" void foo() {\n" + |
1446 |
" }\n" + |
1447 |
"\n" + |
1448 |
" \n" + |
1449 |
" \n" + |
1450 |
" \n" + |
1451 |
" \n" + |
1452 |
" \n" + |
1453 |
" \n" + |
1454 |
" \n" + |
1455 |
" \n" + |
1456 |
" \n" + |
1457 |
" \n" + |
1458 |
" \n" + |
1459 |
" \n" + |
1460 |
" void bar() {\n" + |
1461 |
" }\n" + |
1462 |
"\n" + |
1463 |
"}\n" |
1464 |
); |
1465 |
} |
1466 |
|
1165 |
/** |
1467 |
/** |
1166 |
* @bug 236230: [formatter] SIOOBE while formatting a compilation unit. |
1468 |
* @bug 236230: [formatter] SIOOBE while formatting a compilation unit. |
1167 |
* @test Ensure that no exception occurs while formatting |
1469 |
* @test Ensure that no exception occurs while formatting |
Link Here
|
1239 |
); |
1541 |
); |
1240 |
} |
1542 |
} |
1241 |
public void testBug236230c() throws JavaModelException { |
1543 |
public void testBug236230c() throws JavaModelException { |
1242 |
this.preferences.comment_format_header = true; |
1544 |
this.formatterPrefs.comment_format_header = true; |
1243 |
String source = |
1545 |
String source = |
1244 |
"/**\n" + |
1546 |
"/**\n" + |
1245 |
" * Need a javadoc comment before to get the exception.\n" + |
1547 |
" * Need a javadoc comment before to get the exception.\n" + |
Link Here
|
1493 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238090" |
1795 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238090" |
1494 |
*/ |
1796 |
*/ |
1495 |
public void testBug238090() throws JavaModelException { |
1797 |
public void testBug238090() throws JavaModelException { |
1496 |
this.preferences.comment_line_length = 40; |
1798 |
this.formatterPrefs.comment_line_length = 40; |
1497 |
String source = |
1799 |
String source = |
1498 |
"package test.bugs;\n" + |
1800 |
"package test.bugs;\n" + |
1499 |
"public class LongNameClass {\n" + |
1801 |
"public class LongNameClass {\n" + |
Link Here
|
1964 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=241345" |
2266 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=241345" |
1965 |
*/ |
2267 |
*/ |
1966 |
public void testBug241345() throws JavaModelException { |
2268 |
public void testBug241345() throws JavaModelException { |
1967 |
this.preferences.comment_format_html = false; |
2269 |
this.formatterPrefs.comment_format_html = false; |
1968 |
String source = |
2270 |
String source = |
1969 |
"/**\n" + |
2271 |
"/**\n" + |
1970 |
" * <p>Should not format HTML paragraph</p>\n" + |
2272 |
" * <p>Should not format HTML paragraph</p>\n" + |