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

Side by Side Diff: pkg/front_end/test/src/base/file_repository_test.dart

Issue 2645923002: Create a "file repository" data structure to help interface analyzer and front_end code. (Closed)
Patch Set: Created 3 years, 11 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/front_end/lib/src/incremental_resolved_ast_generator_impl.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
(Empty)
1 // Copyright (c) 2017, 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 import 'package:analyzer/error/listener.dart';
6 import 'package:analyzer/src/generated/parser.dart';
7 import 'package:analyzer/src/summary/summarize_ast.dart';
8 import 'package:front_end/src/base/file_repository.dart';
9 import 'package:front_end/src/base/library_info.dart';
10 import 'package:front_end/src/libraries_reader.dart';
11 import 'package:front_end/src/scanner/errors.dart';
12 import 'package:front_end/src/scanner/reader.dart';
13 import 'package:front_end/src/scanner/scanner.dart';
14 import 'package:test/test.dart';
15 import 'package:test_reflective_loader/test_reflective_loader.dart';
16
17 main() {
18 defineReflectiveSuite(() {
19 defineReflectiveTests(FileRepositoryTest);
20 });
21 }
22
23 /// Generic URI resolver tests which do not depend on the particular path
24 /// context in use.
25 @reflectiveTest
26 class FileRepositoryTest {
27 final fileRepository = new FileRepository();
28
29 test_contentsForPath() {
30 var path1 =
31 fileRepository.store(Uri.parse('file:///foo/bar.dart'), 'contents1');
32 var path2 =
33 fileRepository.store(Uri.parse('package:foo/bar.dart'), 'contents2');
34 expect(fileRepository.contentsForPath(path1), 'contents1');
35 expect(fileRepository.contentsForPath(path2), 'contents2');
36 }
37
38 test_pathForUri() {
39 var uri1 = Uri.parse('file:///foo/bar.dart');
40 var path1 = fileRepository.store(uri1, 'contents1');
41 var uri2 = Uri.parse('package:foo/bar.dart');
42 var path2 = fileRepository.store(uri2, 'contents2');
43 expect(fileRepository.pathForUri(uri1), path1);
44 expect(fileRepository.pathForUri(uri2), path2);
45 }
46
47 test_store() {
48 var uri = Uri.parse('file:///foo/bar.dart');
49 var path = fileRepository.store(uri, 'contents1');
50 expect(path, endsWith('.dart'));
51 expect(fileRepository.contentsForPath(path), 'contents1');
52 expect(fileRepository.store(uri, 'contents2'), path);
53 expect(fileRepository.contentsForPath(path), 'contents2');
54 }
55
56 test_uriForPath() {
57 var uri1 = Uri.parse('file:///foo/bar.dart');
58 var path1 = fileRepository.store(uri1, 'contents1');
59 var uri2 = Uri.parse('package:foo/bar.dart');
60 var path2 = fileRepository.store(uri2, 'contents2');
61 expect(fileRepository.uriForPath(path1), uri1);
62 expect(fileRepository.uriForPath(path2), uri2);
63 }
64 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/incremental_resolved_ast_generator_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698