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

Side by Side Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 1044463005: Issue 23027. Try to make priority files analyzable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
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.domain.analysis; 5 library test.domain.analysis;
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/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 }); 314 });
315 } 315 }
316 316
317 test_setRoots_packages() { 317 test_setRoots_packages() {
318 // prepare package 318 // prepare package
319 String pkgFile = '/packages/pkgA/libA.dart'; 319 String pkgFile = '/packages/pkgA/libA.dart';
320 resourceProvider.newFile(pkgFile, ''' 320 resourceProvider.newFile(pkgFile, '''
321 library lib_a; 321 library lib_a;
322 class A {} 322 class A {}
323 '''); 323 ''');
324 packageMapProvider.packageMap['pkgA'] = [ 324 packageMapProvider.packageMap['pkgA'] =
325 resourceProvider.getResource('/packages/pkgA') 325 [resourceProvider.getResource('/packages/pkgA')];
326 ];
327 addTestFile(''' 326 addTestFile('''
328 import 'package:pkgA/libA.dart'; 327 import 'package:pkgA/libA.dart';
329 main(A a) { 328 main(A a) {
330 } 329 }
331 '''); 330 ''');
332 // create project and wait for analysis 331 // create project and wait for analysis
333 createProject(); 332 createProject();
334 return waitForTasksFinished().then((_) { 333 return waitForTasksFinished().then((_) {
335 // if 'package:pkgA/libA.dart' was resolved, then there are no errors 334 // if 'package:pkgA/libA.dart' was resolved, then there are no errors
336 expect(filesErrors[testFile], isEmpty); 335 expect(filesErrors[testFile], isEmpty);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // wait for analysis, no results initially 639 // wait for analysis, no results initially
641 await waitForTasksFinished(); 640 await waitForTasksFinished();
642 expect(filesHighlights[pkgFileA], isNull); 641 expect(filesHighlights[pkgFileA], isNull);
643 // subscribe 642 // subscribe
644 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFileA); 643 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFileA);
645 await server.onAnalysisComplete; 644 await server.onAnalysisComplete;
646 // there are results 645 // there are results
647 expect(filesHighlights[pkgFileA], isNotEmpty); 646 expect(filesHighlights[pkgFileA], isNotEmpty);
648 } 647 }
649 648
649 test_afterAnalysis_packageFile_notUsed() async {
650 String pkgFile = '/packages/pkgA/lib/libA.dart';
651 resourceProvider.newFile(pkgFile, '''
652 library lib_a;
653 class A {}
654 ''');
655 packageMapProvider.packageMap = {
656 'pkgA': [(resourceProvider.newFolder('/packages/pkgA/lib'))]
657 };
658 //
659 addTestFile('// no "pkgA" reference');
660 createProject();
661 // wait for analysis, no results initially
662 await waitForTasksFinished();
663 expect(filesHighlights[pkgFile], isNull);
664 // make it a priority file, so make analyzable
665 server.setPriorityFiles('0', [pkgFile]);
666 // subscribe
667 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, pkgFile);
668 await server.onAnalysisComplete;
669 // there are results
670 expect(filesHighlights[pkgFile], isNotEmpty);
671 }
672
650 test_afterAnalysis_sdkFile() async { 673 test_afterAnalysis_sdkFile() async {
651 String file = '/lib/core/core.dart'; 674 String file = '/lib/core/core.dart';
652 addTestFile('// no matter'); 675 addTestFile('// no matter');
653 createProject(); 676 createProject();
654 // wait for analysis, no results initially 677 // wait for analysis, no results initially
655 await waitForTasksFinished(); 678 await waitForTasksFinished();
656 expect(filesHighlights[file], isNull); 679 expect(filesHighlights[file], isNull);
657 // subscribe 680 // subscribe
658 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file); 681 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, file);
659 await server.onAnalysisComplete; 682 await server.onAnalysisComplete;
660 // there are results 683 // there are results
661 expect(filesHighlights[file], isNotEmpty); 684 expect(filesHighlights[file], isNotEmpty);
662 } 685 }
663 686
664 test_beforeAnalysis() async { 687 test_beforeAnalysis() async {
665 addTestFile('int V = 42;'); 688 addTestFile('int V = 42;');
666 createProject(); 689 createProject();
667 // subscribe 690 // subscribe
668 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile); 691 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
669 // wait for analysis 692 // wait for analysis
670 await waitForTasksFinished(); 693 await waitForTasksFinished();
671 expect(filesHighlights[testFile], isNotEmpty); 694 expect(filesHighlights[testFile], isNotEmpty);
672 } 695 }
673 } 696 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698