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

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

Issue 1144023009: Adapt the existing incremental resolution implementation to the new model. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixes for review comments. Created 5 years, 7 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/test/generated/incremental_resolver_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.task.driver_test; 5 library test.src.task.driver_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/engine.dart' 8 import 'package:analyzer/src/generated/engine.dart'
9 show 9 show
10 AnalysisContext, 10 AnalysisContext,
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 expect(entry.getValue(result1), 111); 617 expect(entry.getValue(result1), 111);
618 expect(entry.getValue(result2), 222); 618 expect(entry.getValue(result2), 222);
619 // set result1; result2 is intact 619 // set result1; result2 is intact
620 entry.setValue(result1, 1111, TargetedResult.EMPTY_LIST); 620 entry.setValue(result1, 1111, TargetedResult.EMPTY_LIST);
621 expect(entry.getState(result1), CacheState.VALID); 621 expect(entry.getState(result1), CacheState.VALID);
622 expect(entry.getState(result2), CacheState.VALID); 622 expect(entry.getState(result2), CacheState.VALID);
623 expect(entry.getValue(result1), 1111); 623 expect(entry.getValue(result1), 1111);
624 expect(entry.getValue(result2), 222); 624 expect(entry.getValue(result2), 222);
625 } 625 }
626 626
627 test_setValueIncremental() {
628 AnalysisTarget target = new TestSource();
629 CacheEntry entry = new CacheEntry(target);
630 cache.put(entry);
631 ResultDescriptor result1 = new ResultDescriptor('result1', -1);
632 ResultDescriptor result2 = new ResultDescriptor('result2', -2);
633 ResultDescriptor result3 = new ResultDescriptor('result3', -3);
634 // set results, all of them are VALID
635 entry.setValue(result1, 111, TargetedResult.EMPTY_LIST);
636 entry.setValue(result2, 222, [new TargetedResult(target, result1)]);
637 entry.setValue(result3, 333, [new TargetedResult(target, result2)]);
638 expect(entry.getState(result1), CacheState.VALID);
639 expect(entry.getState(result2), CacheState.VALID);
640 expect(entry.getState(result3), CacheState.VALID);
641 expect(entry.getValue(result1), 111);
642 expect(entry.getValue(result2), 222);
643 expect(entry.getValue(result3), 333);
644 // replace result1, keep "dependedOn", invalidate result3
645 entry.setValueIncremental(result2, 2222);
646 expect(entry.getState(result1), CacheState.VALID);
647 expect(entry.getState(result2), CacheState.VALID);
648 expect(entry.getState(result3), CacheState.INVALID);
649 expect(entry.getValue(result1), 111);
650 expect(entry.getValue(result2), 2222);
651 expect(entry.getValue(result3), -3);
652 expect(entry.getResultData(result2).dependedOnResults,
653 unorderedEquals([new TargetedResult(target, result1)]));
654 }
655
627 test_toString_empty() { 656 test_toString_empty() {
628 AnalysisTarget target = new TestSource(); 657 AnalysisTarget target = new TestSource();
629 CacheEntry entry = new CacheEntry(target); 658 CacheEntry entry = new CacheEntry(target);
630 expect(entry.toString(), isNotNull); 659 expect(entry.toString(), isNotNull);
631 } 660 }
632 661
633 test_toString_nonEmpty() { 662 test_toString_nonEmpty() {
634 AnalysisTarget target = new TestSource(); 663 AnalysisTarget target = new TestSource();
635 ResultDescriptor result = new ResultDescriptor('test', null); 664 ResultDescriptor result = new ResultDescriptor('test', null);
636 CacheEntry entry = new CacheEntry(target); 665 CacheEntry entry = new CacheEntry(target);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 951
923 class _InternalAnalysisContextMock extends TypedMock 952 class _InternalAnalysisContextMock extends TypedMock
924 implements InternalAnalysisContext { 953 implements InternalAnalysisContext {
925 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 954 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
926 } 955 }
927 956
928 class _TestAnalysisTarget implements AnalysisTarget { 957 class _TestAnalysisTarget implements AnalysisTarget {
929 @override 958 @override
930 Source get source => null; 959 Source get source => null;
931 } 960 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/incremental_resolver_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698