| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.test_support; | 8 library engine.test_support; |
| 9 | 9 |
| 10 import 'dart:collection'; |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 11 import 'package:analyzer/src/generated/java_core.dart'; |
| 11 import 'package:analyzer/src/generated/java_junit.dart'; | 12 import 'package:analyzer/src/generated/java_junit.dart'; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/generated/error.dart'; | 15 import 'package:analyzer/src/generated/error.dart'; |
| 15 import 'package:analyzer/src/generated/scanner.dart'; | 16 import 'package:analyzer/src/generated/scanner.dart'; |
| 16 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; | 17 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; |
| 17 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; | 18 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; |
| 18 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 19 import 'package:unittest/unittest.dart' as _ut; | 20 import 'package:unittest/unittest.dart' as _ut; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 String _markedSource; | 447 String _markedSource; |
| 447 | 448 |
| 448 /** | 449 /** |
| 449 * A list containing the errors that were collected. | 450 * A list containing the errors that were collected. |
| 450 */ | 451 */ |
| 451 List<AnalysisError> _errors = new List<AnalysisError>(); | 452 List<AnalysisError> _errors = new List<AnalysisError>(); |
| 452 | 453 |
| 453 /** | 454 /** |
| 454 * A table mapping sources to the line information for the source. | 455 * A table mapping sources to the line information for the source. |
| 455 */ | 456 */ |
| 456 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>(); | 457 HashMap<Source, LineInfo> _lineInfoMap = new HashMap<Source, LineInfo>(); |
| 457 | 458 |
| 458 /** | 459 /** |
| 459 * An empty array of errors used when no errors are expected. | 460 * An empty array of errors used when no errors are expected. |
| 460 */ | 461 */ |
| 461 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); | 462 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); |
| 462 | 463 |
| 463 /** | 464 /** |
| 464 * Initialize a newly created error listener to collect errors. | 465 * Initialize a newly created error listener to collect errors. |
| 465 */ | 466 */ |
| 466 GatheringErrorListener() : this.con1(null); | 467 GatheringErrorListener() : this.con1(null); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 JavaStringBuilder builder = new JavaStringBuilder(); | 530 JavaStringBuilder builder = new JavaStringBuilder(); |
| 530 // | 531 // |
| 531 // Verify that the expected error codes have a non-empty message. | 532 // Verify that the expected error codes have a non-empty message. |
| 532 // | 533 // |
| 533 for (ErrorCode errorCode in expectedErrorCodes) { | 534 for (ErrorCode errorCode in expectedErrorCodes) { |
| 534 JUnitTestCase.assertFalseMsg("Empty error code message", errorCode.message
.isEmpty); | 535 JUnitTestCase.assertFalseMsg("Empty error code message", errorCode.message
.isEmpty); |
| 535 } | 536 } |
| 536 // | 537 // |
| 537 // Compute the expected number of each type of error. | 538 // Compute the expected number of each type of error. |
| 538 // | 539 // |
| 539 Map<ErrorCode, int> expectedCounts = new Map<ErrorCode, int>(); | 540 HashMap<ErrorCode, int> expectedCounts = new HashMap<ErrorCode, int>(); |
| 540 for (ErrorCode code in expectedErrorCodes) { | 541 for (ErrorCode code in expectedErrorCodes) { |
| 541 int count = expectedCounts[code]; | 542 int count = expectedCounts[code]; |
| 542 if (count == null) { | 543 if (count == null) { |
| 543 count = 1; | 544 count = 1; |
| 544 } else { | 545 } else { |
| 545 count = count + 1; | 546 count = count + 1; |
| 546 } | 547 } |
| 547 expectedCounts[code] = count; | 548 expectedCounts[code] = count; |
| 548 } | 549 } |
| 549 // | 550 // |
| 550 // Compute the actual number of each type of error. | 551 // Compute the actual number of each type of error. |
| 551 // | 552 // |
| 552 Map<ErrorCode, List<AnalysisError>> errorsByCode = new Map<ErrorCode, List<A
nalysisError>>(); | 553 HashMap<ErrorCode, List<AnalysisError>> errorsByCode = new HashMap<ErrorCode
, List<AnalysisError>>(); |
| 553 for (AnalysisError error in _errors) { | 554 for (AnalysisError error in _errors) { |
| 554 ErrorCode code = error.errorCode; | 555 ErrorCode code = error.errorCode; |
| 555 List<AnalysisError> list = errorsByCode[code]; | 556 List<AnalysisError> list = errorsByCode[code]; |
| 556 if (list == null) { | 557 if (list == null) { |
| 557 list = new List<AnalysisError>(); | 558 list = new List<AnalysisError>(); |
| 558 errorsByCode[code] = list; | 559 errorsByCode[code] = list; |
| 559 } | 560 } |
| 560 list.add(error); | 561 list.add(error); |
| 561 } | 562 } |
| 562 // | 563 // |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 Source resolveRelative(Uri uri) { | 864 Source resolveRelative(Uri uri) { |
| 864 throw new UnsupportedOperationException(); | 865 throw new UnsupportedOperationException(); |
| 865 } | 866 } |
| 866 UriKind get uriKind { | 867 UriKind get uriKind { |
| 867 throw new UnsupportedOperationException(); | 868 throw new UnsupportedOperationException(); |
| 868 } | 869 } |
| 869 TimestampedData<String> get contents { | 870 TimestampedData<String> get contents { |
| 870 throw new UnsupportedOperationException(); | 871 throw new UnsupportedOperationException(); |
| 871 } | 872 } |
| 872 } | 873 } |
| OLD | NEW |