View | Details | Raw Unified | Return to bug 252556 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java (+36 lines)
Lines 545-550 Link Here
545
}
545
}
546
546
547
/**
547
/**
548
 * @bug 252556: [formatter] Spaces removed before formatted region of a compilation unit.
549
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=252556"
550
 */
551
// TODO Fix the bug... this test currently verifies that the problem still occurs!
552
public void testBug252556() {
553
	String source =
554
		"package a;\n" + 
555
		"\n" + 
556
		"public class Test {\n" + 
557
		"\n" + 
558
		"	private int field;\n" + 
559
		"	\n" + 
560
		"	[#/**\n" + 
561
		"	 * fds \n" + 
562
		"	 */#]\n" + 
563
		"	public void foo() {\n" + 
564
		"	}\n" + 
565
		"}\n";
566
	formatSource(source,
567
		"package a;\n" + 
568
		"\n" + 
569
		"public class Test {\n" + 
570
		"\n" + 
571
		"	private int field;\n" + 
572
//		"	\n" + // this is the expected untouched line
573
		"\n" + // instead the tab is removed although it is outside the selection...
574
		"	/**\n" + 
575
		"	 * fds\n" + 
576
		"	 */\n" + 
577
		"	public void foo() {\n" + 
578
		"	}\n" + 
579
		"}\n"
580
	);
581
}
582
583
/**
548
 * @bug 283467: [formatter] wrong indentation with 'Never join lines' selected
584
 * @bug 283467: [formatter] wrong indentation with 'Never join lines' selected
549
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=283467"
585
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=283467"
550
 */
586
 */
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java (-1 / +1 lines)
Lines 322-328 Link Here
322
		runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, checkNull, offset, length, null);
322
		runTest(codeFormatter, packageName, compilationUnitName, kind, indentationLevel, checkNull, offset, length, null);
323
	}
323
	}
324
324
325
	private void runTest(String input, String output, CodeFormatter codeFormatter, int kind, int indentationLevel, boolean checkNull, int offset, int length, String lineSeparator) {
325
	void runTest(String input, String output, CodeFormatter codeFormatter, int kind, int indentationLevel, boolean checkNull, int offset, int length, String lineSeparator) {
326
		String result;
326
		String result;
327
		if (length == -1) {
327
		if (length == -1) {
328
			result = runFormatter(codeFormatter, input, kind, indentationLevel, offset, input.length(), lineSeparator, true);
328
			result = runFormatter(codeFormatter, input, kind, indentationLevel, offset, input.length(), lineSeparator, true);

Return to bug 252556