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 library analyzer.test.src.summary.in_summary_source_test; | 5 library analyzer.test.src.summary.in_summary_source_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/source_io.dart'; | 7 import 'package:analyzer/src/generated/source_io.dart'; |
8 import 'package:analyzer/src/summary/format.dart'; | 8 import 'package:analyzer/src/summary/format.dart'; |
9 import 'package:analyzer/src/summary/idl.dart'; | 9 import 'package:analyzer/src/summary/idl.dart'; |
10 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 10 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 11 import 'package:path/path.dart'; |
11 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
12 | 13 |
13 import '../../reflective_tests.dart'; | 14 import '../../reflective_tests.dart'; |
14 | 15 |
15 main() { | 16 main() { |
16 groupSep = ' | '; | 17 groupSep = ' | '; |
17 runReflectiveTests(InSummarySourceTest); | 18 runReflectiveTests(InSummarySourceTest); |
18 } | 19 } |
19 | 20 |
20 @reflectiveTest | 21 @reflectiveTest |
21 class InSummarySourceTest extends ReflectiveTest { | 22 class InSummarySourceTest extends ReflectiveTest { |
22 test_fallbackPath() { | 23 test_fallbackPath() { |
| 24 String fooFallbackPath = absolute('path', 'to', 'foo.dart'); |
23 var sourceFactory = new SourceFactory([ | 25 var sourceFactory = new SourceFactory([ |
24 new InSummaryPackageUriResolver(new MockSummaryDataStore.fake( | 26 new InSummaryPackageUriResolver(new MockSummaryDataStore.fake( |
25 {'package:foo/foo.dart': 'foo.sum',}, | 27 {'package:foo/foo.dart': 'foo.sum',}, |
26 uriToFallbackModePath: {'package:foo/foo.dart': '/path/to/foo.dart'})) | 28 uriToFallbackModePath: {'package:foo/foo.dart': fooFallbackPath})) |
27 ]); | 29 ]); |
28 | 30 |
29 InSummarySource source = sourceFactory.forUri('package:foo/foo.dart'); | 31 InSummarySource source = sourceFactory.forUri('package:foo/foo.dart'); |
30 expect(source, new isInstanceOf<FileBasedSource>()); | 32 expect(source, new isInstanceOf<FileBasedSource>()); |
31 expect(source.fullName, '/path/to/foo.dart'); | 33 expect(source.fullName, fooFallbackPath); |
32 } | 34 } |
33 | 35 |
34 test_InSummarySource() { | 36 test_InSummarySource() { |
35 var sourceFactory = new SourceFactory([ | 37 var sourceFactory = new SourceFactory([ |
36 new InSummaryPackageUriResolver(new MockSummaryDataStore.fake({ | 38 new InSummaryPackageUriResolver(new MockSummaryDataStore.fake({ |
37 'package:foo/foo.dart': 'foo.sum', | 39 'package:foo/foo.dart': 'foo.sum', |
38 'package:foo/src/foo_impl.dart': 'foo.sum', | 40 'package:foo/src/foo_impl.dart': 'foo.sum', |
39 'package:bar/baz.dart': 'bar.sum', | 41 'package:bar/baz.dart': 'bar.sum', |
40 })) | 42 })) |
41 ]); | 43 ]); |
(...skipping 25 matching lines...) Expand all Loading... |
67 // We don't populate the values as it is not needed for the test. | 69 // We don't populate the values as it is not needed for the test. |
68 var unlinkedMap = new Map<String, UnlinkedUnit>.fromIterable( | 70 var unlinkedMap = new Map<String, UnlinkedUnit>.fromIterable( |
69 uriToSummary.keys, | 71 uriToSummary.keys, |
70 value: (uri) => new UnlinkedUnitBuilder( | 72 value: (uri) => new UnlinkedUnitBuilder( |
71 fallbackModePath: uriToFallbackModePath[uri])); | 73 fallbackModePath: uriToFallbackModePath[uri])); |
72 return new MockSummaryDataStore(null, unlinkedMap, uriToSummary); | 74 return new MockSummaryDataStore(null, unlinkedMap, uriToSummary); |
73 } | 75 } |
74 | 76 |
75 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 77 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
76 } | 78 } |
OLD | NEW |