| 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 library analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 8353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8364 errorCode == HintCode.UNUSED_CATCH_STACK || | 8364 errorCode == HintCode.UNUSED_CATCH_STACK || |
| 8365 errorCode == HintCode.UNUSED_LOCAL_VARIABLE)) { | 8365 errorCode == HintCode.UNUSED_LOCAL_VARIABLE)) { |
| 8366 continue; | 8366 continue; |
| 8367 } | 8367 } |
| 8368 errorListener.onError(error); | 8368 errorListener.onError(error); |
| 8369 } | 8369 } |
| 8370 errorListener.assertErrorsWithCodes(expectedErrorCodes); | 8370 errorListener.assertErrorsWithCodes(expectedErrorCodes); |
| 8371 } | 8371 } |
| 8372 | 8372 |
| 8373 /** | 8373 /** |
| 8374 * Asserts that [code] has errors with the given error codes. | 8374 * Asserts that [code] verifies, but has errors with the given error codes. |
| 8375 * | 8375 * |
| 8376 * Like [assertErrors], but takes a string of source code. | 8376 * Like [assertErrors], but takes a string of source code. |
| 8377 */ | 8377 */ |
| 8378 // TODO(rnystrom): Use this in more tests that have the same structure. | 8378 // TODO(rnystrom): Use this in more tests that have the same structure. |
| 8379 void assertErrorsInCode(String code, List<ErrorCode> errors) { | 8379 void assertErrorsInCode(String code, List<ErrorCode> errors) { |
| 8380 Source source = addSource(code); | 8380 Source source = addSource(code); |
| 8381 computeLibrarySourceErrors(source); | 8381 computeLibrarySourceErrors(source); |
| 8382 assertErrors(source, errors); | 8382 assertErrors(source, errors); |
| 8383 verify([source]); | 8383 verify([source]); |
| 8384 } | 8384 } |
| 8385 | 8385 |
| 8386 /** | 8386 /** |
| 8387 * Asserts that [code] has errors with the given error codes. |
| 8388 * |
| 8389 * Like [assertErrors], but takes a string of source code. |
| 8390 */ |
| 8391 void assertErrorsInUnverifiedCode(String code, List<ErrorCode> errors) { |
| 8392 Source source = addSource(code); |
| 8393 computeLibrarySourceErrors(source); |
| 8394 assertErrors(source, errors); |
| 8395 } |
| 8396 |
| 8397 /** |
| 8387 * Assert that no errors have been reported against the given source. | 8398 * Assert that no errors have been reported against the given source. |
| 8388 * | 8399 * |
| 8389 * @param source the source against which no errors should have been reported | 8400 * @param source the source against which no errors should have been reported |
| 8390 * @throws AnalysisException if the reported errors could not be computed | 8401 * @throws AnalysisException if the reported errors could not be computed |
| 8391 * @throws AssertionFailedError if any errors have been reported | 8402 * @throws AssertionFailedError if any errors have been reported |
| 8392 */ | 8403 */ |
| 8393 void assertNoErrors(Source source) { | 8404 void assertNoErrors(Source source) { |
| 8394 assertErrors(source); | 8405 assertErrors(source); |
| 8395 } | 8406 } |
| 8396 | 8407 |
| (...skipping 9101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17498 | 17509 |
| 17499 void _resolveTestUnit(String code) { | 17510 void _resolveTestUnit(String code) { |
| 17500 testCode = code; | 17511 testCode = code; |
| 17501 testSource = addSource(testCode); | 17512 testSource = addSource(testCode); |
| 17502 LibraryElement library = resolve2(testSource); | 17513 LibraryElement library = resolve2(testSource); |
| 17503 assertNoErrors(testSource); | 17514 assertNoErrors(testSource); |
| 17504 verify([testSource]); | 17515 verify([testSource]); |
| 17505 testUnit = resolveCompilationUnit(testSource, library); | 17516 testUnit = resolveCompilationUnit(testSource, library); |
| 17506 } | 17517 } |
| 17507 } | 17518 } |
| OLD | NEW |