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

Side by Side Diff: pkg/analysis_server/test/search/element_references_test.dart

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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.search.element_references; 5 library test.search.element_references;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
11 import 'package:test_reflective_loader/test_reflective_loader.dart'; 11 import 'package:test_reflective_loader/test_reflective_loader.dart';
12 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
13 13
14 import '../utils.dart';
14 import 'abstract_search_domain.dart'; 15 import 'abstract_search_domain.dart';
15 16
16 main() { 17 main() {
17 groupSep = ' | '; 18 initializeTestEnvironment();
18 defineReflectiveTests(ElementReferencesTest); 19 defineReflectiveTests(ElementReferencesTest);
19 defineReflectiveTests(_NoSearchEngine); 20 defineReflectiveTests(_NoSearchEngine);
20 } 21 }
21 22
22 @reflectiveTest 23 @reflectiveTest
23 class ElementReferencesTest extends AbstractSearchDomainTest { 24 class ElementReferencesTest extends AbstractSearchDomainTest {
24 Element searchElement; 25 Element searchElement;
25 26
26 void assertHasRef(SearchResultKind kind, String search, bool isPotential) { 27 void assertHasRef(SearchResultKind kind, String search, bool isPotential) {
27 assertHasResult(kind, search); 28 assertHasResult(kind, search);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 library my_lib; 447 library my_lib;
447 class A {} 448 class A {}
448 class B { 449 class B {
449 B.named() { 450 B.named() {
450 A a = null; 451 A a = null;
451 } 452 }
452 } 453 }
453 '''); 454 ''');
454 await findElementReferences('A {}', false); 455 await findElementReferences('A {}', false);
455 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;'); 456 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;');
456 expect(getPathString(result.path), ''' 457 expect(
458 getPathString(result.path),
459 '''
457 LOCAL_VARIABLE a 460 LOCAL_VARIABLE a
458 CONSTRUCTOR named 461 CONSTRUCTOR named
459 CLASS B 462 CLASS B
460 COMPILATION_UNIT test.dart 463 COMPILATION_UNIT test.dart
461 LIBRARY my_lib'''); 464 LIBRARY my_lib''');
462 } 465 }
463 466
464 test_path_inConstructor_unnamed() async { 467 test_path_inConstructor_unnamed() async {
465 addTestFile(''' 468 addTestFile('''
466 library my_lib; 469 library my_lib;
467 class A {} 470 class A {}
468 class B { 471 class B {
469 B() { 472 B() {
470 A a = null; 473 A a = null;
471 } 474 }
472 } 475 }
473 '''); 476 ''');
474 await findElementReferences('A {}', false); 477 await findElementReferences('A {}', false);
475 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;'); 478 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;');
476 expect(getPathString(result.path), ''' 479 expect(
480 getPathString(result.path),
481 '''
477 LOCAL_VARIABLE a 482 LOCAL_VARIABLE a
478 CONSTRUCTOR 483 CONSTRUCTOR
479 CLASS B 484 CLASS B
480 COMPILATION_UNIT test.dart 485 COMPILATION_UNIT test.dart
481 LIBRARY my_lib'''); 486 LIBRARY my_lib''');
482 } 487 }
483 488
484 test_path_inFunction() async { 489 test_path_inFunction() async {
485 addTestFile(''' 490 addTestFile('''
486 library my_lib; 491 library my_lib;
487 class A {} 492 class A {}
488 main() { 493 main() {
489 A a = null; 494 A a = null;
490 } 495 }
491 '''); 496 ''');
492 await findElementReferences('A {}', false); 497 await findElementReferences('A {}', false);
493 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;'); 498 assertHasResult(SearchResultKind.REFERENCE, 'A a = null;');
494 expect(getPathString(result.path), ''' 499 expect(
500 getPathString(result.path),
501 '''
495 LOCAL_VARIABLE a 502 LOCAL_VARIABLE a
496 FUNCTION main 503 FUNCTION main
497 COMPILATION_UNIT test.dart 504 COMPILATION_UNIT test.dart
498 LIBRARY my_lib'''); 505 LIBRARY my_lib''');
499 } 506 }
500 507
501 test_potential_disabled() async { 508 test_potential_disabled() async {
502 addTestFile(''' 509 addTestFile('''
503 class A { 510 class A {
504 test(p) {} 511 test(p) {}
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 print(vvv); 718 print(vvv);
712 } 719 }
713 '''); 720 ''');
714 Request request = new SearchFindElementReferencesParams(testFile, 0, false) 721 Request request = new SearchFindElementReferencesParams(testFile, 0, false)
715 .toRequest('0'); 722 .toRequest('0');
716 Response response = await waitResponse(request); 723 Response response = await waitResponse(request);
717 expect(response.error, isNotNull); 724 expect(response.error, isNotNull);
718 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 725 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
719 } 726 }
720 } 727 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/protocol_test.dart ('k') | pkg/analysis_server/test/search/member_declarations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698