OLD | NEW |
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // add part and run all tasks | 480 // add part and run all tasks |
481 Source partSource = addSource("/part.dart", r''' | 481 Source partSource = addSource("/part.dart", r''' |
482 part of lib; | 482 part of lib; |
483 '''); | 483 '''); |
484 _analyzeAll_assertFinished(); | 484 _analyzeAll_assertFinished(); |
485 // "libSource" should be here | 485 // "libSource" should be here |
486 List<Source> librariesWithPart = context.getLibrariesContaining(partSource); | 486 List<Source> librariesWithPart = context.getLibrariesContaining(partSource); |
487 expect(librariesWithPart, unorderedEquals([libSource])); | 487 expect(librariesWithPart, unorderedEquals([libSource])); |
488 } | 488 } |
489 | 489 |
490 void fail_performAnalysisTask_changeLibraryContents() { | 490 void test_performAnalysisTask_changeLibraryContents() { |
491 Source libSource = | 491 Source libSource = |
492 addSource("/test.dart", "library lib; part 'test-part.dart';"); | 492 addSource("/test.dart", "library lib; part 'test-part.dart';"); |
493 Source partSource = addSource("/test-part.dart", "part of lib;"); | 493 Source partSource = addSource("/test-part.dart", "part of lib;"); |
494 _analyzeAll_assertFinished(); | 494 _analyzeAll_assertFinished(); |
495 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, | 495 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, |
496 reason: "library resolved 1"); | 496 reason: "library resolved 1"); |
497 expect( | 497 expect( |
498 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, | 498 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, |
499 reason: "part resolved 1"); | 499 reason: "part resolved 1"); |
500 // update and analyze #1 | 500 // update and analyze #1 |
(...skipping 14 matching lines...) Expand all Loading... |
515 expect(context.getResolvedCompilationUnit2(partSource, libSource), isNull, | 515 expect(context.getResolvedCompilationUnit2(partSource, libSource), isNull, |
516 reason: "part changed 3"); | 516 reason: "part changed 3"); |
517 _analyzeAll_assertFinished(); | 517 _analyzeAll_assertFinished(); |
518 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, | 518 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, |
519 reason: "library resolved 2"); | 519 reason: "library resolved 2"); |
520 expect( | 520 expect( |
521 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, | 521 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, |
522 reason: "part resolved 3"); | 522 reason: "part resolved 3"); |
523 } | 523 } |
524 | 524 |
525 void fail_performAnalysisTask_changeLibraryThenPartContents() { | 525 void test_performAnalysisTask_changeLibraryThenPartContents() { |
526 Source libSource = | 526 Source libSource = |
527 addSource("/test.dart", "library lib; part 'test-part.dart';"); | 527 addSource("/test.dart", "library lib; part 'test-part.dart';"); |
528 Source partSource = addSource("/test-part.dart", "part of lib;"); | 528 Source partSource = addSource("/test-part.dart", "part of lib;"); |
529 _analyzeAll_assertFinished(); | 529 _analyzeAll_assertFinished(); |
530 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, | 530 expect(context.getResolvedCompilationUnit2(libSource, libSource), isNotNull, |
531 reason: "library resolved 1"); | 531 reason: "library resolved 1"); |
532 expect( | 532 expect( |
533 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, | 533 context.getResolvedCompilationUnit2(partSource, libSource), isNotNull, |
534 reason: "part resolved 1"); | 534 reason: "part resolved 1"); |
535 // update and analyze #1 | 535 // update and analyze #1 |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 : super(name, UriKind.FILE_URI); | 2034 : super(name, UriKind.FILE_URI); |
2035 | 2035 |
2036 @override | 2036 @override |
2037 TimestampedData<String> get contents { | 2037 TimestampedData<String> get contents { |
2038 throw 'Read error'; | 2038 throw 'Read error'; |
2039 } | 2039 } |
2040 | 2040 |
2041 @override | 2041 @override |
2042 bool exists() => true; | 2042 bool exists() => true; |
2043 } | 2043 } |
OLD | NEW |