OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library test_utils; | 5 library test_utils; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 | 8 |
9 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
11 import 'package:analyzer/src/generated/error.dart'; | 11 import 'package:analyzer/src/generated/error.dart'; |
12 import 'package:analyzer/src/generated/scanner.dart'; | 12 import 'package:analyzer/src/generated/scanner.dart'; |
13 import 'package:analyzer/src/generated/ast.dart'; | 13 import 'package:analyzer/src/generated/ast.dart'; |
14 import 'package:analyzer/src/generated/parser.dart'; | 14 import 'package:analyzer/src/generated/parser.dart'; |
15 | 15 |
16 | 16 |
17 /// Instances of the class [_GatheringErrorListener] implement an error listener | 17 /// Instances of the class [_GatheringErrorListener] implement an error listener |
18 /// that collects all of the errors passed to it for later examination. | 18 /// that collects all of the errors passed to it for later examination. |
19 class _GatheringErrorListener implements AnalysisErrorListener { | 19 class _GatheringErrorListener implements AnalysisErrorListener { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 V getValue() => _value; | 155 V getValue() => _value; |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 class _TestSource implements Source { | 159 class _TestSource implements Source { |
160 | 160 |
161 bool operator == (Object object) => object is _TestSource; | 161 bool operator == (Object object) => object is _TestSource; |
162 | 162 |
163 AnalysisContext get context => _unsupported(); | 163 AnalysisContext get context => _unsupported(); |
164 | 164 |
165 void getContents(Source_ContentReceiver receiver) => _unsupported(); | 165 void getContentsToReceiver(Source_ContentReceiver receiver) => _unsupported(); |
166 | 166 |
167 String get fullName => _unsupported(); | 167 String get fullName => _unsupported(); |
168 | 168 |
169 String get shortName => _unsupported(); | 169 String get shortName => _unsupported(); |
170 | 170 |
171 String get encoding => _unsupported(); | 171 String get encoding => _unsupported(); |
172 | 172 |
173 int get modificationStamp =>_unsupported(); | 173 int get modificationStamp =>_unsupported(); |
174 | 174 |
175 UriKind get uriKind => _unsupported(); | 175 UriKind get uriKind => _unsupported(); |
176 | 176 |
177 bool exists() => true; | 177 bool exists() => true; |
178 | 178 |
179 bool get isInSystemLibrary => _unsupported(); | 179 bool get isInSystemLibrary => _unsupported(); |
180 | 180 |
181 Source resolve(String uri) => _unsupported(); | 181 Source resolve(String uri) => _unsupported(); |
182 | 182 |
183 Source resolveRelative(Uri uri) => _unsupported(); | 183 Source resolveRelative(Uri uri) => _unsupported(); |
184 | 184 |
| 185 TimestampedData<String> get contents => _unsupported(); |
185 } | 186 } |
186 | 187 |
187 | 188 |
188 _unsupported() => throw new _UnsupportedOperationException(); | 189 _unsupported() => throw new _UnsupportedOperationException(); |
189 | 190 |
190 class _UnsupportedOperationException implements Exception { | 191 class _UnsupportedOperationException implements Exception { |
191 String toString() => 'UnsupportedOperationException'; | 192 String toString() => 'UnsupportedOperationException'; |
192 } | 193 } |
193 | 194 |
194 | 195 |
(...skipping 10 matching lines...) Expand all Loading... |
205 var parser = new Parser(null, listener); | 206 var parser = new Parser(null, listener); |
206 var statement = parser.parseStatement(token); | 207 var statement = parser.parseStatement(token); |
207 expect(statement, isNotNull); | 208 expect(statement, isNotNull); |
208 | 209 |
209 if (expectedErrorCodes != null) { | 210 if (expectedErrorCodes != null) { |
210 listener.expectErrors(expectedErrorCodes); | 211 listener.expectErrors(expectedErrorCodes); |
211 } | 212 } |
212 | 213 |
213 return statement; | 214 return statement; |
214 } | 215 } |
OLD | NEW |