| 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/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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 ChangeSet changeSet = new ChangeSet(); | 143 ChangeSet changeSet = new ChangeSet(); |
| 144 changeSet.addedSource(source); | 144 changeSet.addedSource(source); |
| 145 context.applyChanges(changeSet); | 145 context.applyChanges(changeSet); |
| 146 expect(context.sourcesNeedingProcessing, contains(source)); | 146 expect(context.sourcesNeedingProcessing, contains(source)); |
| 147 return pumpEventQueue().then((_) { | 147 return pumpEventQueue().then((_) { |
| 148 listener.assertEvent(wereSourcesAdded: true); | 148 listener.assertEvent(wereSourcesAdded: true); |
| 149 listener.assertNoMoreEvents(); | 149 listener.assertNoMoreEvents(); |
| 150 }); | 150 }); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void test_applyChanges_add_makesExplicit() { |
| 154 Source source = newSource('/test.dart'); |
| 155 // get the entry, it's not explicit |
| 156 CacheEntry entry = context.getCacheEntry(source); |
| 157 expect(entry.explicitlyAdded, isFalse); |
| 158 // add the source |
| 159 ChangeSet changeSet = new ChangeSet(); |
| 160 changeSet.addedSource(source); |
| 161 context.applyChanges(changeSet); |
| 162 // now the entry is explicit |
| 163 expect(entry.explicitlyAdded, isTrue); |
| 164 } |
| 165 |
| 153 Future test_applyChanges_change() { | 166 Future test_applyChanges_change() { |
| 154 SourcesChangedListener listener = new SourcesChangedListener(); | 167 SourcesChangedListener listener = new SourcesChangedListener(); |
| 155 context.onSourcesChanged.listen(listener.onData); | 168 context.onSourcesChanged.listen(listener.onData); |
| 156 expect(context.sourcesNeedingProcessing, isEmpty); | 169 expect(context.sourcesNeedingProcessing, isEmpty); |
| 157 Source source = newSource('/test.dart'); | 170 Source source = newSource('/test.dart'); |
| 158 ChangeSet changeSet1 = new ChangeSet(); | 171 ChangeSet changeSet1 = new ChangeSet(); |
| 159 changeSet1.addedSource(source); | 172 changeSet1.addedSource(source); |
| 160 context.applyChanges(changeSet1); | 173 context.applyChanges(changeSet1); |
| 161 expect(context.sourcesNeedingProcessing, contains(source)); | 174 expect(context.sourcesNeedingProcessing, contains(source)); |
| 162 Source source2 = newSource('/test2.dart'); | 175 Source source2 = newSource('/test2.dart'); |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 } | 2640 } |
| 2628 } | 2641 } |
| 2629 | 2642 |
| 2630 class _AnalysisContextImplTest_test_applyChanges_removeContainer | 2643 class _AnalysisContextImplTest_test_applyChanges_removeContainer |
| 2631 implements SourceContainer { | 2644 implements SourceContainer { |
| 2632 Source libB; | 2645 Source libB; |
| 2633 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); | 2646 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); |
| 2634 @override | 2647 @override |
| 2635 bool contains(Source source) => source == libB; | 2648 bool contains(Source source) => source == libB; |
| 2636 } | 2649 } |
| OLD | NEW |