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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 2864813002: Switch the default from non-driver to driver in several tests (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) 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; 8 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
9 import 'package:analysis_server/protocol/protocol_generated.dart' 9 import 'package:analysis_server/protocol/protocol_generated.dart'
10 hide AnalysisError; 10 hide AnalysisError;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 error.errorCode != HintCode.UNUSED_ELEMENT && 46 error.errorCode != HintCode.UNUSED_ELEMENT &&
47 error.errorCode != HintCode.UNUSED_FIELD && 47 error.errorCode != HintCode.UNUSED_FIELD &&
48 error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE; 48 error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE;
49 }; 49 };
50 50
51 String myPkgLibPath = '/packages/my_pkg/lib'; 51 String myPkgLibPath = '/packages/my_pkg/lib';
52 52
53 String flutterPkgLibPath = '/packages/flutter/lib'; 53 String flutterPkgLibPath = '/packages/flutter/lib';
54 54
55 Fix fix; 55 Fix fix;
56
56 SourceChange change; 57 SourceChange change;
57 String resultCode; 58 String resultCode;
58 59
59 assert_undefinedFunction_create_returnType_bool(String lineWithTest) async { 60 assert_undefinedFunction_create_returnType_bool(String lineWithTest) async {
60 await resolveTestUnit(''' 61 await resolveTestUnit('''
61 main() { 62 main() {
62 bool b = true; 63 bool b = true;
63 $lineWithTest 64 $lineWithTest
64 } 65 }
65 '''); 66 ''');
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 for (String search in searchStrings) { 222 for (String search in searchStrings) {
222 int offset = resultCode.indexOf(search); 223 int offset = resultCode.indexOf(search);
223 positions.add(new Position(testFile, offset)); 224 positions.add(new Position(testFile, offset));
224 } 225 }
225 return positions; 226 return positions;
226 } 227 }
227 } 228 }
228 229
229 @reflectiveTest 230 @reflectiveTest
230 class FixProcessorTest extends BaseFixProcessorTest { 231 class FixProcessorTest extends BaseFixProcessorTest {
231 @override
232 bool get enableNewAnalysisDriver => true;
233
234 test_addFieldFormalParameters_hasRequiredParameter() async { 232 test_addFieldFormalParameters_hasRequiredParameter() async {
235 await resolveTestUnit(''' 233 await resolveTestUnit('''
236 class Test { 234 class Test {
237 final int a; 235 final int a;
238 final int b; 236 final int b;
239 final int c; 237 final int c;
240 Test(this.a); 238 Test(this.a);
241 } 239 }
242 '''); 240 ''');
243 await assertHasFix( 241 await assertHasFix(
(...skipping 5639 matching lines...) Expand 10 before | Expand all | Expand 10 after
5883 pathToCode.keys 5881 pathToCode.keys
5884 .map((path) => "import 'package:flutter/$path';") 5882 .map((path) => "import 'package:flutter/$path';")
5885 .join('\n')); 5883 .join('\n'));
5886 } 5884 }
5887 } 5885 }
5888 5886
5889 @reflectiveTest 5887 @reflectiveTest
5890 class LintFixTest extends BaseFixProcessorTest { 5888 class LintFixTest extends BaseFixProcessorTest {
5891 AnalysisError error; 5889 AnalysisError error;
5892 5890
5893 @override
5894 bool get enableNewAnalysisDriver => true;
5895
5896 Future applyFix(FixKind kind) async { 5891 Future applyFix(FixKind kind) async {
5897 fix = await _assertHasFix(kind, error); 5892 fix = await _assertHasFix(kind, error);
5898 change = fix.change; 5893 change = fix.change;
5899 // apply to "file" 5894 // apply to "file"
5900 List<SourceFileEdit> fileEdits = change.edits; 5895 List<SourceFileEdit> fileEdits = change.edits;
5901 expect(fileEdits, hasLength(1)); 5896 expect(fileEdits, hasLength(1));
5902 resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits); 5897 resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits);
5903 } 5898 }
5904 5899
5905 Future<Null> findLint(String src, String lintCode, {int length: 1}) async { 5900 Future<Null> findLint(String src, String lintCode, {int length: 1}) async {
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
6881 6876
6882 @override 6877 @override
6883 final CompilationUnit unit; 6878 final CompilationUnit unit;
6884 6879
6885 @override 6880 @override
6886 final AnalysisError error; 6881 final AnalysisError error;
6887 6882
6888 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations, 6883 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations,
6889 this.analysisContext, this.astProvider, this.unit, this.error); 6884 this.analysisContext, this.astProvider, this.unit, this.error);
6890 } 6885 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698