Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.formatter.comment; |
11 |
package org.eclipse.jdt.core.tests.formatter.comment; |
12 |
|
12 |
|
|
|
13 |
import java.util.Map; |
14 |
|
13 |
import org.eclipse.jdt.core.formatter.CodeFormatter; |
15 |
import org.eclipse.jdt.core.formatter.CodeFormatter; |
14 |
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; |
16 |
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; |
15 |
|
17 |
|
Link Here
|
18 |
import org.eclipse.jdt.internal.formatter.comment.MultiCommentLine; |
20 |
import org.eclipse.jdt.internal.formatter.comment.MultiCommentLine; |
19 |
|
21 |
|
20 |
public class MultiLineTestCase extends CommentTestCase { |
22 |
public class MultiLineTestCase extends CommentTestCase { |
21 |
|
23 |
static { |
|
|
24 |
// TESTS_NAMES = new String[] { "test75460" } ; |
25 |
} |
22 |
protected static final String INFIX= MultiCommentLine.MULTI_COMMENT_CONTENT_PREFIX; |
26 |
protected static final String INFIX= MultiCommentLine.MULTI_COMMENT_CONTENT_PREFIX; |
23 |
|
27 |
|
24 |
protected static final String POSTFIX= MultiCommentLine.MULTI_COMMENT_END_PREFIX; |
28 |
protected static final String POSTFIX= MultiCommentLine.MULTI_COMMENT_END_PREFIX; |
Link Here
|
97 |
} |
101 |
} |
98 |
|
102 |
|
99 |
public void testNoFormat1() { |
103 |
public void testNoFormat1() { |
100 |
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT, DefaultCodeFormatterConstants.FALSE); |
104 |
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, DefaultCodeFormatterConstants.FALSE); |
101 |
String content= PREFIX + DELIMITER + INFIX + "test" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX; |
105 |
String content= PREFIX + DELIMITER + INFIX + "test" + DELIMITER + INFIX + "test" + DELIMITER + POSTFIX; |
102 |
assertEquals(content, testFormat(content)); |
106 |
assertEquals(content, testFormat(content)); |
103 |
} |
107 |
} |
Link Here
|
116 |
" */"; |
120 |
" */"; |
117 |
assertEquals("Different output", expectedOutput, result); |
121 |
assertEquals("Different output", expectedOutput, result); |
118 |
} |
122 |
} |
|
|
123 |
|
124 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75460 |
125 |
public void _test75460() { |
126 |
Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); |
127 |
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "200"); |
128 |
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, DefaultCodeFormatterConstants.TRUE); |
129 |
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, DefaultCodeFormatterConstants.FALSE); |
130 |
|
131 |
String input = "/*" + DELIMITER + |
132 |
"<pre>"+ DELIMITER + |
133 |
" Object[] objects = new Object[3];" + DELIMITER + |
134 |
" objects[0] = new String(\"Hallo Welt !!!\");" + DELIMITER + |
135 |
" objects[1] = new String(\"Test !!!\");" + DELIMITER + |
136 |
" objects[2] = new Integer(\"1980\");" + DELIMITER + |
137 |
" ObjectFile.write(pathname, objects);" + DELIMITER + |
138 |
" Object[] objs = ObjectFile.read(pathname);" + DELIMITER + |
139 |
" for(int i = 0; i < objs.length; i++)" + DELIMITER + |
140 |
" {" + DELIMITER + |
141 |
" System.out.println(objs[i].toString());" + DELIMITER + |
142 |
" }" + DELIMITER + |
143 |
"</pre>"+ DELIMITER + |
144 |
"*/"; |
145 |
|
146 |
String expected = "/**" + DELIMITER + |
147 |
" * Creates a new instance of DynamicEventChannel sdf sdfs dsdf dsfsd fd fsd fsdf" + DELIMITER + |
148 |
" * sdf dsfsd (on the same line)" + DELIMITER + |
149 |
" * " + DELIMITER + |
150 |
" * @pre obj != null" + DELIMITER + |
151 |
" */"; |
152 |
String result=testFormat(input, options); |
153 |
assertEquals(expected, result); |
154 |
} |
119 |
} |
155 |
} |