OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analyzer/src/context/cache.dart'; | 5 import 'package:analyzer/src/context/cache.dart'; |
6 import 'package:analyzer/src/generated/engine.dart'; | 6 import 'package:analyzer/src/generated/engine.dart'; |
7 import 'package:analyzer/src/generated/source.dart'; | 7 import 'package:analyzer/src/generated/source.dart'; |
8 import 'package:analyzer/src/summary/idl.dart'; | 8 import 'package:analyzer/src/summary/idl.dart'; |
9 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 9 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
10 import 'package:analyzer/src/task/dart.dart'; | 10 import 'package:analyzer/src/task/dart.dart'; |
11 import 'package:analyzer/src/util/fast_uri.dart'; | 11 import 'package:analyzer/src/util/fast_uri.dart'; |
12 import 'package:analyzer/task/dart.dart'; | 12 import 'package:analyzer/task/dart.dart'; |
| 13 import 'package:analyzer/task/general.dart'; |
13 import 'package:typed_mock/typed_mock.dart'; | 14 import 'package:typed_mock/typed_mock.dart'; |
14 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
15 | 16 |
16 import '../../reflective_tests.dart'; | 17 import '../../reflective_tests.dart'; |
17 | 18 |
18 main() { | 19 main() { |
19 groupSep = ' | '; | 20 groupSep = ' | '; |
20 runReflectiveTests(ResynthesizerResultProviderTest); | 21 runReflectiveTests(ResynthesizerResultProviderTest); |
21 runReflectiveTests(SummaryDataStoreTest); | 22 runReflectiveTests(SummaryDataStoreTest); |
22 } | 23 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 expect(success, isTrue); | 86 expect(success, isTrue); |
86 expect(entry1.getValue(CONTAINING_LIBRARIES), unorderedEquals([source1])); | 87 expect(entry1.getValue(CONTAINING_LIBRARIES), unorderedEquals([source1])); |
87 } | 88 } |
88 | 89 |
89 test_compute_CONTAINING_LIBRARIES_partSource() { | 90 test_compute_CONTAINING_LIBRARIES_partSource() { |
90 bool success = provider.compute(entry2, CONTAINING_LIBRARIES); | 91 bool success = provider.compute(entry2, CONTAINING_LIBRARIES); |
91 expect(success, isTrue); | 92 expect(success, isTrue); |
92 expect(entry2.getValue(CONTAINING_LIBRARIES), unorderedEquals([source1])); | 93 expect(entry2.getValue(CONTAINING_LIBRARIES), unorderedEquals([source1])); |
93 } | 94 } |
94 | 95 |
| 96 test_compute_LINE_INFO_hasLineStarts() { |
| 97 when(unlinkedUnit1.lineStarts).thenReturn(<int>[10, 20, 30]); |
| 98 bool success = provider.compute(entry1, LINE_INFO); |
| 99 expect(success, isTrue); |
| 100 expect(entry1.getValue(LINE_INFO).lineStarts, <int>[10, 20, 30]); |
| 101 } |
| 102 |
| 103 test_compute_LINE_INFO_emptyLineStarts() { |
| 104 when(unlinkedUnit1.lineStarts).thenReturn(<int>[]); |
| 105 bool success = provider.compute(entry1, LINE_INFO); |
| 106 expect(success, isFalse); |
| 107 } |
| 108 |
95 test_compute_SOURCE_KIND_librarySource() { | 109 test_compute_SOURCE_KIND_librarySource() { |
96 bool success = provider.compute(entry1, SOURCE_KIND); | 110 bool success = provider.compute(entry1, SOURCE_KIND); |
97 expect(success, isTrue); | 111 expect(success, isTrue); |
98 expect(entry1.getValue(SOURCE_KIND), SourceKind.LIBRARY); | 112 expect(entry1.getValue(SOURCE_KIND), SourceKind.LIBRARY); |
99 } | 113 } |
100 | 114 |
101 test_compute_SOURCE_KIND_noResults() { | 115 test_compute_SOURCE_KIND_noResults() { |
102 bool success = provider.compute(entry3, SOURCE_KIND); | 116 bool success = provider.compute(entry3, SOURCE_KIND); |
103 expect(success, isFalse); | 117 expect(success, isFalse); |
104 expect(entry3.getState(SOURCE_KIND), CacheState.INVALID); | 118 expect(entry3.getState(SOURCE_KIND), CacheState.INVALID); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 @override | 234 @override |
221 bool hasResultsForSource(Source source) { | 235 bool hasResultsForSource(Source source) { |
222 return sourcesWithResults.contains(source); | 236 return sourcesWithResults.contains(source); |
223 } | 237 } |
224 } | 238 } |
225 | 239 |
226 class _UnlinkedPublicNamespaceMock extends TypedMock | 240 class _UnlinkedPublicNamespaceMock extends TypedMock |
227 implements UnlinkedPublicNamespace {} | 241 implements UnlinkedPublicNamespace {} |
228 | 242 |
229 class _UnlinkedUnitMock extends TypedMock implements UnlinkedUnit {} | 243 class _UnlinkedUnitMock extends TypedMock implements UnlinkedUnit {} |
OLD | NEW |