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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 1255953004: better completions in switch statements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 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
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.util; 5 library test.services.completion.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/protocol.dart' as protocol 10 import 'package:analysis_server/src/protocol.dart' as protocol
(...skipping 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 expect(request.replacementOffset, completionOffset); 3979 expect(request.replacementOffset, completionOffset);
3980 expect(request.replacementLength, 0); 3980 expect(request.replacementLength, 0);
3981 assertSuggestInvocationGetter('isEven', 'bool'); 3981 assertSuggestInvocationGetter('isEven', 'bool');
3982 assertNotSuggested('A'); 3982 assertNotSuggested('A');
3983 assertNotSuggested('a'); 3983 assertNotSuggested('a');
3984 assertNotSuggested('Object'); 3984 assertNotSuggested('Object');
3985 assertNotSuggested('=='); 3985 assertNotSuggested('==');
3986 }); 3986 });
3987 } 3987 }
3988 3988
3989 test_SwitchStatement_c() {
3990 // SwitchStatement Block BlockFunctionBody MethodDeclaration
3991 addTestSource('class A {String g(int x) {switch(x) {c^}}}');
3992 computeFast();
3993 return computeFull((bool result) {
3994 assertNoSuggestions();
3995 });
3996 }
3997
3998 test_SwitchStatement_case() {
3999 // SwitchStatement Block BlockFunctionBody MethodDeclaration
4000 addTestSource('class A {String g(int x) {switch(x) {case 0: ^}}}');
4001 computeFast();
4002 return computeFull((bool result) {
4003 assertSuggestLocalClass('A');
4004 assertSuggestLocalMethod('g', 'A', 'String');
4005 assertSuggestImportedClass('String');
4006 });
4007 }
4008
4009 test_SwitchStatement_empty() {
4010 // SwitchStatement Block BlockFunctionBody MethodDeclaration
4011 addTestSource('class A {String g(int x) {switch(x) {^}}}');
4012 computeFast();
4013 return computeFull((bool result) {
4014 assertNoSuggestions();
4015 });
4016 }
4017
3989 test_ThisExpression_block() { 4018 test_ThisExpression_block() {
3990 // MethodInvocation ExpressionStatement Block 4019 // MethodInvocation ExpressionStatement Block
3991 addTestSource(''' 4020 addTestSource('''
3992 main() { } 4021 main() { }
3993 class I {X get f => new A();get _g => new A();} 4022 class I {X get f => new A();get _g => new A();}
3994 class A implements I { 4023 class A implements I {
3995 A() {} 4024 A() {}
3996 A.z() {} 4025 A.z() {}
3997 var b; X _c; 4026 var b; X _c;
3998 X get d => new A();get _e => new A(); 4027 X get d => new A();get _e => new A();
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
4365 assertNotSuggested('bar2'); 4394 assertNotSuggested('bar2');
4366 assertNotSuggested('_B'); 4395 assertNotSuggested('_B');
4367 assertSuggestLocalClass('Y'); 4396 assertSuggestLocalClass('Y');
4368 assertSuggestLocalClass('C'); 4397 assertSuggestLocalClass('C');
4369 assertSuggestLocalVariable('f', null); 4398 assertSuggestLocalVariable('f', null);
4370 assertNotSuggested('x'); 4399 assertNotSuggested('x');
4371 assertNotSuggested('e'); 4400 assertNotSuggested('e');
4372 }); 4401 });
4373 } 4402 }
4374 } 4403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698