| 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 | 3 |
| 4 library engine.test_support; | 4 library engine.test_support; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
| 9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
| 10 import 'package:analyzer_experimental/src/generated/java_junit.dart'; | 10 import 'package:analyzer_experimental/src/generated/java_junit.dart'; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 */ | 38 */ |
| 39 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>(); | 39 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>(); |
| 40 /** | 40 /** |
| 41 * An empty array of errors used when no errors are expected. | 41 * An empty array of errors used when no errors are expected. |
| 42 */ | 42 */ |
| 43 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); | 43 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); |
| 44 /** | 44 /** |
| 45 * Initialize a newly created error listener to collect errors. | 45 * Initialize a newly created error listener to collect errors. |
| 46 */ | 46 */ |
| 47 GatheringErrorListener() : super() { | 47 GatheringErrorListener() : super() { |
| 48 _jtd_constructor_317_impl(); | 48 _jtd_constructor_321_impl(); |
| 49 } | 49 } |
| 50 _jtd_constructor_317_impl() { | 50 _jtd_constructor_321_impl() { |
| 51 } | 51 } |
| 52 /** | 52 /** |
| 53 * Initialize a newly created error listener to collect errors. | 53 * Initialize a newly created error listener to collect errors. |
| 54 */ | 54 */ |
| 55 GatheringErrorListener.con1(String rawSource2) { | 55 GatheringErrorListener.con1(String rawSource2) { |
| 56 _jtd_constructor_318_impl(rawSource2); | 56 _jtd_constructor_322_impl(rawSource2); |
| 57 } | 57 } |
| 58 _jtd_constructor_318_impl(String rawSource2) { | 58 _jtd_constructor_322_impl(String rawSource2) { |
| 59 this._rawSource = rawSource2; | 59 this._rawSource = rawSource2; |
| 60 this._markedSource = rawSource2; | 60 this._markedSource = rawSource2; |
| 61 } | 61 } |
| 62 /** | 62 /** |
| 63 * Assert that the number of errors that have been gathered matches the number
of errors that are | 63 * Assert that the number of errors that have been gathered matches the number
of errors that are |
| 64 * given and that they have the expected error codes and locations. The order
in which the errors | 64 * given and that they have the expected error codes and locations. The order
in which the errors |
| 65 * were gathered is ignored. | 65 * were gathered is ignored. |
| 66 * @param errorCodes the errors that should have been gathered | 66 * @param errorCodes the errors that should have been gathered |
| 67 * @throws AssertionFailedError if a different number of errors have been gath
ered than were | 67 * @throws AssertionFailedError if a different number of errors have been gath
ered than were |
| 68 * expected or if they do not have the same codes and locations | 68 * expected or if they do not have the same codes and locations |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 * is ignored. | 268 * is ignored. |
| 269 * @param errorCodes the errors that should have been gathered | 269 * @param errorCodes the errors that should have been gathered |
| 270 * @throws AssertionFailedError with | 270 * @throws AssertionFailedError with |
| 271 */ | 271 */ |
| 272 void fail(List<AnalysisError> expectedErrors) { | 272 void fail(List<AnalysisError> expectedErrors) { |
| 273 PrintStringWriter writer = new PrintStringWriter(); | 273 PrintStringWriter writer = new PrintStringWriter(); |
| 274 writer.print("Expected "); | 274 writer.print("Expected "); |
| 275 writer.print(expectedErrors.length); | 275 writer.print(expectedErrors.length); |
| 276 writer.print(" errors:"); | 276 writer.print(" errors:"); |
| 277 for (AnalysisError error in expectedErrors) { | 277 for (AnalysisError error in expectedErrors) { |
| 278 Source source13 = error.source; | 278 Source source11 = error.source; |
| 279 LineInfo lineInfo = _lineInfoMap[source13]; | 279 LineInfo lineInfo = _lineInfoMap[source11]; |
| 280 writer.println(); | 280 writer.println(); |
| 281 if (lineInfo == null) { | 281 if (lineInfo == null) { |
| 282 int offset10 = error.offset; | 282 int offset10 = error.offset; |
| 283 writer.printf(" %s %s (%d..%d)", [source13 == null ? "" : source13.shor
tName, error.errorCode, offset10, offset10 + error.length]); | 283 writer.printf(" %s %s (%d..%d)", [source11 == null ? "" : source11.shor
tName, error.errorCode, offset10, offset10 + error.length]); |
| 284 } else { | 284 } else { |
| 285 LineInfo_Location location = lineInfo.getLocation(error.offset); | 285 LineInfo_Location location = lineInfo.getLocation(error.offset); |
| 286 writer.printf(" %s %s (%d, %d/%d)", [source13 == null ? "" : source13.s
hortName, error.errorCode, location.lineNumber, location.columnNumber, error.len
gth]); | 286 writer.printf(" %s %s (%d, %d/%d)", [source11 == null ? "" : source11.s
hortName, error.errorCode, location.lineNumber, location.columnNumber, error.len
gth]); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 writer.println(); | 289 writer.println(); |
| 290 writer.print("found "); | 290 writer.print("found "); |
| 291 writer.print(_errors.length); | 291 writer.print(_errors.length); |
| 292 writer.print(" errors:"); | 292 writer.print(" errors:"); |
| 293 for (AnalysisError error in _errors) { | 293 for (AnalysisError error in _errors) { |
| 294 Source source14 = error.source; | 294 Source source12 = error.source; |
| 295 LineInfo lineInfo = _lineInfoMap[source14]; | 295 LineInfo lineInfo = _lineInfoMap[source12]; |
| 296 writer.println(); | 296 writer.println(); |
| 297 if (lineInfo == null) { | 297 if (lineInfo == null) { |
| 298 int offset11 = error.offset; | 298 int offset11 = error.offset; |
| 299 writer.printf(" %s %s (%d..%d): %s", [source14 == null ? "" : source14.
shortName, error.errorCode, offset11, offset11 + error.length, error.message]); | 299 writer.printf(" %s %s (%d..%d): %s", [source12 == null ? "" : source12.
shortName, error.errorCode, offset11, offset11 + error.length, error.message]); |
| 300 } else { | 300 } else { |
| 301 LineInfo_Location location = lineInfo.getLocation(error.offset); | 301 LineInfo_Location location = lineInfo.getLocation(error.offset); |
| 302 writer.printf(" %s %s (%d, %d/%d): %s", [source14 == null ? "" : source
14.shortName, error.errorCode, location.lineNumber, location.columnNumber, error
.length, error.message]); | 302 writer.printf(" %s %s (%d, %d/%d): %s", [source12 == null ? "" : source
12.shortName, error.errorCode, location.lineNumber, location.columnNumber, error
.length, error.message]); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 JUnitTestCase.fail(writer.toString()); | 305 JUnitTestCase.fail(writer.toString()); |
| 306 } | 306 } |
| 307 /** | 307 /** |
| 308 * Search through the given list of errors for an error that is equal to the t
arget error. If one | 308 * Search through the given list of errors for an error that is equal to the t
arget error. If one |
| 309 * is found, remove it from the list and return {@code true}, otherwise return
{@code false}without modifying the list. | 309 * is found, remove it from the list and return {@code true}, otherwise return
{@code false}without modifying the list. |
| 310 * @param errors the errors through which we are searching | 310 * @param errors the errors through which we are searching |
| 311 * @param targetError the error being searched for | 311 * @param targetError the error being searched for |
| 312 * @return {@code true} if the error is found and removed from the list | 312 * @return {@code true} if the error is found and removed from the list |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 return trampoline(target, arguments[0], arguments[1]); | 659 return trampoline(target, arguments[0], arguments[1]); |
| 660 case 3: | 660 case 3: |
| 661 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 661 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
| 662 case 4: | 662 case 4: |
| 663 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 663 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
| 664 default: | 664 default: |
| 665 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 665 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 } | 668 } |
| OLD | NEW |