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

Side by Side Diff: pkg/analysis_services/test/completion/local_computer_test.dart

Issue 459743002: local code completion computer improvements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_services/lib/src/completion/local_computer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.dart.local; 5 library test.services.completion.dart.local;
6 6
7 import 'package:analysis_services/src/completion/local_computer.dart'; 7 import 'package:analysis_services/src/completion/local_computer.dart';
8 import 'package:analysis_testing/reflective_tests.dart'; 8 import 'package:analysis_testing/reflective_tests.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import 'completion_test_util.dart'; 11 import 'completion_test_util.dart';
12 12
13 main() { 13 main() {
14 groupSep = ' | '; 14 groupSep = ' | ';
15 runReflectiveTests(LocalComputerTest); 15 runReflectiveTests(LocalComputerTest);
16 } 16 }
17 17
18 @ReflectiveTestCase() 18 @ReflectiveTestCase()
19 class LocalComputerTest extends AbstractCompletionTest { 19 class LocalComputerTest extends AbstractCompletionTest {
20 20
21 @override 21 @override
22 void setUp() { 22 void setUp() {
23 super.setUp(); 23 super.setUp();
24 computer = new LocalComputer(); 24 computer = new LocalComputer();
25 } 25 }
26 26
27 test_block() { 27 test_block() {
28 addTestSource('class A {a() {var f; ^ var g;}}'); 28 addTestSource('class A {a() {var f; {var x;} ^ var g;}}');
29 expect(computeFast(), isTrue); 29 expect(computeFast(), isTrue);
30 assertSuggestVariable('f'); 30 assertSuggestVariable('f');
31 assertNotSuggested('g'); 31 assertNotSuggested('g');
32 assertNotSuggested('x');
32 } 33 }
33 34
34 test_catch() { 35 test_catch() {
35 addTestSource('class A {a() {try{} catch (e) {^}}}'); 36 addTestSource('class A {a() {try{} catch (e) {^}}}');
36 expect(computeFast(), isTrue); 37 expect(computeFast(), isTrue);
37 assertSuggestParameter('e'); 38 assertSuggestParameter('e');
38 } 39 }
39 40
40 test_catch2() { 41 test_catch2() {
41 addTestSource('class A {a() {try{} catch (e, s) {^}}}'); 42 addTestSource('class A {a() {try{} catch (e, s) {^}}}');
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 assertSuggestParameter('y'); 94 assertSuggestParameter('y');
94 } 95 }
95 96
96 test_methodParam_positional() { 97 test_methodParam_positional() {
97 addTestSource('class A {a(x, [y=1]) {^}}'); 98 addTestSource('class A {a(x, [y=1]) {^}}');
98 expect(computeFast(), isTrue); 99 expect(computeFast(), isTrue);
99 assertSuggestMethodName('a'); 100 assertSuggestMethodName('a');
100 assertSuggestParameter('x'); 101 assertSuggestParameter('x');
101 assertSuggestParameter('y'); 102 assertSuggestParameter('y');
102 } 103 }
103 } 104
105 test_variableDeclaration() {
106 addTestSource('main() {int a = 1, b = 2 + ^;}');
107 expect(computeFast(), isTrue);
108 assertSuggestVariable('a');
109 assertNotSuggested('b');
110 }
111 }
112
OLDNEW
« no previous file with comments | « pkg/analysis_services/lib/src/completion/local_computer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698