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

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

Issue 803913003: fix named constructor completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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_server/test/mock_sdk.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.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/protocol.dart' as protocol show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 assertSuggestLocalVariable('f', null); 1019 assertSuggestLocalVariable('f', null);
1020 // Don't suggest locals out of scope 1020 // Don't suggest locals out of scope
1021 assertNotSuggested('r'); 1021 assertNotSuggested('r');
1022 assertNotSuggested('x'); 1022 assertNotSuggested('x');
1023 1023
1024 assertSuggestImportedClass('A'); 1024 assertSuggestImportedClass('A');
1025 assertNotSuggested('_B'); 1025 assertNotSuggested('_B');
1026 assertSuggestImportedClass('C'); 1026 assertSuggestImportedClass('C');
1027 // hidden element suggested as low relevance 1027 // hidden element suggested as low relevance
1028 // but imported results are partially filtered 1028 // but imported results are partially filtered
1029 //assertSuggestImportedClass('D', CompletionRelevance.LOW); 1029 //assertSuggestImportedClass('D', CompletionRelevance.LOW)
Paul Berry 2014/12/15 16:27:30 Was the semicolon removed by mistake?
danrubel 2014/12/15 17:18:30 Yes. Will add back in following CL
1030 //assertSuggestImportedFunction('D1', null, true, CompletionRelevance.LOW) ; 1030 //assertSuggestImportedFunction(
1031 // 'D1', null, true, CompletionRelevance.LOW);
1031 assertSuggestLocalFunction('D2', 'Z'); 1032 assertSuggestLocalFunction('D2', 'Z');
1032 assertSuggestImportedClass('EE'); 1033 assertSuggestImportedClass('EE');
1033 // hidden element suggested as low relevance 1034 // hidden element suggested as low relevance
1034 //assertSuggestImportedClass('F', CompletionRelevance.LOW); 1035 //assertSuggestImportedClass('F', CompletionRelevance.LOW);
1035 assertSuggestLibraryPrefix('g'); 1036 assertSuggestLibraryPrefix('g');
1036 assertNotSuggested('G'); 1037 assertNotSuggested('G');
1037 //assertSuggestImportedClass('H', CompletionRelevance.LOW); 1038 //assertSuggestImportedClass('H', CompletionRelevance.LOW);
1038 assertSuggestImportedClass('Object'); 1039 assertSuggestImportedClass('Object');
1039 assertSuggestImportedFunction('min', 'num', false); 1040 assertSuggestImportedFunction('min', 'num', false);
1040 //assertSuggestImportedFunction( 1041 //assertSuggestImportedFunction(
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 return computeFull((bool result) { 1416 return computeFull((bool result) {
1416 assertSuggestNamedConstructor('c', 'X'); 1417 assertSuggestNamedConstructor('c', 'X');
1417 assertNotSuggested('F1'); 1418 assertNotSuggested('F1');
1418 assertNotSuggested('T1'); 1419 assertNotSuggested('T1');
1419 assertNotSuggested('_d'); 1420 assertNotSuggested('_d');
1420 assertNotSuggested('z'); 1421 assertNotSuggested('z');
1421 assertNotSuggested('m'); 1422 assertNotSuggested('m');
1422 }); 1423 });
1423 } 1424 }
1424 1425
1426 test_ConstructorName_importedFactory() {
1427 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1428 // InstanceCreationExpression
1429 addSource('/testB.dart', '''
1430 lib B;
1431 int T1;
1432 F1() { }
1433 class X {factory X.c(); factory X._d(); z() {}}''');
1434 addTestSource('''
1435 import "/testB.dart";
1436 var m;
1437 main() {new X.^}''');
1438 computeFast();
1439 return computeFull((bool result) {
1440 assertSuggestNamedConstructor('c', 'X');
1441 assertNotSuggested('F1');
1442 assertNotSuggested('T1');
1443 assertNotSuggested('_d');
1444 assertNotSuggested('z');
1445 assertNotSuggested('m');
1446 });
1447 }
1448
1449 test_ConstructorName_importedFactory2() {
1450 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1451 // InstanceCreationExpression
1452 addTestSource('''
1453 main() {new String.fr^omCharCodes([]);}''');
1454 computeFast();
1455 return computeFull((bool result) {
1456 assertSuggestNamedConstructor('fromCharCodes', 'String');
1457 assertNotSuggested('isEmpty');
1458 assertNotSuggested('isNotEmpty');
1459 assertNotSuggested('length');
1460 assertNotSuggested('Object');
1461 assertNotSuggested('String');
1462 });
1463 }
1464
1425 test_ConstructorName_localClass() { 1465 test_ConstructorName_localClass() {
1426 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName 1466 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1427 // InstanceCreationExpression 1467 // InstanceCreationExpression
1428 addTestSource(''' 1468 addTestSource('''
1429 int T1; 1469 int T1;
1430 F1() { } 1470 F1() { }
1431 class X {X.c(); X._d(); z() {}} 1471 class X {X.c(); X._d(); z() {}}
1432 main() {new X.^}'''); 1472 main() {new X.^}''');
1433 computeFast(); 1473 computeFast();
1434 return computeFull((bool result) { 1474 return computeFull((bool result) {
1435 assertSuggestNamedConstructor('c', 'X'); 1475 assertSuggestNamedConstructor('c', 'X');
1436 assertSuggestNamedConstructor('_d', 'X'); 1476 assertSuggestNamedConstructor('_d', 'X');
1437 assertNotSuggested('F1'); 1477 assertNotSuggested('F1');
1438 assertNotSuggested('T1'); 1478 assertNotSuggested('T1');
1439 assertNotSuggested('z'); 1479 assertNotSuggested('z');
1440 assertNotSuggested('m'); 1480 assertNotSuggested('m');
1441 }); 1481 });
1442 } 1482 }
1443 1483
1484 test_ConstructorName_localFactory() {
1485 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1486 // InstanceCreationExpression
1487 addTestSource('''
1488 int T1;
1489 F1() { }
1490 class X {factory X.c(); factory X._d(); z() {}}
1491 main() {new X.^}''');
1492 computeFast();
1493 return computeFull((bool result) {
1494 assertSuggestNamedConstructor('c', 'X');
1495 assertSuggestNamedConstructor('_d', 'X');
1496 assertNotSuggested('F1');
1497 assertNotSuggested('T1');
1498 assertNotSuggested('z');
1499 assertNotSuggested('m');
1500 });
1501 }
1502
1444 test_ExpressionStatement_identifier() { 1503 test_ExpressionStatement_identifier() {
1445 // SimpleIdentifier ExpressionStatement Block 1504 // SimpleIdentifier ExpressionStatement Block
1446 addSource('/testA.dart', ''' 1505 addSource('/testA.dart', '''
1447 _B F1() { } 1506 _B F1() { }
1448 class A {int x;} 1507 class A {int x;}
1449 class _B { }'''); 1508 class _B { }''');
1450 addTestSource(''' 1509 addTestSource('''
1451 import "/testA.dart"; 1510 import "/testA.dart";
1452 typedef int F2(int blat); 1511 typedef int F2(int blat);
1453 class Clz = Object with Object; 1512 class Clz = Object with Object;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 assertNotSuggested('bar2'); 2260 assertNotSuggested('bar2');
2202 assertNotSuggested('_B'); 2261 assertNotSuggested('_B');
2203 assertSuggestLocalClass('Y'); 2262 assertSuggestLocalClass('Y');
2204 assertSuggestLocalClass('C'); 2263 assertSuggestLocalClass('C');
2205 assertSuggestLocalVariable('f', null); 2264 assertSuggestLocalVariable('f', null);
2206 assertNotSuggested('x'); 2265 assertNotSuggested('x');
2207 assertNotSuggested('e'); 2266 assertNotSuggested('e');
2208 }); 2267 });
2209 } 2268 }
2210 } 2269 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698