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

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

Issue 2172143003: Fix for recording dependency when the user is recorder before the provider. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/cache.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 analyzer.test.src.context.cache_test; 5 library analyzer.test.src.context.cache_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/source/package_map_resolver.dart'; 9 import 'package:analyzer/source/package_map_resolver.dart';
10 import 'package:analyzer/src/context/cache.dart'; 10 import 'package:analyzer/src/context/cache.dart';
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 expect(entry.getValue(result1), 111); 774 expect(entry.getValue(result1), 111);
775 expect(entry.getValue(result2), 222); 775 expect(entry.getValue(result2), 222);
776 // set result1; result2 is intact 776 // set result1; result2 is intact
777 entry.setValue(result1, 1111, TargetedResult.EMPTY_LIST); 777 entry.setValue(result1, 1111, TargetedResult.EMPTY_LIST);
778 expect(entry.getState(result1), CacheState.VALID); 778 expect(entry.getState(result1), CacheState.VALID);
779 expect(entry.getState(result2), CacheState.VALID); 779 expect(entry.getState(result2), CacheState.VALID);
780 expect(entry.getValue(result1), 1111); 780 expect(entry.getValue(result1), 1111);
781 expect(entry.getValue(result2), 222); 781 expect(entry.getValue(result2), 222);
782 } 782 }
783 783
784 test_setValue_userBeforeProvider_invalidateProvider_alsoUser() {
785 AnalysisTarget target1 = new TestSource('/a.dart');
786 AnalysisTarget target2 = new TestSource('/b.dart');
787 CacheEntry entry1 = new CacheEntry(target1);
788 CacheEntry entry2 = new CacheEntry(target2);
789 cache.put(entry1);
790 cache.put(entry2);
791 ResultDescriptor result1 = new ResultDescriptor('result1', -1);
792 ResultDescriptor result2 = new ResultDescriptor('result2', -2);
793 // set results, all of them are VALID
794 entry2.setValue(result2, 222, [new TargetedResult(target1, result1)]);
795 entry1.setValue(result1, 111, TargetedResult.EMPTY_LIST);
796 expect(entry1.getState(result1), CacheState.VALID);
797 expect(entry2.getState(result2), CacheState.VALID);
798 expect(entry1.getValue(result1), 111);
799 expect(entry2.getValue(result2), 222);
800 // invalidate result1, should invalidate also result2
801 entry1.setState(result1, CacheState.INVALID);
802 expect(entry1.getState(result1), CacheState.INVALID);
803 expect(entry2.getState(result2), CacheState.INVALID);
804 }
805
784 test_setValueIncremental() { 806 test_setValueIncremental() {
785 AnalysisTarget target = new TestSource(); 807 AnalysisTarget target = new TestSource();
786 CacheEntry entry = new CacheEntry(target); 808 CacheEntry entry = new CacheEntry(target);
787 cache.put(entry); 809 cache.put(entry);
788 ResultDescriptor result1 = new ResultDescriptor('result1', -1); 810 ResultDescriptor result1 = new ResultDescriptor('result1', -1);
789 ResultDescriptor result2 = new ResultDescriptor('result2', -2); 811 ResultDescriptor result2 = new ResultDescriptor('result2', -2);
790 ResultDescriptor result3 = new ResultDescriptor('result3', -3); 812 ResultDescriptor result3 = new ResultDescriptor('result3', -3);
791 // set results, all of them are VALID 813 // set results, all of them are VALID
792 entry.setValue(result1, 111, TargetedResult.EMPTY_LIST); 814 entry.setValue(result1, 111, TargetedResult.EMPTY_LIST);
793 entry.setValue(result2, 222, [new TargetedResult(target, result1)]); 815 entry.setValue(result2, 222, [new TargetedResult(target, result1)]);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 } 1249 }
1228 } 1250 }
1229 1251
1230 class _TestAnalysisTarget implements AnalysisTarget { 1252 class _TestAnalysisTarget implements AnalysisTarget {
1231 @override 1253 @override
1232 Source get librarySource => null; 1254 Source get librarySource => null;
1233 1255
1234 @override 1256 @override
1235 Source get source => null; 1257 Source get source => null;
1236 } 1258 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698