Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: pkg/analyzer/test/generated/test_support.dart

Issue 221483002: Fix for translation of \!= to \!identical(), but use == and \!= for Enum. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
14 import 'package:analyzer/src/generated/error.dart'; 14 import 'package:analyzer/src/generated/error.dart';
15 import 'package:analyzer/src/generated/scanner.dart'; 15 import 'package:analyzer/src/generated/scanner.dart';
16 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; 16 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator;
17 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;
18 import 'package:analyzer/src/generated/engine.dart'; 18 import 'package:analyzer/src/generated/engine.dart';
19 import 'package:unittest/unittest.dart' as _ut; 19 import 'package:unittest/unittest.dart' as _ut;
20 20
21 /** 21 /**
22 * 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
23 * all of the errors passed to it for later examination. 23 * all of the errors passed to it for later examination.
24 */ 24 */
25 class GatheringErrorListener implements AnalysisErrorListener { 25 class GatheringErrorListener implements AnalysisErrorListener {
26 /** 26 /**
27 * The source being parsed. 27 * The source being parsed.
28 */ 28 */
29 String _rawSource; 29 final String _rawSource;
30 30
31 /** 31 /**
32 * The source being parsed after inserting a marker at the beginning and end o f the range of the 32 * The source being parsed after inserting a marker at the beginning and end o f the range of the
33 * most recent error. 33 * most recent error.
34 */ 34 */
35 String _markedSource; 35 String _markedSource;
36 36
37 /** 37 /**
38 * A list containing the errors that were collected. 38 * A list containing the errors that were collected.
39 */ 39 */
40 List<AnalysisError> _errors = new List<AnalysisError>(); 40 List<AnalysisError> _errors = new List<AnalysisError>();
41 41
42 /** 42 /**
43 * A table mapping sources to the line information for the source. 43 * A table mapping sources to the line information for the source.
44 */ 44 */
45 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>(); 45 Map<Source, LineInfo> _lineInfoMap = new Map<Source, LineInfo>();
46 46
47 /** 47 /**
48 * An empty array of errors used when no errors are expected. 48 * An empty array of errors used when no errors are expected.
49 */ 49 */
50 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0); 50 static List<AnalysisError> _NO_ERRORS = new List<AnalysisError>(0);
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() : super(); 55 GatheringErrorListener() : this.con1(null);
56 56
57 /** 57 /**
58 * Initialize a newly created error listener to collect errors. 58 * Initialize a newly created error listener to collect errors.
59 */ 59 */
60 GatheringErrorListener.con1(String rawSource) { 60 GatheringErrorListener.con1(this._rawSource) {
61 this._rawSource = rawSource; 61 this._markedSource = _rawSource;
62 this._markedSource = rawSource;
63 } 62 }
64 63
65 /** 64 /**
66 * Add all of the errors recorded by the given listener to this listener. 65 * Add all of the errors recorded by the given listener to this listener.
67 * 66 *
68 * @param listener the listener that has recorded the errors to be added 67 * @param listener the listener that has recorded the errors to be added
69 */ 68 */
70 void addAll(RecordingErrorListener listener) { 69 void addAll(RecordingErrorListener listener) {
71 for (AnalysisError error in listener.errors) { 70 for (AnalysisError error in listener.errors) {
72 onError(error); 71 onError(error);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 * argument. The order in which the errors were gathered is ignored. 202 * argument. The order in which the errors were gathered is ignored.
204 * 203 *
205 * @param expectedSeverities the severities of the errors that should have bee n gathered 204 * @param expectedSeverities the severities of the errors that should have bee n gathered
206 * @throws AssertionFailedError if a different number of errors have been gath ered than were 205 * @throws AssertionFailedError if a different number of errors have been gath ered than were
207 * expected 206 * expected
208 */ 207 */
209 void assertErrorsWithSeverities(List<ErrorSeverity> expectedSeverities) { 208 void assertErrorsWithSeverities(List<ErrorSeverity> expectedSeverities) {
210 int expectedErrorCount = 0; 209 int expectedErrorCount = 0;
211 int expectedWarningCount = 0; 210 int expectedWarningCount = 0;
212 for (ErrorSeverity severity in expectedSeverities) { 211 for (ErrorSeverity severity in expectedSeverities) {
213 if (identical(severity, ErrorSeverity.ERROR)) { 212 if (severity == ErrorSeverity.ERROR) {
214 expectedErrorCount++; 213 expectedErrorCount++;
215 } else { 214 } else {
216 expectedWarningCount++; 215 expectedWarningCount++;
217 } 216 }
218 } 217 }
219 int actualErrorCount = 0; 218 int actualErrorCount = 0;
220 int actualWarningCount = 0; 219 int actualWarningCount = 0;
221 for (AnalysisError error in _errors) { 220 for (AnalysisError error in _errors) {
222 if (identical(error.errorCode.errorSeverity, ErrorSeverity.ERROR)) { 221 if (error.errorCode.errorSeverity == ErrorSeverity.ERROR) {
223 actualErrorCount++; 222 actualErrorCount++;
224 } else { 223 } else {
225 actualWarningCount++; 224 actualWarningCount++;
226 } 225 }
227 } 226 }
228 if (expectedErrorCount != actualErrorCount || expectedWarningCount != actual WarningCount) { 227 if (expectedErrorCount != actualErrorCount || expectedWarningCount != actual WarningCount) {
229 JUnitTestCase.fail("Expected ${expectedErrorCount} errors and ${expectedWa rningCount} warnings, found ${actualErrorCount} errors and ${actualWarningCount} warnings"); 228 JUnitTestCase.fail("Expected ${expectedErrorCount} errors and ${expectedWa rningCount} warnings, found ${actualErrorCount} errors and ${actualWarningCount} warnings");
230 } 229 }
231 } 230 }
232 231
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 Source resolveRelative(Uri uri) { 852 Source resolveRelative(Uri uri) {
854 throw new UnsupportedOperationException(); 853 throw new UnsupportedOperationException();
855 } 854 }
856 UriKind get uriKind { 855 UriKind get uriKind {
857 throw new UnsupportedOperationException(); 856 throw new UnsupportedOperationException();
858 } 857 }
859 TimestampedData<String> get contents { 858 TimestampedData<String> get contents {
860 throw new UnsupportedOperationException(); 859 throw new UnsupportedOperationException();
861 } 860 }
862 } 861 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/scanner_test.dart ('k') | pkg/code_transformers/test/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698