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

Side by Side Diff: pkg/analyzer/test/src/summary/in_summary_source_test.dart

Issue 1831563002: expose InSummarySource with its summaryPath (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix test too Created 4 years, 9 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library analyzer.test.src.summary.in_summary_source_test;
6
7 import 'package:analyzer/src/generated/source_io.dart';
8 import 'package:analyzer/src/summary/idl.dart';
9 import 'package:analyzer/src/summary/package_bundle_reader.dart';
10 import 'package:unittest/unittest.dart';
11
12 import '../../reflective_tests.dart';
13
14 main() {
15 groupSep = ' | ';
16 runReflectiveTests(InSummarySourceTest);
17 }
18
19 @reflectiveTest
20 class InSummarySourceTest extends ReflectiveTest {
21 test_InSummarySource() {
22 var sourceFactory = new SourceFactory([
23 new InSummaryPackageUriResolver(new MockSummaryDataStore.fake({
24 'package:foo/foo.dart': 'foo.sum',
25 'package:foo/src/foo_impl.dart': 'foo.sum',
26 'package:bar/baz.dart': 'bar.sum',
27 }))
28 ]);
29
30 InSummarySource source = sourceFactory.forUri('package:foo/foo.dart');
31 expect(source.summaryPath, 'foo.sum');
32
33 source = sourceFactory.forUri('package:foo/src/foo_impl.dart');
34 expect(source.summaryPath, 'foo.sum');
35
36 source = sourceFactory.forUri('package:bar/baz.dart');
37 expect(source.summaryPath, 'bar.sum');
38 }
39 }
40
41 class MockSummaryDataStore implements SummaryDataStore {
42 final Map<String, LinkedLibrary> linkedMap;
43 final Map<String, UnlinkedUnit> unlinkedMap;
44 final Map<String, String> uriToSummaryPath;
45
46 MockSummaryDataStore(this.linkedMap, this.unlinkedMap, this.uriToSummaryPath);
47
48 factory MockSummaryDataStore.fake(Map<String, String> uriToSummary) {
49 // Create fake unlinked map.
50 // We don't populate the values as it is not needed for the test.
51 var unlinkedMap = new Map<String, UnlinkedUnit>.fromIterable(
52 uriToSummary.keys,
53 value: (k) => null);
54 return new MockSummaryDataStore(null, unlinkedMap, uriToSummary);
55 }
56 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | pkg/analyzer/test/src/summary/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698