Lines 49-64
public class CCBracketCompletionUnitTest
Link Here
|
49 |
// ------- Tests for completion of right parenthesis ')' ------------- |
49 |
// ------- Tests for completion of right parenthesis ')' ------------- |
50 |
|
50 |
|
51 |
public void testRightParenSimpleMethodCall() { |
51 |
public void testRightParenSimpleMethodCall() { |
|
|
52 |
setDefaultsOptions(); |
52 |
setLoadDocumentText("m()|)"); |
53 |
setLoadDocumentText("m()|)"); |
53 |
assertTrue(isSkipRightParen()); |
54 |
assertTrue(isSkipRightParen()); |
54 |
} |
55 |
} |
55 |
|
56 |
|
56 |
public void testRightParenSwingInvokeLaterRunnable() { |
57 |
public void testRightParenSwingInvokeLaterRunnable() { |
|
|
58 |
setDefaultsOptions(); |
57 |
setLoadDocumentText("SwingUtilities.invokeLater(new Runnable()|))"); |
59 |
setLoadDocumentText("SwingUtilities.invokeLater(new Runnable()|))"); |
58 |
assertTrue(isSkipRightParen()); |
60 |
assertTrue(isSkipRightParen()); |
59 |
} |
61 |
} |
60 |
|
62 |
|
61 |
public void testRightParenSwingInvokeLaterRunnableRun() { |
63 |
public void testRightParenSwingInvokeLaterRunnableRun() { |
|
|
64 |
setDefaultsOptions(); |
62 |
setLoadDocumentText( |
65 |
setLoadDocumentText( |
63 |
"SwingUtilities.invokeLater(new Runnable() {\n" |
66 |
"SwingUtilities.invokeLater(new Runnable() {\n" |
64 |
+ " public void run()|)\n" |
67 |
+ " public void run()|)\n" |
Lines 69-74
public class CCBracketCompletionUnitTest
Link Here
|
69 |
} |
72 |
} |
70 |
|
73 |
|
71 |
public void testRightParenIfMethodCall() { |
74 |
public void testRightParenIfMethodCall() { |
|
|
75 |
setDefaultsOptions(); |
72 |
setLoadDocumentText( |
76 |
setLoadDocumentText( |
73 |
" if (a()|) + 5 > 6) {\n" |
77 |
" if (a()|) + 5 > 6) {\n" |
74 |
+ " }" |
78 |
+ " }" |
Lines 77-87
public class CCBracketCompletionUnitTest
Link Here
|
77 |
} |
81 |
} |
78 |
|
82 |
|
79 |
public void testRightParenNoSkipNonBracketChar() { |
83 |
public void testRightParenNoSkipNonBracketChar() { |
|
|
84 |
setDefaultsOptions(); |
80 |
setLoadDocumentText("m()| "); |
85 |
setLoadDocumentText("m()| "); |
81 |
assertFalse(isSkipRightParen()); |
86 |
assertFalse(isSkipRightParen()); |
82 |
} |
87 |
} |
83 |
|
88 |
|
84 |
public void testRightParenNoSkipDocEnd() { |
89 |
public void testRightParenNoSkipDocEnd() { |
|
|
90 |
setDefaultsOptions(); |
85 |
setLoadDocumentText("m()|"); |
91 |
setLoadDocumentText("m()|"); |
86 |
assertFalse(isSkipRightParen()); |
92 |
assertFalse(isSkipRightParen()); |
87 |
} |
93 |
} |
Lines 90-115
public class CCBracketCompletionUnitTest
Link Here
|
90 |
// ------- Tests for completion of right brace '}' ------------- |
96 |
// ------- Tests for completion of right brace '}' ------------- |
91 |
|
97 |
|
92 |
public void testAddRightBraceIfLeftBrace() { |
98 |
public void testAddRightBraceIfLeftBrace() { |
|
|
99 |
setDefaultsOptions(); |
93 |
setLoadDocumentText("if (true) {|"); |
100 |
setLoadDocumentText("if (true) {|"); |
94 |
assertTrue(isAddRightBrace()); |
101 |
assertTrue(isAddRightBrace()); |
95 |
} |
102 |
} |
96 |
|
103 |
|
97 |
public void testAddRightBraceIfLeftBraceWhiteSpace() { |
104 |
public void testAddRightBraceIfLeftBraceWhiteSpace() { |
|
|
105 |
setDefaultsOptions(); |
98 |
setLoadDocumentText("if (true) { \t|\n"); |
106 |
setLoadDocumentText("if (true) { \t|\n"); |
99 |
assertTrue(isAddRightBrace()); |
107 |
assertTrue(isAddRightBrace()); |
100 |
} |
108 |
} |
101 |
|
109 |
|
102 |
public void testAddRightBraceIfLeftBraceLineComment() { |
110 |
public void testAddRightBraceIfLeftBraceLineComment() { |
|
|
111 |
setDefaultsOptions(); |
103 |
setLoadDocumentText("if (true) { // line-comment|\n"); |
112 |
setLoadDocumentText("if (true) { // line-comment|\n"); |
104 |
assertTrue(isAddRightBrace()); |
113 |
assertTrue(isAddRightBrace()); |
105 |
} |
114 |
} |
106 |
|
115 |
|
107 |
public void testAddRightBraceIfLeftBraceBlockComment() { |
116 |
public void testAddRightBraceIfLeftBraceBlockComment() { |
|
|
117 |
setDefaultsOptions(); |
108 |
setLoadDocumentText("if (true) { /* block-comment */|\n"); |
118 |
setLoadDocumentText("if (true) { /* block-comment */|\n"); |
109 |
assertTrue(isAddRightBrace()); |
119 |
assertTrue(isAddRightBrace()); |
110 |
} |
120 |
} |
111 |
|
121 |
|
112 |
public void testAddRightBraceIfLeftBraceAlreadyPresent() { |
122 |
public void testAddRightBraceIfLeftBraceAlreadyPresent() { |
|
|
123 |
setDefaultsOptions(); |
113 |
setLoadDocumentText( |
124 |
setLoadDocumentText( |
114 |
"if (true) {|\n" |
125 |
"if (true) {|\n" |
115 |
+ "}" |
126 |
+ "}" |
Lines 118-123
public class CCBracketCompletionUnitTest
Link Here
|
118 |
} |
129 |
} |
119 |
|
130 |
|
120 |
public void testAddRightBraceCaretInComment() { |
131 |
public void testAddRightBraceCaretInComment() { |
|
|
132 |
setDefaultsOptions(); |
121 |
setLoadDocumentText( |
133 |
setLoadDocumentText( |
122 |
"if (true) { /* in-block-comment |\n" |
134 |
"if (true) { /* in-block-comment |\n" |
123 |
); |
135 |
); |
Lines 125-130
public class CCBracketCompletionUnitTest
Link Here
|
125 |
} |
137 |
} |
126 |
|
138 |
|
127 |
public void testSimpleAdditionOfOpeningParenthesisAfterWhile () throws Exception { |
139 |
public void testSimpleAdditionOfOpeningParenthesisAfterWhile () throws Exception { |
|
|
140 |
setDefaultsOptions(); |
128 |
setLoadDocumentText ( |
141 |
setLoadDocumentText ( |
129 |
"while |" |
142 |
"while |" |
130 |
); |
143 |
); |
Lines 137-142
public class CCBracketCompletionUnitTest
Link Here
|
137 |
|
150 |
|
138 |
// ------- Tests for completion of quote (") ------------- |
151 |
// ------- Tests for completion of quote (") ------------- |
139 |
public void testSimpleQuoteInEmptyDoc () throws Exception { |
152 |
public void testSimpleQuoteInEmptyDoc () throws Exception { |
|
|
153 |
setDefaultsOptions(); |
140 |
setLoadDocumentText ( |
154 |
setLoadDocumentText ( |
141 |
"|" |
155 |
"|" |
142 |
); |
156 |
); |
Lines 147-152
public class CCBracketCompletionUnitTest
Link Here
|
147 |
} |
161 |
} |
148 |
|
162 |
|
149 |
public void testSimpleQuoteAtBeginingOfDoc () throws Exception { |
163 |
public void testSimpleQuoteAtBeginingOfDoc () throws Exception { |
|
|
164 |
setDefaultsOptions(); |
150 |
setLoadDocumentText ( |
165 |
setLoadDocumentText ( |
151 |
"| " |
166 |
"| " |
152 |
); |
167 |
); |
Lines 157-162
public class CCBracketCompletionUnitTest
Link Here
|
157 |
} |
172 |
} |
158 |
|
173 |
|
159 |
public void testSimpleQuoteAtEndOfDoc () throws Exception { |
174 |
public void testSimpleQuoteAtEndOfDoc () throws Exception { |
|
|
175 |
setDefaultsOptions(); |
160 |
setLoadDocumentText ( |
176 |
setLoadDocumentText ( |
161 |
" |" |
177 |
" |" |
162 |
); |
178 |
); |
Lines 167-172
public class CCBracketCompletionUnitTest
Link Here
|
167 |
} |
183 |
} |
168 |
|
184 |
|
169 |
public void testSimpleQuoteInWhiteSpaceArea () throws Exception { |
185 |
public void testSimpleQuoteInWhiteSpaceArea () throws Exception { |
|
|
186 |
setDefaultsOptions(); |
170 |
setLoadDocumentText ( |
187 |
setLoadDocumentText ( |
171 |
" | " |
188 |
" | " |
172 |
); |
189 |
); |
Lines 177-182
public class CCBracketCompletionUnitTest
Link Here
|
177 |
} |
194 |
} |
178 |
|
195 |
|
179 |
public void testQuoteAtEOL () throws Exception { |
196 |
public void testQuoteAtEOL () throws Exception { |
|
|
197 |
setDefaultsOptions(); |
180 |
setLoadDocumentText ( |
198 |
setLoadDocumentText ( |
181 |
" |\n" |
199 |
" |\n" |
182 |
); |
200 |
); |
Lines 187-192
public class CCBracketCompletionUnitTest
Link Here
|
187 |
} |
205 |
} |
188 |
|
206 |
|
189 |
public void testQuoteWithUnterminatedStringLiteral () throws Exception { |
207 |
public void testQuoteWithUnterminatedStringLiteral () throws Exception { |
|
|
208 |
setDefaultsOptions(); |
190 |
setLoadDocumentText ( |
209 |
setLoadDocumentText ( |
191 |
" \"unterminated string| \n" |
210 |
" \"unterminated string| \n" |
192 |
); |
211 |
); |
Lines 197-202
public class CCBracketCompletionUnitTest
Link Here
|
197 |
} |
216 |
} |
198 |
|
217 |
|
199 |
public void testQuoteAtEOLWithUnterminatedStringLiteral () throws Exception { |
218 |
public void testQuoteAtEOLWithUnterminatedStringLiteral () throws Exception { |
|
|
219 |
setDefaultsOptions(); |
200 |
setLoadDocumentText ( |
220 |
setLoadDocumentText ( |
201 |
" \"unterminated string |\n" |
221 |
" \"unterminated string |\n" |
202 |
); |
222 |
); |
Lines 207-212
public class CCBracketCompletionUnitTest
Link Here
|
207 |
} |
227 |
} |
208 |
|
228 |
|
209 |
public void testQuoteInsideStringLiteral () throws Exception { |
229 |
public void testQuoteInsideStringLiteral () throws Exception { |
|
|
230 |
setDefaultsOptions(); |
210 |
setLoadDocumentText ( |
231 |
setLoadDocumentText ( |
211 |
" \"stri|ng literal\" " |
232 |
" \"stri|ng literal\" " |
212 |
); |
233 |
); |
Lines 217-222
public class CCBracketCompletionUnitTest
Link Here
|
217 |
} |
238 |
} |
218 |
|
239 |
|
219 |
public void testQuoteInsideEmptyParentheses () throws Exception { |
240 |
public void testQuoteInsideEmptyParentheses () throws Exception { |
|
|
241 |
setDefaultsOptions(); |
220 |
setLoadDocumentText ( |
242 |
setLoadDocumentText ( |
221 |
" printf(|) " |
243 |
" printf(|) " |
222 |
); |
244 |
); |
Lines 227-232
public class CCBracketCompletionUnitTest
Link Here
|
227 |
} |
249 |
} |
228 |
|
250 |
|
229 |
public void testQuoteInsideNonEmptyParentheses () throws Exception { |
251 |
public void testQuoteInsideNonEmptyParentheses () throws Exception { |
|
|
252 |
setDefaultsOptions(); |
230 |
setLoadDocumentText ( |
253 |
setLoadDocumentText ( |
231 |
" printf(|some text) " |
254 |
" printf(|some text) " |
232 |
); |
255 |
); |
Lines 237-242
public class CCBracketCompletionUnitTest
Link Here
|
237 |
} |
260 |
} |
238 |
|
261 |
|
239 |
public void testQuoteInsideNonEmptyParenthesesBeforeClosingParentheses () throws Exception { |
262 |
public void testQuoteInsideNonEmptyParenthesesBeforeClosingParentheses () throws Exception { |
|
|
263 |
setDefaultsOptions(); |
240 |
setLoadDocumentText ( |
264 |
setLoadDocumentText ( |
241 |
" printf(i+|) " |
265 |
" printf(i+|) " |
242 |
); |
266 |
); |
Lines 247-252
public class CCBracketCompletionUnitTest
Link Here
|
247 |
} |
271 |
} |
248 |
|
272 |
|
249 |
public void testQuoteInsideNonEmptyParenthesesBeforeClosingParenthesesAndUnterminatedStringLiteral () throws Exception { |
273 |
public void testQuoteInsideNonEmptyParenthesesBeforeClosingParenthesesAndUnterminatedStringLiteral () throws Exception { |
|
|
274 |
setDefaultsOptions(); |
250 |
setLoadDocumentText ( |
275 |
setLoadDocumentText ( |
251 |
" printf(\"unterminated string literal |); " |
276 |
" printf(\"unterminated string literal |); " |
252 |
); |
277 |
); |
Lines 257-262
public class CCBracketCompletionUnitTest
Link Here
|
257 |
} |
282 |
} |
258 |
|
283 |
|
259 |
public void testQuoteBeforePlus () throws Exception { |
284 |
public void testQuoteBeforePlus () throws Exception { |
|
|
285 |
setDefaultsOptions(); |
260 |
setLoadDocumentText ( |
286 |
setLoadDocumentText ( |
261 |
" printf(|+\"string literal\"); " |
287 |
" printf(|+\"string literal\"); " |
262 |
); |
288 |
); |
Lines 267-272
public class CCBracketCompletionUnitTest
Link Here
|
267 |
} |
293 |
} |
268 |
|
294 |
|
269 |
public void testQuoteBeforeComma () throws Exception { |
295 |
public void testQuoteBeforeComma () throws Exception { |
|
|
296 |
setDefaultsOptions(); |
270 |
setLoadDocumentText ( |
297 |
setLoadDocumentText ( |
271 |
"String s[] = new String[]{|,\"two\"};" |
298 |
"String s[] = new String[]{|,\"two\"};" |
272 |
); |
299 |
); |
Lines 277-282
public class CCBracketCompletionUnitTest
Link Here
|
277 |
} |
304 |
} |
278 |
|
305 |
|
279 |
public void testQuoteBeforeBrace () throws Exception { |
306 |
public void testQuoteBeforeBrace () throws Exception { |
|
|
307 |
setDefaultsOptions(); |
280 |
setLoadDocumentText ( |
308 |
setLoadDocumentText ( |
281 |
"String s[] = new String[]{\"one\",|};" |
309 |
"String s[] = new String[]{\"one\",|};" |
282 |
); |
310 |
); |
Lines 287-292
public class CCBracketCompletionUnitTest
Link Here
|
287 |
} |
315 |
} |
288 |
|
316 |
|
289 |
public void testQuoteBeforeSemicolon() throws Exception { |
317 |
public void testQuoteBeforeSemicolon() throws Exception { |
|
|
318 |
setDefaultsOptions(); |
290 |
setLoadDocumentText ( |
319 |
setLoadDocumentText ( |
291 |
"String s = \"\" + |;" |
320 |
"String s = \"\" + |;" |
292 |
); |
321 |
); |
Lines 297-302
public class CCBracketCompletionUnitTest
Link Here
|
297 |
} |
326 |
} |
298 |
|
327 |
|
299 |
public void testQuoteBeforeSemicolonWithWhitespace() throws Exception { |
328 |
public void testQuoteBeforeSemicolonWithWhitespace() throws Exception { |
|
|
329 |
setDefaultsOptions(); |
300 |
setLoadDocumentText ( |
330 |
setLoadDocumentText ( |
301 |
"String s = \"\" +| ;" |
331 |
"String s = \"\" +| ;" |
302 |
); |
332 |
); |
Lines 307-312
public class CCBracketCompletionUnitTest
Link Here
|
307 |
} |
337 |
} |
308 |
|
338 |
|
309 |
public void testQuoteAfterEscapeSequence() throws Exception { |
339 |
public void testQuoteAfterEscapeSequence() throws Exception { |
|
|
340 |
setDefaultsOptions(); |
310 |
setLoadDocumentText ( |
341 |
setLoadDocumentText ( |
311 |
"\\|" |
342 |
"\\|" |
312 |
); |
343 |
); |
Lines 318-323
public class CCBracketCompletionUnitTest
Link Here
|
318 |
|
349 |
|
319 |
/** issue #69524 */ |
350 |
/** issue #69524 */ |
320 |
public void testQuoteEaten() throws Exception { |
351 |
public void testQuoteEaten() throws Exception { |
|
|
352 |
setDefaultsOptions(); |
321 |
setLoadDocumentText ( |
353 |
setLoadDocumentText ( |
322 |
"|" |
354 |
"|" |
323 |
); |
355 |
); |
Lines 330-335
public class CCBracketCompletionUnitTest
Link Here
|
330 |
|
362 |
|
331 |
/** issue #69935 */ |
363 |
/** issue #69935 */ |
332 |
public void testQuoteInsideComments() throws Exception { |
364 |
public void testQuoteInsideComments() throws Exception { |
|
|
365 |
setDefaultsOptions(); |
333 |
setLoadDocumentText ( |
366 |
setLoadDocumentText ( |
334 |
"/** |\n */" |
367 |
"/** |\n */" |
335 |
); |
368 |
); |
Lines 341-346
public class CCBracketCompletionUnitTest
Link Here
|
341 |
|
374 |
|
342 |
/** issue #71880 */ |
375 |
/** issue #71880 */ |
343 |
public void testQuoteAtTheEndOfLineCommentLine() throws Exception { |
376 |
public void testQuoteAtTheEndOfLineCommentLine() throws Exception { |
|
|
377 |
setDefaultsOptions(); |
344 |
setLoadDocumentText ( |
378 |
setLoadDocumentText ( |
345 |
"// test line comment |\n" |
379 |
"// test line comment |\n" |
346 |
); |
380 |
); |
Lines 354-359
public class CCBracketCompletionUnitTest
Link Here
|
354 |
// ------- Tests for completion of single quote (') ------------- |
388 |
// ------- Tests for completion of single quote (') ------------- |
355 |
|
389 |
|
356 |
public void testSingleQuoteInEmptyDoc () throws Exception { |
390 |
public void testSingleQuoteInEmptyDoc () throws Exception { |
|
|
391 |
setDefaultsOptions(); |
357 |
setLoadDocumentText ( |
392 |
setLoadDocumentText ( |
358 |
"|" |
393 |
"|" |
359 |
); |
394 |
); |
Lines 364-369
public class CCBracketCompletionUnitTest
Link Here
|
364 |
} |
399 |
} |
365 |
|
400 |
|
366 |
public void testSingleQuoteAtBeginingOfDoc () throws Exception { |
401 |
public void testSingleQuoteAtBeginingOfDoc () throws Exception { |
|
|
402 |
setDefaultsOptions(); |
367 |
setLoadDocumentText ( |
403 |
setLoadDocumentText ( |
368 |
"| " |
404 |
"| " |
369 |
); |
405 |
); |
Lines 374-379
public class CCBracketCompletionUnitTest
Link Here
|
374 |
} |
410 |
} |
375 |
|
411 |
|
376 |
public void testSingleQuoteAtEndOfDoc () throws Exception { |
412 |
public void testSingleQuoteAtEndOfDoc () throws Exception { |
|
|
413 |
setDefaultsOptions(); |
377 |
setLoadDocumentText ( |
414 |
setLoadDocumentText ( |
378 |
" |" |
415 |
" |" |
379 |
); |
416 |
); |
Lines 384-389
public class CCBracketCompletionUnitTest
Link Here
|
384 |
} |
421 |
} |
385 |
|
422 |
|
386 |
public void testSingleQuoteInWhiteSpaceArea () throws Exception { |
423 |
public void testSingleQuoteInWhiteSpaceArea () throws Exception { |
|
|
424 |
setDefaultsOptions(); |
387 |
setLoadDocumentText ( |
425 |
setLoadDocumentText ( |
388 |
" | " |
426 |
" | " |
389 |
); |
427 |
); |
Lines 394-399
public class CCBracketCompletionUnitTest
Link Here
|
394 |
} |
432 |
} |
395 |
|
433 |
|
396 |
public void testSingleQuoteAtEOL () throws Exception { |
434 |
public void testSingleQuoteAtEOL () throws Exception { |
|
|
435 |
setDefaultsOptions(); |
397 |
setLoadDocumentText ( |
436 |
setLoadDocumentText ( |
398 |
" |\n" |
437 |
" |\n" |
399 |
); |
438 |
); |
Lines 404-409
public class CCBracketCompletionUnitTest
Link Here
|
404 |
} |
443 |
} |
405 |
|
444 |
|
406 |
public void testSingleQuoteWithUnterminatedCharLiteral () throws Exception { |
445 |
public void testSingleQuoteWithUnterminatedCharLiteral () throws Exception { |
|
|
446 |
setDefaultsOptions(); |
407 |
setLoadDocumentText ( |
447 |
setLoadDocumentText ( |
408 |
" '| \n" |
448 |
" '| \n" |
409 |
); |
449 |
); |
Lines 414-419
public class CCBracketCompletionUnitTest
Link Here
|
414 |
} |
454 |
} |
415 |
|
455 |
|
416 |
public void testSingleQuoteAtEOLWithUnterminatedCharLiteral () throws Exception { |
456 |
public void testSingleQuoteAtEOLWithUnterminatedCharLiteral () throws Exception { |
|
|
457 |
setDefaultsOptions(); |
417 |
setLoadDocumentText ( |
458 |
setLoadDocumentText ( |
418 |
" ' |\n" |
459 |
" ' |\n" |
419 |
); |
460 |
); |
Lines 424-429
public class CCBracketCompletionUnitTest
Link Here
|
424 |
} |
465 |
} |
425 |
|
466 |
|
426 |
public void testSingleQuoteInsideCharLiteral () throws Exception { |
467 |
public void testSingleQuoteInsideCharLiteral () throws Exception { |
|
|
468 |
setDefaultsOptions(); |
427 |
setLoadDocumentText ( |
469 |
setLoadDocumentText ( |
428 |
" '| ' " |
470 |
" '| ' " |
429 |
); |
471 |
); |
Lines 434-439
public class CCBracketCompletionUnitTest
Link Here
|
434 |
} |
476 |
} |
435 |
|
477 |
|
436 |
public void testSingleQuoteInsideEmptyParentheses () throws Exception { |
478 |
public void testSingleQuoteInsideEmptyParentheses () throws Exception { |
|
|
479 |
setDefaultsOptions(); |
437 |
setLoadDocumentText ( |
480 |
setLoadDocumentText ( |
438 |
" printf(|) " |
481 |
" printf(|) " |
439 |
); |
482 |
); |
Lines 444-449
public class CCBracketCompletionUnitTest
Link Here
|
444 |
} |
487 |
} |
445 |
|
488 |
|
446 |
public void testSingleQuoteInsideNonEmptyParentheses () throws Exception { |
489 |
public void testSingleQuoteInsideNonEmptyParentheses () throws Exception { |
|
|
490 |
setDefaultsOptions(); |
447 |
setLoadDocumentText ( |
491 |
setLoadDocumentText ( |
448 |
" printf(|some text) " |
492 |
" printf(|some text) " |
449 |
); |
493 |
); |
Lines 454-459
public class CCBracketCompletionUnitTest
Link Here
|
454 |
} |
498 |
} |
455 |
|
499 |
|
456 |
public void testSingleQuoteInsideNonEmptyParenthesesBeforeClosingParentheses () throws Exception { |
500 |
public void testSingleQuoteInsideNonEmptyParenthesesBeforeClosingParentheses () throws Exception { |
|
|
501 |
setDefaultsOptions(); |
457 |
setLoadDocumentText ( |
502 |
setLoadDocumentText ( |
458 |
" printf(i+|) " |
503 |
" printf(i+|) " |
459 |
); |
504 |
); |
Lines 464-469
public class CCBracketCompletionUnitTest
Link Here
|
464 |
} |
509 |
} |
465 |
|
510 |
|
466 |
public void testSingleQuoteInsideNonEmptyParenthesesBeforeClosingParenthesesAndUnterminatedCharLiteral () throws Exception { |
511 |
public void testSingleQuoteInsideNonEmptyParenthesesBeforeClosingParenthesesAndUnterminatedCharLiteral () throws Exception { |
|
|
512 |
setDefaultsOptions(); |
467 |
setLoadDocumentText ( |
513 |
setLoadDocumentText ( |
468 |
" printf(' |); " |
514 |
" printf(' |); " |
469 |
); |
515 |
); |
Lines 474-479
public class CCBracketCompletionUnitTest
Link Here
|
474 |
} |
520 |
} |
475 |
|
521 |
|
476 |
public void testSingleQuoteBeforePlus () throws Exception { |
522 |
public void testSingleQuoteBeforePlus () throws Exception { |
|
|
523 |
setDefaultsOptions(); |
477 |
setLoadDocumentText ( |
524 |
setLoadDocumentText ( |
478 |
" printf(|+\"string literal\"); " |
525 |
" printf(|+\"string literal\"); " |
479 |
); |
526 |
); |
Lines 484-489
public class CCBracketCompletionUnitTest
Link Here
|
484 |
} |
531 |
} |
485 |
|
532 |
|
486 |
public void testSingleQuoteBeforeComma () throws Exception { |
533 |
public void testSingleQuoteBeforeComma () throws Exception { |
|
|
534 |
setDefaultsOptions(); |
487 |
setLoadDocumentText ( |
535 |
setLoadDocumentText ( |
488 |
"String s[] = new String[]{|,\"two\"};" |
536 |
"String s[] = new String[]{|,\"two\"};" |
489 |
); |
537 |
); |
Lines 494-499
public class CCBracketCompletionUnitTest
Link Here
|
494 |
} |
542 |
} |
495 |
|
543 |
|
496 |
public void testSingleQuoteBeforeBrace () throws Exception { |
544 |
public void testSingleQuoteBeforeBrace () throws Exception { |
|
|
545 |
setDefaultsOptions(); |
497 |
setLoadDocumentText ( |
546 |
setLoadDocumentText ( |
498 |
"String s[] = new String[]{\"one\",|};" |
547 |
"String s[] = new String[]{\"one\",|};" |
499 |
); |
548 |
); |
Lines 504-509
public class CCBracketCompletionUnitTest
Link Here
|
504 |
} |
553 |
} |
505 |
|
554 |
|
506 |
public void testSingleQuoteBeforeSemicolon() throws Exception { |
555 |
public void testSingleQuoteBeforeSemicolon() throws Exception { |
|
|
556 |
setDefaultsOptions(); |
507 |
setLoadDocumentText ( |
557 |
setLoadDocumentText ( |
508 |
"String s = \"\" + |;" |
558 |
"String s = \"\" + |;" |
509 |
); |
559 |
); |
Lines 514-519
public class CCBracketCompletionUnitTest
Link Here
|
514 |
} |
564 |
} |
515 |
|
565 |
|
516 |
public void testsingleQuoteBeforeSemicolonWithWhitespace() throws Exception { |
566 |
public void testsingleQuoteBeforeSemicolonWithWhitespace() throws Exception { |
|
|
567 |
setDefaultsOptions(); |
517 |
setLoadDocumentText ( |
568 |
setLoadDocumentText ( |
518 |
"String s = \"\" +| ;" |
569 |
"String s = \"\" +| ;" |
519 |
); |
570 |
); |
Lines 524-529
public class CCBracketCompletionUnitTest
Link Here
|
524 |
} |
575 |
} |
525 |
|
576 |
|
526 |
public void testSingleQuoteAfterEscapeSequence() throws Exception { |
577 |
public void testSingleQuoteAfterEscapeSequence() throws Exception { |
|
|
578 |
setDefaultsOptions(); |
527 |
setLoadDocumentText ( |
579 |
setLoadDocumentText ( |
528 |
"\\|" |
580 |
"\\|" |
529 |
); |
581 |
); |
Lines 535-540
public class CCBracketCompletionUnitTest
Link Here
|
535 |
|
587 |
|
536 |
/** issue #69524 */ |
588 |
/** issue #69524 */ |
537 |
public void testSingleQuoteEaten() throws Exception { |
589 |
public void testSingleQuoteEaten() throws Exception { |
|
|
590 |
setDefaultsOptions(); |
538 |
setLoadDocumentText ( |
591 |
setLoadDocumentText ( |
539 |
"|" |
592 |
"|" |
540 |
); |
593 |
); |
Lines 547-552
public class CCBracketCompletionUnitTest
Link Here
|
547 |
|
600 |
|
548 |
/** issue #69935 */ |
601 |
/** issue #69935 */ |
549 |
public void testSingleQuoteInsideComments() throws Exception { |
602 |
public void testSingleQuoteInsideComments() throws Exception { |
|
|
603 |
setDefaultsOptions(); |
550 |
setLoadDocumentText ( |
604 |
setLoadDocumentText ( |
551 |
"/* |\n */" |
605 |
"/* |\n */" |
552 |
); |
606 |
); |
Lines 558-563
public class CCBracketCompletionUnitTest
Link Here
|
558 |
|
612 |
|
559 |
/** issue #71880 */ |
613 |
/** issue #71880 */ |
560 |
public void testSingleQuoteAtTheEndOfLineCommentLine() throws Exception { |
614 |
public void testSingleQuoteAtTheEndOfLineCommentLine() throws Exception { |
|
|
615 |
setDefaultsOptions(); |
561 |
setLoadDocumentText ( |
616 |
setLoadDocumentText ( |
562 |
"// test line comment |\n" |
617 |
"// test line comment |\n" |
563 |
); |
618 |
); |
Lines 568-573
public class CCBracketCompletionUnitTest
Link Here
|
568 |
} |
623 |
} |
569 |
|
624 |
|
570 |
public void testSystemInclude() throws Exception { |
625 |
public void testSystemInclude() throws Exception { |
|
|
626 |
setDefaultsOptions(); |
571 |
setLoadDocumentText ( |
627 |
setLoadDocumentText ( |
572 |
"#include |\n" |
628 |
"#include |\n" |
573 |
); |
629 |
); |
Lines 578-583
public class CCBracketCompletionUnitTest
Link Here
|
578 |
} |
634 |
} |
579 |
|
635 |
|
580 |
public void testUserInclude() throws Exception { |
636 |
public void testUserInclude() throws Exception { |
|
|
637 |
setDefaultsOptions(); |
581 |
setLoadDocumentText ( |
638 |
setLoadDocumentText ( |
582 |
"#include |\n" |
639 |
"#include |\n" |
583 |
); |
640 |
); |
Lines 588-593
public class CCBracketCompletionUnitTest
Link Here
|
588 |
} |
645 |
} |
589 |
|
646 |
|
590 |
public void testArray() throws Exception { |
647 |
public void testArray() throws Exception { |
|
|
648 |
setDefaultsOptions(); |
591 |
setLoadDocumentText ( |
649 |
setLoadDocumentText ( |
592 |
"int a|\n" |
650 |
"int a|\n" |
593 |
); |
651 |
); |
Lines 598-603
public class CCBracketCompletionUnitTest
Link Here
|
598 |
} |
656 |
} |
599 |
|
657 |
|
600 |
public void testRightBracePreprocessor() { |
658 |
public void testRightBracePreprocessor() { |
|
|
659 |
setDefaultsOptions(); |
601 |
setLoadDocumentText( |
660 |
setLoadDocumentText( |
602 |
"void foo(){\n" + |
661 |
"void foo(){\n" + |
603 |
"#if A\n" + |
662 |
"#if A\n" + |
Lines 612-617
public class CCBracketCompletionUnitTest
Link Here
|
612 |
} |
671 |
} |
613 |
|
672 |
|
614 |
public void testRightBracePreprocessor2() { |
673 |
public void testRightBracePreprocessor2() { |
|
|
674 |
setDefaultsOptions(); |
615 |
setLoadDocumentText( |
675 |
setLoadDocumentText( |
616 |
"void foo(){\n" + |
676 |
"void foo(){\n" + |
617 |
"#if A\n" + |
677 |
"#if A\n" + |
Lines 626-631
public class CCBracketCompletionUnitTest
Link Here
|
626 |
} |
686 |
} |
627 |
|
687 |
|
628 |
public void testRightBracePreprocessor3() { |
688 |
public void testRightBracePreprocessor3() { |
|
|
689 |
setDefaultsOptions(); |
629 |
setLoadDocumentText( |
690 |
setLoadDocumentText( |
630 |
"void foo(){\n" + |
691 |
"void foo(){\n" + |
631 |
"#if A\n" + |
692 |
"#if A\n" + |
Lines 640-645
public class CCBracketCompletionUnitTest
Link Here
|
640 |
} |
701 |
} |
641 |
|
702 |
|
642 |
public void testRightBracePreprocessor4() { |
703 |
public void testRightBracePreprocessor4() { |
|
|
704 |
setDefaultsOptions(); |
643 |
setLoadDocumentText( |
705 |
setLoadDocumentText( |
644 |
"void foo(){\n" + |
706 |
"void foo(){\n" + |
645 |
"#if A\n" + |
707 |
"#if A\n" + |
Lines 655-660
public class CCBracketCompletionUnitTest
Link Here
|
655 |
} |
717 |
} |
656 |
|
718 |
|
657 |
public void testRightBracePreprocessor5() { |
719 |
public void testRightBracePreprocessor5() { |
|
|
720 |
setDefaultsOptions(); |
658 |
setLoadDocumentText( |
721 |
setLoadDocumentText( |
659 |
"void foo(){\n" + |
722 |
"void foo(){\n" + |
660 |
"#define PAREN {\n" + |
723 |
"#define PAREN {\n" + |
Lines 666-705
public class CCBracketCompletionUnitTest
Link Here
|
666 |
} |
729 |
} |
667 |
|
730 |
|
668 |
public void testIZ102091() throws Exception { |
731 |
public void testIZ102091() throws Exception { |
|
|
732 |
setDefaultsOptions(); |
669 |
EditorOptions.getPreferences(CodeStyle.getDefault(CodeStyle.Language.CPP)). |
733 |
EditorOptions.getPreferences(CodeStyle.getDefault(CodeStyle.Language.CPP)). |
670 |
put(EditorOptions.newLineBeforeBrace, |
734 |
put(EditorOptions.newLineBeforeBrace, |
671 |
CodeStyle.BracePlacement.NEW_LINE.name()); |
735 |
CodeStyle.BracePlacement.NEW_LINE.name()); |
672 |
try { |
736 |
setLoadDocumentText ( |
673 |
setLoadDocumentText ( |
737 |
"if(i)\n"+ |
674 |
"if(i)\n"+ |
738 |
" |" |
675 |
" |" |
739 |
); |
676 |
); |
740 |
typeChar('{', true); |
677 |
typeChar('{', true); |
741 |
assertDocumentTextAndCaret ("IZ102091\n", |
678 |
assertDocumentTextAndCaret ("IZ102091\n", |
742 |
"if(i)\n"+ |
679 |
"if(i)\n"+ |
743 |
"{|" |
680 |
"{|" |
744 |
); |
681 |
); |
|
|
682 |
} finally { |
683 |
EditorOptions.getPreferences(CodeStyle.getDefault(CodeStyle.Language.CPP)). |
684 |
put(EditorOptions.newLineBeforeBrace, |
685 |
CodeStyle.BracePlacement.SAME_LINE.name()); |
686 |
} |
687 |
} |
745 |
} |
688 |
|
746 |
|
689 |
// public void testColonAfterPublic() throws Exception { |
747 |
public void testColonAfterPublic() throws Exception { |
690 |
// setLoadDocumentText ( |
748 |
setDefaultsOptions(); |
691 |
// "class A{\n" + |
749 |
setLoadDocumentText ( |
692 |
// " public|\n" + |
750 |
"class A{\n" + |
693 |
// "}\n" |
751 |
" public|\n" + |
694 |
// ); |
752 |
"}\n" |
695 |
// typeChar(':'); |
753 |
); |
696 |
// assertDocumentTextAndCaret ("Colon After Public", |
754 |
typeChar(':', true); |
697 |
// "class A{\n" + |
755 |
assertDocumentText("Colon After Public", |
698 |
// "public:|\n" + |
756 |
"class A{\n" + |
699 |
// "}\n" |
757 |
"public:\n" + |
700 |
// ); |
758 |
"}\n" |
701 |
// } |
759 |
); |
|
|
760 |
} |
702 |
|
761 |
|
|
|
762 |
public void testIdentFunctionName() throws Exception { |
763 |
setDefaultsOptions("GNU"); |
764 |
setLoadDocumentText( |
765 |
"tree\n" + |
766 |
" |" |
767 |
); |
768 |
typeChar('d',true); |
769 |
assertDocumentTextAndCaret("Incorrect identing of main", |
770 |
"tree\n" + |
771 |
"d|" |
772 |
); |
773 |
} |
703 |
|
774 |
|
704 |
// ------- Private methods ------------- |
775 |
// ------- Private methods ------------- |
705 |
|
776 |
|