OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.test.generated.resolver_test_case; | 5 library analyzer.test.generated.resolver_test_case; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/visitor.dart'; | 8 import 'package:analyzer/dart/ast/visitor.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 * that are given and that they have the expected error codes. The order in wh
ich the errors were | 362 * that are given and that they have the expected error codes. The order in wh
ich the errors were |
363 * gathered is ignored. | 363 * gathered is ignored. |
364 * | 364 * |
365 * @param source the source against which the errors should have been reported | 365 * @param source the source against which the errors should have been reported |
366 * @param expectedErrorCodes the error codes of the errors that should have be
en reported | 366 * @param expectedErrorCodes the error codes of the errors that should have be
en reported |
367 * @throws AnalysisException if the reported errors could not be computed | 367 * @throws AnalysisException if the reported errors could not be computed |
368 * @throws AssertionFailedError if a different number of errors have been repo
rted than were | 368 * @throws AssertionFailedError if a different number of errors have been repo
rted than were |
369 * expected | 369 * expected |
370 */ | 370 */ |
371 void assertErrors(Source source, | 371 void assertErrors(Source source, |
372 [List<ErrorCode> expectedErrorCodes = ErrorCode.EMPTY_LIST]) { | 372 [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) { |
373 GatheringErrorListener errorListener = new GatheringErrorListener(); | 373 GatheringErrorListener errorListener = new GatheringErrorListener(); |
374 for (AnalysisError error in analysisContext2.computeErrors(source)) { | 374 for (AnalysisError error in analysisContext2.computeErrors(source)) { |
375 expect(error.source, source); | 375 expect(error.source, source); |
376 ErrorCode errorCode = error.errorCode; | 376 ErrorCode errorCode = error.errorCode; |
377 if (!enableUnusedElement && | 377 if (!enableUnusedElement && |
378 (errorCode == HintCode.UNUSED_ELEMENT || | 378 (errorCode == HintCode.UNUSED_ELEMENT || |
379 errorCode == HintCode.UNUSED_FIELD)) { | 379 errorCode == HintCode.UNUSED_FIELD)) { |
380 continue; | 380 continue; |
381 } | 381 } |
382 if (!enableUnusedLocalVariable && | 382 if (!enableUnusedLocalVariable && |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. | 835 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. |
836 */ | 836 */ |
837 _expectType(DartType type, expected) { | 837 _expectType(DartType type, expected) { |
838 if (expected is String) { | 838 if (expected is String) { |
839 expect(type.toString(), expected); | 839 expect(type.toString(), expected); |
840 } else { | 840 } else { |
841 expect(type, expected); | 841 expect(type, expected); |
842 } | 842 } |
843 } | 843 } |
844 } | 844 } |
OLD | NEW |