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

Side by Side Diff: pkg/analysis_server/test/integration/edit/get_fixes_test.dart

Issue 2910683002: Update some of the fixes to use ChangeBuilder (Closed)
Patch Set: Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async';
6
5 import 'package:analysis_server/protocol/protocol_generated.dart'; 7 import 'package:analysis_server/protocol/protocol_generated.dart';
6 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 8 import 'package:analyzer_plugin/protocol/protocol_common.dart';
7 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
9 11
10 import '../support/integration_tests.dart'; 12 import '../support/integration_tests.dart';
11 13
12 main() { 14 main() {
13 defineReflectiveSuite(() { 15 defineReflectiveSuite(() {
14 defineReflectiveTests(GetFixesTest); 16 defineReflectiveTests(GetFixesTest);
(...skipping 25 matching lines...) Expand all
40 // apply the fix, expect that the new code has no errors 42 // apply the fix, expect that the new code has no errors
41 SourceChange change = fix.fixes.singleWhere( 43 SourceChange change = fix.fixes.singleWhere(
42 (SourceChange change) => change.message.startsWith('Import ')); 44 (SourceChange change) => change.message.startsWith('Import '));
43 expect(change.edits, hasLength(1)); 45 expect(change.edits, hasLength(1));
44 expect(change.edits.first.edits, hasLength(1)); 46 expect(change.edits.first.edits, hasLength(1));
45 SourceEdit edit = change.edits.first.edits.first; 47 SourceEdit edit = change.edits.first.edits.first;
46 text = text.replaceRange(edit.offset, edit.end, edit.replacement); 48 text = text.replaceRange(edit.offset, edit.end, edit.replacement);
47 writeFile(pathname, text); 49 writeFile(pathname, text);
48 50
49 await analysisFinished; 51 await analysisFinished;
52 // The errors (at least sometimes) don't get sent until after analysis has
53 // completed. Wait long enough to see whether new errors are reported.
54 await new Future.delayed(new Duration(milliseconds: 1000));
50 expect(currentAnalysisErrors[pathname], isEmpty); 55 expect(currentAnalysisErrors[pathname], isEmpty);
51 } 56 }
52 57
53 test_no_fixes() async { 58 test_no_fixes() async {
54 String pathname = sourcePath('test.dart'); 59 String pathname = sourcePath('test.dart');
55 String text = r''' 60 String text = r'''
56 import 'dart:async'; 61 import 'dart:async';
57 62
58 Future f; 63 Future f;
59 '''; 64 ''';
60 writeFile(pathname, text); 65 writeFile(pathname, text);
61 standardAnalysisSetup(); 66 standardAnalysisSetup();
62 67
63 EditGetFixesResult result = 68 EditGetFixesResult result =
64 await sendEditGetFixes(pathname, text.indexOf('Future f')); 69 await sendEditGetFixes(pathname, text.indexOf('Future f'));
65 expect(result.fixes, isEmpty); 70 expect(result.fixes, isEmpty);
66 } 71 }
67 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698