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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_target_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 library test.services.completion.target; 5 library test.services.completion.target;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart'; 9 import 'package:analysis_server/src/provisional/completion/dart/completion_targe t.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
11 import 'package:analyzer/src/dart/analysis/driver.dart'; 11 import 'package:analyzer/src/dart/analysis/driver.dart';
12 import 'package:analyzer/src/generated/source.dart'; 12 import 'package:analyzer/src/generated/source.dart';
13 import 'package:test/test.dart'; 13 import 'package:test/test.dart';
14 import 'package:test_reflective_loader/test_reflective_loader.dart'; 14 import 'package:test_reflective_loader/test_reflective_loader.dart';
15 15
16 import '../../abstract_context.dart'; 16 import '../../abstract_context.dart';
17 17
18 main() { 18 main() {
19 defineReflectiveSuite(() { 19 defineReflectiveSuite(() {
20 defineReflectiveTests(CompletionTargetTest); 20 defineReflectiveTests(CompletionTargetTest);
21 }); 21 });
22 } 22 }
23 23
24 @reflectiveTest 24 @reflectiveTest
25 class CompletionTargetTest extends AbstractContextTest { 25 class CompletionTargetTest extends AbstractContextTest {
26 Source testSource; 26 Source testSource;
27 int completionOffset; 27 int completionOffset;
28 CompletionTarget target; 28 CompletionTarget target;
29 29
30 @override
31 bool get enableNewAnalysisDriver => true;
32
33 Future<Null> addTestSource(String content) async { 30 Future<Null> addTestSource(String content) async {
34 expect(completionOffset, isNull, reason: 'Call addTestSource exactly once'); 31 expect(completionOffset, isNull, reason: 'Call addTestSource exactly once');
35 completionOffset = content.indexOf('^'); 32 completionOffset = content.indexOf('^');
36 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); 33 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^');
37 int nextOffset = content.indexOf('^', completionOffset + 1); 34 int nextOffset = content.indexOf('^', completionOffset + 1);
38 expect(nextOffset, equals(-1), reason: 'too many ^'); 35 expect(nextOffset, equals(-1), reason: 'too many ^');
39 content = content.substring(0, completionOffset) + 36 content = content.substring(0, completionOffset) +
40 content.substring(completionOffset + 1); 37 content.substring(completionOffset + 1);
41 testSource = addSource('/test.dart', content); 38 testSource = addSource('/test.dart', content);
42 AnalysisResult result = await driver.getResult(testSource.fullName); 39 AnalysisResult result = await driver.getResult(testSource.fullName);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 await addTestSource('main() {int b^ = 1;}'); 594 await addTestSource('main() {int b^ = 1;}');
598 await assertTarget('b = 1', 'int b = 1'); 595 await assertTarget('b = 1', 'int b = 1');
599 } 596 }
600 597
601 test_VariableDeclaration_lhs_identifier_before() async { 598 test_VariableDeclaration_lhs_identifier_before() async {
602 // VariableDeclaration VariableDeclarationList 599 // VariableDeclaration VariableDeclarationList
603 await addTestSource('main() {int ^b = 1;}'); 600 await addTestSource('main() {int ^b = 1;}');
604 await assertTarget('b = 1', 'int b = 1'); 601 await assertTarget('b = 1', 'int b = 1');
605 } 602 }
606 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698