| 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 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| 11 import 'package:analyzer/src/generated/java_junit.dart'; | 11 import 'package:analyzer/src/generated/java_junit.dart'; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 12 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/utilities_collection.dart'; | |
| 14 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/generated/error.dart'; | 14 import 'package:analyzer/src/generated/error.dart'; |
| 16 import 'package:analyzer/src/generated/scanner.dart'; | 15 import 'package:analyzer/src/generated/scanner.dart'; |
| 17 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; | 16 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; |
| 18 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; | 17 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; |
| 19 import 'package:analyzer/src/generated/engine.dart'; | 18 import 'package:analyzer/src/generated/engine.dart'; |
| 20 import 'package:unittest/unittest.dart' as _ut; | 19 import 'package:unittest/unittest.dart' as _ut; |
| 21 | 20 |
| 22 /** | 21 /** |
| 23 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects | 22 * Instances of the class `GatheringErrorListener` implement an error listener t
hat collects |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 List<AnalysisError> list = errorsByCode[code]; | 135 List<AnalysisError> list = errorsByCode[code]; |
| 137 if (list == null) { | 136 if (list == null) { |
| 138 list = new List<AnalysisError>(); | 137 list = new List<AnalysisError>(); |
| 139 errorsByCode[code] = list; | 138 errorsByCode[code] = list; |
| 140 } | 139 } |
| 141 list.add(error); | 140 list.add(error); |
| 142 } | 141 } |
| 143 // | 142 // |
| 144 // Compare the expected and actual number of each type of error. | 143 // Compare the expected and actual number of each type of error. |
| 145 // | 144 // |
| 146 for (MapIterator<ErrorCode, int> iter = SingleMapIterator.forMap(expectedCou
nts); iter.moveNext();) { | 145 for (MapEntry<ErrorCode, int> entry in getMapEntrySet(expectedCounts)) { |
| 147 ErrorCode code = iter.key; | 146 ErrorCode code = entry.getKey(); |
| 148 int expectedCount = iter.value; | 147 int expectedCount = entry.getValue(); |
| 149 int actualCount; | 148 int actualCount; |
| 150 List<AnalysisError> list = errorsByCode.remove(code); | 149 List<AnalysisError> list = errorsByCode.remove(code); |
| 151 if (list == null) { | 150 if (list == null) { |
| 152 actualCount = 0; | 151 actualCount = 0; |
| 153 } else { | 152 } else { |
| 154 actualCount = list.length; | 153 actualCount = list.length; |
| 155 } | 154 } |
| 156 if (actualCount != expectedCount) { | 155 if (actualCount != expectedCount) { |
| 157 if (builder.length == 0) { | 156 if (builder.length == 0) { |
| 158 builder.append("Expected "); | 157 builder.append("Expected "); |
| 159 } else { | 158 } else { |
| 160 builder.append("; "); | 159 builder.append("; "); |
| 161 } | 160 } |
| 162 builder.append(expectedCount); | 161 builder.append(expectedCount); |
| 163 builder.append(" errors of type "); | 162 builder.append(" errors of type "); |
| 164 builder.append("${code.runtimeType.toString()}.${code}"); | 163 builder.append("${code.runtimeType.toString()}.${code}"); |
| 165 builder.append(", found "); | 164 builder.append(", found "); |
| 166 builder.append(actualCount); | 165 builder.append(actualCount); |
| 167 } | 166 } |
| 168 } | 167 } |
| 169 // | 168 // |
| 170 // Check that there are no more errors in the actual-errors map, otherwise,
record message. | 169 // Check that there are no more errors in the actual-errors map, otherwise,
record message. |
| 171 // | 170 // |
| 172 for (MapIterator<ErrorCode, List<AnalysisError>> iter = SingleMapIterator.fo
rMap(errorsByCode); iter.moveNext();) { | 171 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet(errors
ByCode)) { |
| 173 ErrorCode code = iter.key; | 172 ErrorCode code = entry.getKey(); |
| 174 List<AnalysisError> actualErrors = iter.value; | 173 List<AnalysisError> actualErrors = entry.getValue(); |
| 175 int actualCount = actualErrors.length; | 174 int actualCount = actualErrors.length; |
| 176 if (builder.length == 0) { | 175 if (builder.length == 0) { |
| 177 builder.append("Expected "); | 176 builder.append("Expected "); |
| 178 } else { | 177 } else { |
| 179 builder.append("; "); | 178 builder.append("; "); |
| 180 } | 179 } |
| 181 builder.append("0 errors of type "); | 180 builder.append("0 errors of type "); |
| 182 builder.append("${code.runtimeType.toString()}.${code}"); | 181 builder.append("${code.runtimeType.toString()}.${code}"); |
| 183 builder.append(", found "); | 182 builder.append(", found "); |
| 184 builder.append(actualCount); | 183 builder.append(actualCount); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 static dartSuite() { | 813 static dartSuite() { |
| 815 _ut.group('EngineTestCase', () { | 814 _ut.group('EngineTestCase', () { |
| 816 }); | 815 }); |
| 817 } | 816 } |
| 818 } | 817 } |
| 819 | 818 |
| 820 main() { | 819 main() { |
| 821 } | 820 } |
| 822 | 821 |
| 823 class TestSource implements Source { | 822 class TestSource implements Source { |
| 823 String _name; |
| 824 TestSource([this._name = '/test.dart']); |
| 824 int get hashCode => 0; | 825 int get hashCode => 0; |
| 825 bool operator ==(Object object) { | 826 bool operator ==(Object object) { |
| 826 return object is TestSource; | 827 return object is TestSource; |
| 827 } | 828 } |
| 828 AnalysisContext get context { | 829 AnalysisContext get context { |
| 829 throw new UnsupportedOperationException(); | 830 throw new UnsupportedOperationException(); |
| 830 } | 831 } |
| 831 void getContentsToReceiver(Source_ContentReceiver receiver) { | 832 void getContentsToReceiver(Source_ContentReceiver receiver) { |
| 832 throw new UnsupportedOperationException(); | 833 throw new UnsupportedOperationException(); |
| 833 } | 834 } |
| 834 String get fullName { | 835 String get fullName { |
| 835 throw new UnsupportedOperationException(); | 836 return _name; |
| 836 } | 837 } |
| 837 String get shortName { | 838 String get shortName { |
| 838 throw new UnsupportedOperationException(); | 839 return _name; |
| 839 } | 840 } |
| 840 String get encoding { | 841 String get encoding { |
| 841 throw new UnsupportedOperationException(); | 842 throw new UnsupportedOperationException(); |
| 842 } | 843 } |
| 843 int get modificationStamp { | 844 int get modificationStamp { |
| 844 throw new UnsupportedOperationException(); | 845 throw new UnsupportedOperationException(); |
| 845 } | 846 } |
| 846 bool exists() => true; | 847 bool exists() => true; |
| 847 bool get isInSystemLibrary { | 848 bool get isInSystemLibrary { |
| 848 throw new UnsupportedOperationException(); | 849 throw new UnsupportedOperationException(); |
| 849 } | 850 } |
| 850 Source resolve(String uri) { | 851 Source resolve(String uri) { |
| 851 throw new UnsupportedOperationException(); | 852 throw new UnsupportedOperationException(); |
| 852 } | 853 } |
| 853 Source resolveRelative(Uri uri) { | 854 Source resolveRelative(Uri uri) { |
| 854 throw new UnsupportedOperationException(); | 855 throw new UnsupportedOperationException(); |
| 855 } | 856 } |
| 856 UriKind get uriKind { | 857 UriKind get uriKind { |
| 857 throw new UnsupportedOperationException(); | 858 throw new UnsupportedOperationException(); |
| 858 } | 859 } |
| 859 TimestampedData<String> get contents { | 860 TimestampedData<String> get contents { |
| 860 throw new UnsupportedOperationException(); | 861 throw new UnsupportedOperationException(); |
| 861 } | 862 } |
| 862 } | 863 } |
| OLD | NEW |