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.test_support; | 5 library analyzer.test.generated.test_support; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 /** | 235 /** |
236 * Assert that the number of errors that have been gathered matches the number
of errors that are | 236 * Assert that the number of errors that have been gathered matches the number
of errors that are |
237 * given and that they have the expected error codes. The order in which the e
rrors were gathered | 237 * given and that they have the expected error codes. The order in which the e
rrors were gathered |
238 * is ignored. | 238 * is ignored. |
239 * | 239 * |
240 * @param expectedErrorCodes the error codes of the errors that should have be
en gathered | 240 * @param expectedErrorCodes the error codes of the errors that should have be
en gathered |
241 * @throws AssertionFailedError if a different number of errors have been gath
ered than were | 241 * @throws AssertionFailedError if a different number of errors have been gath
ered than were |
242 * expected | 242 * expected |
243 */ | 243 */ |
244 void assertErrorsWithCodes( | 244 void assertErrorsWithCodes( |
245 [List<ErrorCode> expectedErrorCodes = ErrorCode.EMPTY_LIST]) { | 245 [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) { |
246 StringBuffer buffer = new StringBuffer(); | 246 StringBuffer buffer = new StringBuffer(); |
247 // | 247 // |
248 // Verify that the expected error codes have a non-empty message. | 248 // Verify that the expected error codes have a non-empty message. |
249 // | 249 // |
250 for (ErrorCode errorCode in expectedErrorCodes) { | 250 for (ErrorCode errorCode in expectedErrorCodes) { |
251 expect(errorCode.message.isEmpty, isFalse, | 251 expect(errorCode.message.isEmpty, isFalse, |
252 reason: "Empty error code message"); | 252 reason: "Empty error code message"); |
253 } | 253 } |
254 // | 254 // |
255 // Compute the expected number of each type of error. | 255 // Compute the expected number of each type of error. |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 return UriKind.FILE_URI; | 637 return UriKind.FILE_URI; |
638 } | 638 } |
639 | 639 |
640 bool operator ==(Object other) { | 640 bool operator ==(Object other) { |
641 if (other is TestSource) { | 641 if (other is TestSource) { |
642 return other.uri == uri; | 642 return other.uri == uri; |
643 } | 643 } |
644 return false; | 644 return false; |
645 } | 645 } |
646 } | 646 } |
OLD | NEW |