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

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

Issue 1160873004: Only units with 'part of' and no other directives are parts. (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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 void test_performAnalysisTask_changePartContents_makeItAPart() { 557 void test_performAnalysisTask_changePartContents_makeItAPart() {
558 Source libSource = addSource("/lib.dart", r''' 558 Source libSource = addSource("/lib.dart", r'''
559 library lib; 559 library lib;
560 part 'part.dart'; 560 part 'part.dart';
561 void f(x) {}'''); 561 void f(x) {}''');
562 Source partSource = addSource("/part.dart", "void g() { f(null); }"); 562 Source partSource = addSource("/part.dart", "void g() { f(null); }");
563 _analyzeAll_assertFinished(); 563 _analyzeAll_assertFinished();
564 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, 564 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull,
565 reason: "library resolved 1"); 565 reason: "library resolved 1");
566 expect( 566 expect(
567 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, 567 context.getResolvedCompilationUnit2(partSource, partSource), isNotNull,
568 reason: "part resolved 1"); 568 reason: "part resolved 1");
569 // update and analyze 569 // update and analyze
570 context.setContents(partSource, r''' 570 context.setContents(partSource, r'''
571 part of lib; 571 part of lib;
572 void g() { f(null); }'''); 572 void g() { f(null); }''');
573 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNull, 573 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNull,
574 reason: "library changed 2"); 574 reason: "library changed 2");
575 expect(context.getResolvedCompilationUnit2(partSource, libSource), isNull, 575 expect(context.getResolvedCompilationUnit2(partSource, partSource), isNull,
576 reason: "part changed 2"); 576 reason: "part changed 2");
577 _analyzeAll_assertFinished(); 577 _analyzeAll_assertFinished();
578 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, 578 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull,
579 reason: "library resolved 2"); 579 reason: "library resolved 2");
580 expect( 580 expect(
581 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, 581 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull,
582 reason: "part resolved 2"); 582 reason: "part resolved 2");
583 expect(context.getErrors(libSource).errors, hasLength(0)); 583 expect(context.getErrors(libSource).errors, hasLength(0));
584 expect(context.getErrors(partSource).errors, hasLength(0)); 584 expect(context.getErrors(partSource).errors, hasLength(0));
585 } 585 }
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 : super(name, pathos.toUri(name), UriKind.FILE_URI); 2134 : super(name, pathos.toUri(name), UriKind.FILE_URI);
2135 2135
2136 @override 2136 @override
2137 TimestampedData<String> get contents { 2137 TimestampedData<String> get contents {
2138 throw 'Read error'; 2138 throw 'Read error';
2139 } 2139 }
2140 2140
2141 @override 2141 @override
2142 bool exists() => true; 2142 bool exists() => true;
2143 } 2143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698