Lines 110-124
Link Here
|
110 |
Assert.assertEquals(21, pos); |
110 |
Assert.assertEquals(21, pos); |
111 |
} |
111 |
} |
112 |
|
112 |
|
113 |
public void testPrevIndentationUnit4() { |
|
|
114 |
fDocument.set("\tint a;\n" + |
115 |
"\tif (true)\n" + |
116 |
"\t\treturn a\n" + |
117 |
""); |
118 |
|
119 |
int pos= fScanner.findReferencePosition(29); |
120 |
Assert.assertEquals(28, pos); |
121 |
} |
122 |
|
113 |
|
123 |
public void testPrevIndentationUnit5() { |
114 |
public void testPrevIndentationUnit5() { |
124 |
fDocument.set("\tint a;\n" + |
115 |
fDocument.set("\tint a;\n" + |
Lines 325-358
Link Here
|
325 |
Assert.assertEquals("\t\t", indent); |
316 |
Assert.assertEquals("\t\t", indent); |
326 |
} |
317 |
} |
327 |
|
318 |
|
328 |
public void testIndentation2() { |
|
|
329 |
fDocument.set("\tint a;\n" + |
330 |
"\tif (true)\n" + |
331 |
"\t\treturn a"); |
332 |
|
333 |
String indent= fScanner.computeIndentation(28).toString(); |
334 |
Assert.assertEquals("\t\t", indent); |
335 |
} |
336 |
|
337 |
public void testIndentation3() { |
338 |
fDocument.set("\tint a;\n" + |
339 |
"\tif (true)\n" + |
340 |
"\t\treturn a;"); |
341 |
|
342 |
String indent= fScanner.computeIndentation(29).toString(); |
343 |
Assert.assertEquals("\t\t", indent); |
344 |
} |
345 |
|
346 |
public void testIndentation4() { |
347 |
fDocument.set("\tint a;\n" + |
348 |
"\tif (true)\n" + |
349 |
"\t\treturn a\n" + |
350 |
""); |
351 |
|
352 |
String indent= fScanner.computeIndentation(29).toString(); |
353 |
Assert.assertEquals("\t\t", indent); |
354 |
} |
355 |
|
356 |
public void testIndentation5() { |
319 |
public void testIndentation5() { |
357 |
fDocument.set("\tint a;\n" + |
320 |
fDocument.set("\tint a;\n" + |
358 |
"\tif (true)\n" + |
321 |
"\tif (true)\n" + |
Lines 873-876
Link Here
|
873 |
Assert.assertEquals(" ", indent); |
836 |
Assert.assertEquals(" ", indent); |
874 |
|
837 |
|
875 |
} |
838 |
} |
|
|
839 |
|
840 |
public void testContinuationIndentationOfForStatement() throws Exception { |
841 |
fDocument.set("\tfor (int i = (2 * 2); i < array.length; i++) {\n" + |
842 |
"\t\t}"); |
843 |
|
844 |
String indent= fScanner.computeIndentation(22).toString(); |
845 |
Assert.assertEquals("\t\t", indent); |
846 |
indent= fScanner.computeIndentation(27).toString(); |
847 |
Assert.assertEquals("\t\t", indent); |
848 |
indent= fScanner.computeIndentation(39).toString(); |
849 |
Assert.assertEquals("\t\t", indent); |
850 |
indent= fScanner.computeIndentation(40).toString(); |
851 |
Assert.assertEquals("\t\t", indent); |
852 |
indent= fScanner.computeIndentation(5).toString(); |
853 |
Assert.assertEquals("\t", indent); |
854 |
indent= fScanner.computeIndentation(45).toString(); |
855 |
Assert.assertEquals("\t", indent); |
856 |
} |
857 |
|
858 |
public void testContinuationIndentationOfBooleanExpression() throws Exception { |
859 |
fDocument.set("\tboolean a = true || false;\n" + |
860 |
"\tboolean b = a || false;\n"); |
861 |
|
862 |
String indent= fScanner.computeIndentation(20).toString(); |
863 |
Assert.assertEquals("\t\t", indent); |
864 |
indent= fScanner.computeIndentation(40).toString(); |
865 |
Assert.assertEquals("\t\t", indent); |
866 |
} |
867 |
|
868 |
public void testContinuationIndentationOfReturnStatement() throws Exception { |
869 |
fDocument.set("\t\treturn \"I'm such a long string that you have to split me to see the whole line without scrolling around\"\n"); |
870 |
|
871 |
String indent= fScanner.computeIndentation(8).toString(); |
872 |
Assert.assertEquals("\t\t\t", indent); |
873 |
indent= fScanner.computeIndentation(21).toString(); |
874 |
Assert.assertEquals("\t\t\t", indent); |
875 |
indent= fScanner.computeIndentation(38).toString(); |
876 |
Assert.assertEquals("\t\t\t", indent); |
877 |
} |
878 |
|
879 |
public void testContinuationIndentationOfAssignmentStatement() throws Exception { |
880 |
fDocument.set("\tint i= 5+"); |
881 |
|
882 |
String indent= fScanner.computeIndentation(7).toString(); |
883 |
Assert.assertEquals("\t\t", indent); |
884 |
indent= fScanner.computeIndentation(10).toString(); |
885 |
Assert.assertEquals("\t\t", indent); |
886 |
} |
887 |
|
888 |
public void testContinuationIndentation1() throws Exception { |
889 |
fDocument.set("\treturn (thisIsAVeryLongName == 1 && anotherVeryLongName == 1)\n" + |
890 |
"\t\t|| thisIsAVeryLongName == 2;"); |
891 |
|
892 |
String indent= fScanner.computeIndentation(68).toString(); |
893 |
Assert.assertEquals("\t\t", indent); |
894 |
indent= fScanner.computeIndentation(88).toString(); |
895 |
Assert.assertEquals("\t\t", indent); |
896 |
} |
897 |
|
898 |
public void testContinuationIndentation2() { |
899 |
fDocument.set("\tint a;\n" + |
900 |
"\tif (true)\n" + |
901 |
"\t\treturn a\n" + |
902 |
""); |
903 |
|
904 |
int pos= fScanner.findReferencePosition(29); |
905 |
Assert.assertEquals(21, pos); |
906 |
} |
907 |
|
908 |
public void testContinuationIndentation3() { |
909 |
fDocument.set("\tint a;\n" + |
910 |
"\tif (true)\n" + |
911 |
"\t\treturn a"); |
912 |
|
913 |
String indent= fScanner.computeIndentation(28).toString(); |
914 |
Assert.assertEquals("\t\t\t", indent); |
915 |
} |
916 |
|
917 |
public void testContinuationIndentation4() { |
918 |
fDocument.set("\tint a;\n" + |
919 |
"\tif (true)\n" + |
920 |
"\t\treturn a;"); |
921 |
|
922 |
String indent= fScanner.computeIndentation(29).toString(); |
923 |
Assert.assertEquals("\t\t\t", indent); |
924 |
} |
925 |
|
926 |
public void testContinuationIndentation5() { |
927 |
fDocument.set("\tint a;\n" + |
928 |
"\tif (true)\n" + |
929 |
"\t\treturn a\n" + |
930 |
""); |
931 |
|
932 |
String indent= fScanner.computeIndentation(29).toString(); |
933 |
Assert.assertEquals("\t\t\t", indent); |
934 |
} |
876 |
} |
935 |
} |