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

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1434063002: Fix for test - don't depend on the order of errors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 2186347b8507716be6c31a13e3bda018f1671da1..5d124f08279e475eea5eee2308e2d215145e2da9 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -335,35 +335,34 @@ main() {
''');
List<AnalysisError> errors = context.computeErrors(testSource);
expect(errors, hasLength(2));
- // ParserError: Expected to find ';'
- {
- AnalysisError error = errors[0];
- expect(error.message, "Expected to find ';'");
- List<Fix> fixes = _computeFixes(error);
- expect(fixes, isEmpty);
- }
- // Undefined name 'await'
- {
- AnalysisError error = errors[1];
- expect(error.message, "Undefined name 'await'");
- List<Fix> fixes = _computeFixes(error);
- // has exactly one fix
- expect(fixes, hasLength(1));
- Fix fix = fixes[0];
- expect(fix.kind, DartFixKind.ADD_ASYNC);
- // apply to "file"
- List<SourceFileEdit> fileEdits = fix.change.edits;
- expect(fileEdits, hasLength(1));
- resultCode = SourceEdit.applySequence(testCode, fileEdits[0].edits);
- // verify
- expect(
- resultCode,
- '''
+ String message1 = "Expected to find ';'";
+ String message2 = "Undefined name 'await'";
+ expect(errors.map((e) => e.message), unorderedEquals([message1, message2]));
+ for (AnalysisError error in errors) {
+ if (error.message == message1) {
+ List<Fix> fixes = _computeFixes(error);
+ expect(fixes, isEmpty);
+ }
+ if (error.message == message2) {
+ List<Fix> fixes = _computeFixes(error);
+ // has exactly one fix
+ expect(fixes, hasLength(1));
+ Fix fix = fixes[0];
+ expect(fix.kind, DartFixKind.ADD_ASYNC);
+ // apply to "file"
+ List<SourceFileEdit> fileEdits = fix.change.edits;
+ expect(fileEdits, hasLength(1));
+ resultCode = SourceEdit.applySequence(testCode, fileEdits[0].edits);
+ // verify
+ expect(
+ resultCode,
+ '''
foo() {}
main() async {
await foo();
}
''');
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698