OLD | NEW |
1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
3 library engine.test_support; | 3 library engine.test_support; |
4 import 'dart:collection'; | 4 import 'dart:collection'; |
5 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 5 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 6 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 7 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
8 import 'package:analyzer_experimental/src/generated/source.dart'; | 8 import 'package:analyzer_experimental/src/generated/source.dart'; |
9 import 'package:analyzer_experimental/src/generated/error.dart'; | 9 import 'package:analyzer_experimental/src/generated/error.dart'; |
10 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 10 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 * is ignored. | 309 * is ignored. |
310 * @param errorCodes the errors that should have been gathered | 310 * @param errorCodes the errors that should have been gathered |
311 * @throws AssertionFailedError with | 311 * @throws AssertionFailedError with |
312 */ | 312 */ |
313 void fail(List<AnalysisError> expectedErrors) { | 313 void fail(List<AnalysisError> expectedErrors) { |
314 PrintStringWriter writer = new PrintStringWriter(); | 314 PrintStringWriter writer = new PrintStringWriter(); |
315 writer.print("Expected "); | 315 writer.print("Expected "); |
316 writer.print(expectedErrors.length); | 316 writer.print(expectedErrors.length); |
317 writer.print(" errors:"); | 317 writer.print(" errors:"); |
318 for (AnalysisError error in expectedErrors) { | 318 for (AnalysisError error in expectedErrors) { |
319 Source source2 = error.source; | 319 Source source = error.source; |
320 LineInfo lineInfo = _lineInfoMap[source2]; | 320 LineInfo lineInfo = _lineInfoMap[source]; |
321 writer.newLine(); | 321 writer.newLine(); |
322 if (lineInfo == null) { | 322 if (lineInfo == null) { |
323 int offset2 = error.offset; | 323 int offset = error.offset; |
324 writer.printf(" %s %s (%d..%d)", [source2 == null ? "" : source2.shortN
ame, error.errorCode, offset2, offset2 + error.length]); | 324 writer.printf(" %s %s (%d..%d)", [source == null ? "" : source.shortNam
e, error.errorCode, offset, offset + error.length]); |
325 } else { | 325 } else { |
326 LineInfo_Location location = lineInfo.getLocation(error.offset); | 326 LineInfo_Location location = lineInfo.getLocation(error.offset); |
327 writer.printf(" %s %s (%d, %d/%d)", [source2 == null ? "" : source2.sho
rtName, error.errorCode, location.lineNumber, location.columnNumber, error.lengt
h]); | 327 writer.printf(" %s %s (%d, %d/%d)", [source == null ? "" : source.short
Name, error.errorCode, location.lineNumber, location.columnNumber, error.length]
); |
328 } | 328 } |
329 } | 329 } |
330 writer.newLine(); | 330 writer.newLine(); |
331 writer.print("found "); | 331 writer.print("found "); |
332 writer.print(_errors.length); | 332 writer.print(_errors.length); |
333 writer.print(" errors:"); | 333 writer.print(" errors:"); |
334 for (AnalysisError error in _errors) { | 334 for (AnalysisError error in _errors) { |
335 Source source3 = error.source; | 335 Source source = error.source; |
336 LineInfo lineInfo = _lineInfoMap[source3]; | 336 LineInfo lineInfo = _lineInfoMap[source]; |
337 writer.newLine(); | 337 writer.newLine(); |
338 if (lineInfo == null) { | 338 if (lineInfo == null) { |
339 int offset3 = error.offset; | 339 int offset = error.offset; |
340 writer.printf(" %s %s (%d..%d): %s", [source3 == null ? "" : source3.sh
ortName, error.errorCode, offset3, offset3 + error.length, error.message]); | 340 writer.printf(" %s %s (%d..%d): %s", [source == null ? "" : source.shor
tName, error.errorCode, offset, offset + error.length, error.message]); |
341 } else { | 341 } else { |
342 LineInfo_Location location = lineInfo.getLocation(error.offset); | 342 LineInfo_Location location = lineInfo.getLocation(error.offset); |
343 writer.printf(" %s %s (%d, %d/%d): %s", [source3 == null ? "" : source3
.shortName, error.errorCode, location.lineNumber, location.columnNumber, error.l
ength, error.message]); | 343 writer.printf(" %s %s (%d, %d/%d): %s", [source == null ? "" : source.s
hortName, error.errorCode, location.lineNumber, location.columnNumber, error.len
gth, error.message]); |
344 } | 344 } |
345 } | 345 } |
346 JUnitTestCase.fail(writer.toString()); | 346 JUnitTestCase.fail(writer.toString()); |
347 } | 347 } |
348 | 348 |
349 /** | 349 /** |
350 * Search through the given list of errors for an error that is equal to the t
arget error. If one | 350 * Search through the given list of errors for an error that is equal to the t
arget error. If one |
351 * is found, remove it from the list and return {@code true}, otherwise return
{@code false}without modifying the list. | 351 * is found, remove it from the list and return {@code true}, otherwise return
{@code false}without modifying the list. |
352 * @param errors the errors through which we are searching | 352 * @param errors the errors through which we are searching |
353 * @param targetError the error being searched for | 353 * @param targetError the error being searched for |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 return trampoline(target, arguments[0], arguments[1]); | 785 return trampoline(target, arguments[0], arguments[1]); |
786 case 3: | 786 case 3: |
787 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 787 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
788 case 4: | 788 case 4: |
789 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 789 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
790 default: | 790 default: |
791 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 791 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
792 } | 792 } |
793 } | 793 } |
794 } | 794 } |
OLD | NEW |