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

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

Issue 1410813003: Reset AnalysisDriver after changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 _removeSource(libBSource); 1800 _removeSource(libBSource);
1801 _analyzeAll_assertFinished(); 1801 _analyzeAll_assertFinished();
1802 expect( 1802 expect(
1803 context.getResolvedCompilationUnit2(libASource, libASource), isNotNull, 1803 context.getResolvedCompilationUnit2(libASource, libASource), isNotNull,
1804 reason: "libA resolved 2"); 1804 reason: "libA resolved 2");
1805 expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(libASource)), 1805 expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(libASource)),
1806 isTrue, 1806 isTrue,
1807 reason: "libA has an error"); 1807 reason: "libA has an error");
1808 } 1808 }
1809 1809
1810 void test_performAnalysisTask_interruptBy_setContents() {
1811 Source sourceA = addSource(
1812 "/a.dart",
1813 r'''
1814 library expectedToFindSemicolon
1815 ''');
1816 // Analyze to the point where some of the results stop depending on
1817 // the source content.
1818 LibrarySpecificUnit unitA = new LibrarySpecificUnit(sourceA, sourceA);
1819 for (int i = 0; i < 10000; i++) {
1820 context.performAnalysisTask();
1821 if (context.getResult(unitA, RESOLVED_UNIT2) != null) {
1822 break;
1823 }
1824 }
1825 // Update the source.
1826 // This should invalidate all the results and also reset the driver.
1827 context.setContents(sourceA, "library semicolonWasAdded;");
1828 expect(context.getResult(unitA, RESOLVED_UNIT2), isNull);
1829 expect(analysisDriver.currentWorkOrder, isNull);
1830 // Continue analysis.
1831 _analyzeAll_assertFinished();
1832 expect(context.getErrors(sourceA).errors, isEmpty);
1833 }
1834
1810 void test_performAnalysisTask_IOException() { 1835 void test_performAnalysisTask_IOException() {
1811 TestSource source = _addSourceWithException2("/test.dart", "library test;"); 1836 TestSource source = _addSourceWithException2("/test.dart", "library test;");
1812 source.generateExceptionOnRead = false; 1837 source.generateExceptionOnRead = false;
1813 _analyzeAll_assertFinished(); 1838 _analyzeAll_assertFinished();
1814 expect(source.readCount, 2); 1839 expect(source.readCount, 2);
1815 _changeSource(source, ""); 1840 _changeSource(source, "");
1816 source.generateExceptionOnRead = true; 1841 source.generateExceptionOnRead = true;
1817 _analyzeAll_assertFinished(); 1842 _analyzeAll_assertFinished();
1818 if (AnalysisEngine.instance.limitInvalidationInTaskModel) { 1843 if (AnalysisEngine.instance.limitInvalidationInTaskModel) {
1819 expect(source.readCount, 7); 1844 expect(source.readCount, 7);
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 } 2586 }
2562 } 2587 }
2563 2588
2564 class _AnalysisContextImplTest_test_applyChanges_removeContainer 2589 class _AnalysisContextImplTest_test_applyChanges_removeContainer
2565 implements SourceContainer { 2590 implements SourceContainer {
2566 Source libB; 2591 Source libB;
2567 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); 2592 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB);
2568 @override 2593 @override
2569 bool contains(Source source) => source == libB; 2594 bool contains(Source source) => source == libB;
2570 } 2595 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698