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

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

Issue 2863593004: Remove the non-driver versions of 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 13 matching lines...) Expand all
24 import 'package:test/test.dart'; 24 import 'package:test/test.dart';
25 import 'package:test_reflective_loader/test_reflective_loader.dart'; 25 import 'package:test_reflective_loader/test_reflective_loader.dart';
26 26
27 import '../../abstract_single_unit.dart'; 27 import '../../abstract_single_unit.dart';
28 import 'flutter_util.dart'; 28 import 'flutter_util.dart';
29 29
30 main() { 30 main() {
31 defineReflectiveSuite(() { 31 defineReflectiveSuite(() {
32 defineReflectiveTests(FixProcessorTest); 32 defineReflectiveTests(FixProcessorTest);
33 defineReflectiveTests(LintFixTest); 33 defineReflectiveTests(LintFixTest);
34 defineReflectiveTests(FixProcessorTest_Driver);
35 defineReflectiveTests(LintFixTest_Driver);
36 }); 34 });
37 } 35 }
38 36
39 typedef bool AnalysisErrorFilter(AnalysisError error); 37 typedef bool AnalysisErrorFilter(AnalysisError error);
40 38
41 /** 39 /**
42 * Base class for fix processor tests. 40 * Base class for fix processor tests.
43 */ 41 */
44 class BaseFixProcessorTest extends AbstractSingleUnitTest { 42 class BaseFixProcessorTest extends AbstractSingleUnitTest {
45 AnalysisErrorFilter errorFilter = (AnalysisError error) { 43 AnalysisErrorFilter errorFilter = (AnalysisError error) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 for (String search in searchStrings) { 221 for (String search in searchStrings) {
224 int offset = resultCode.indexOf(search); 222 int offset = resultCode.indexOf(search);
225 positions.add(new Position(testFile, offset)); 223 positions.add(new Position(testFile, offset));
226 } 224 }
227 return positions; 225 return positions;
228 } 226 }
229 } 227 }
230 228
231 @reflectiveTest 229 @reflectiveTest
232 class FixProcessorTest extends BaseFixProcessorTest { 230 class FixProcessorTest extends BaseFixProcessorTest {
231 @override
232 bool get enableNewAnalysisDriver => true;
233
233 test_addFieldFormalParameters_hasRequiredParameter() async { 234 test_addFieldFormalParameters_hasRequiredParameter() async {
234 await resolveTestUnit(''' 235 await resolveTestUnit('''
235 class Test { 236 class Test {
236 final int a; 237 final int a;
237 final int b; 238 final int b;
238 final int c; 239 final int c;
239 Test(this.a); 240 Test(this.a);
240 } 241 }
241 '''); 242 ''');
242 await assertHasFix( 243 await assertHasFix(
(...skipping 5636 matching lines...) Expand 10 before | Expand all | Expand 10 after
5879 // force 'flutter' resolution 5880 // force 'flutter' resolution
5880 addSource( 5881 addSource(
5881 '/tmp/other.dart', 5882 '/tmp/other.dart',
5882 pathToCode.keys 5883 pathToCode.keys
5883 .map((path) => "import 'package:flutter/$path';") 5884 .map((path) => "import 'package:flutter/$path';")
5884 .join('\n')); 5885 .join('\n'));
5885 } 5886 }
5886 } 5887 }
5887 5888
5888 @reflectiveTest 5889 @reflectiveTest
5889 class FixProcessorTest_Driver extends FixProcessorTest {
5890 @override
5891 bool get enableNewAnalysisDriver => true;
5892 }
5893
5894 @reflectiveTest
5895 class LintFixTest extends BaseFixProcessorTest { 5890 class LintFixTest extends BaseFixProcessorTest {
5896 AnalysisError error; 5891 AnalysisError error;
5897 5892
5893 @override
5894 bool get enableNewAnalysisDriver => true;
5895
5898 Future applyFix(FixKind kind) async { 5896 Future applyFix(FixKind kind) async {
5899 fix = await _assertHasFix(kind, error); 5897 fix = await _assertHasFix(kind, error);
5900 change = fix.change; 5898 change = fix.change;
5901 // apply to "file" 5899 // apply to "file"
5902 List<SourceFileEdit> fileEdits = change.edits; 5900 List<SourceFileEdit> fileEdits = change.edits;
5903 expect(fileEdits, hasLength(1)); 5901 expect(fileEdits, hasLength(1));
5904 resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits); 5902 resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits);
5905 } 5903 }
5906 5904
5907 Future<Null> findLint(String src, String lintCode, {int length: 1}) async { 5905 Future<Null> findLint(String src, String lintCode, {int length: 1}) async {
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
6861 return a.toString; 6859 return a.toString;
6862 } 6860 }
6863 '''); 6861 ''');
6864 } 6862 }
6865 6863
6866 void verifyResult(String expectedResult) { 6864 void verifyResult(String expectedResult) {
6867 expect(resultCode, expectedResult); 6865 expect(resultCode, expectedResult);
6868 } 6866 }
6869 } 6867 }
6870 6868
6871 @reflectiveTest
6872 class LintFixTest_Driver extends LintFixTest {
6873 @override
6874 bool get enableNewAnalysisDriver => true;
6875 }
6876
6877 class _DartFixContextImpl implements DartFixContext { 6869 class _DartFixContextImpl implements DartFixContext {
6878 @override 6870 @override
6879 final ResourceProvider resourceProvider; 6871 final ResourceProvider resourceProvider;
6880 6872
6881 @override 6873 @override
6882 final GetTopLevelDeclarations getTopLevelDeclarations; 6874 final GetTopLevelDeclarations getTopLevelDeclarations;
6883 6875
6884 @override 6876 @override
6885 final AnalysisContext analysisContext; 6877 final AnalysisContext analysisContext;
6886 6878
6887 @override 6879 @override
6888 final AstProvider astProvider; 6880 final AstProvider astProvider;
6889 6881
6890 @override 6882 @override
6891 final CompilationUnit unit; 6883 final CompilationUnit unit;
6892 6884
6893 @override 6885 @override
6894 final AnalysisError error; 6886 final AnalysisError error;
6895 6887
6896 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations, 6888 _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations,
6897 this.analysisContext, this.astProvider, this.unit, this.error); 6889 this.analysisContext, this.astProvider, this.unit, this.error);
6898 } 6890 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698