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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1168743002: Reanalyze after creating a referenced part. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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.src.context.context_test; 5 library test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/cancelable_future.dart'; 9 import 'package:analyzer/src/cancelable_future.dart';
10 import 'package:analyzer/src/context/cache.dart'; 10 import 'package:analyzer/src/context/cache.dart';
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 expect(importNode.uriContent, isNotNull); 466 expect(importNode.uriContent, isNotNull);
467 expect(importNode.source, libSource); 467 expect(importNode.source, libSource);
468 } 468 }
469 469
470 void test_performAnalysisTask_addPart() { 470 void test_performAnalysisTask_addPart() {
471 Source libSource = addSource("/lib.dart", r''' 471 Source libSource = addSource("/lib.dart", r'''
472 library lib; 472 library lib;
473 part 'part.dart';'''); 473 part 'part.dart';''');
474 // run all tasks without part 474 // run all tasks without part
475 _analyzeAll_assertFinished(); 475 _analyzeAll_assertFinished();
476 expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(libSource)),
477 isTrue, reason: "lib has errors");
476 // add part and run all tasks 478 // add part and run all tasks
477 Source partSource = addSource("/part.dart", r''' 479 Source partSource = addSource("/part.dart", r'''
478 part of lib; 480 part of lib;
479 '''); 481 ''');
480 _analyzeAll_assertFinished(); 482 _analyzeAll_assertFinished();
481 // "libSource" should be here 483 // "libSource" should be here
482 List<Source> librariesWithPart = context.getLibrariesContaining(partSource); 484 List<Source> librariesWithPart = context.getLibrariesContaining(partSource);
483 expect(librariesWithPart, unorderedEquals([libSource])); 485 expect(librariesWithPart, unorderedEquals([libSource]));
486 expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(libSource)),
487 isFalse, reason: "lib doesn't have errors");
488 expect(
489 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull,
490 reason: "part resolved");
484 } 491 }
485 492
486 void test_performAnalysisTask_changeLibraryContents() { 493 void test_performAnalysisTask_changeLibraryContents() {
487 Source libSource = 494 Source libSource =
488 addSource("/test.dart", "library lib; part 'test-part.dart';"); 495 addSource("/test.dart", "library lib; part 'test-part.dart';");
489 Source partSource = addSource("/test-part.dart", "part of lib;"); 496 Source partSource = addSource("/test-part.dart", "part of lib;");
490 _analyzeAll_assertFinished(); 497 _analyzeAll_assertFinished();
491 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, 498 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull,
492 reason: "library resolved 1"); 499 reason: "library resolved 1");
493 expect( 500 expect(
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 : super(name, pathos.toUri(name), UriKind.FILE_URI); 2141 : super(name, pathos.toUri(name), UriKind.FILE_URI);
2135 2142
2136 @override 2143 @override
2137 TimestampedData<String> get contents { 2144 TimestampedData<String> get contents {
2138 throw 'Read error'; 2145 throw 'Read error';
2139 } 2146 }
2140 2147
2141 @override 2148 @override
2142 bool exists() => true; 2149 bool exists() => true;
2143 } 2150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698