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

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

Issue 2643033003: Clean up hacky handling of "dart:" URIs in incremental resolved AST generator. (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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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 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:front_end/src/base/file_repository.dart'; 5 import 'package:front_end/src/base/file_repository.dart';
6 import 'package:test/test.dart'; 6 import 'package:test/test.dart';
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; 7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8 8
9 main() { 9 main() {
10 defineReflectiveSuite(() { 10 defineReflectiveSuite(() {
(...skipping 26 matching lines...) Expand all
37 37
38 test_pathForUri() { 38 test_pathForUri() {
39 var uri1 = Uri.parse('file:///foo/bar.dart'); 39 var uri1 = Uri.parse('file:///foo/bar.dart');
40 var path1 = fileRepository.store(uri1, 'contents1'); 40 var path1 = fileRepository.store(uri1, 'contents1');
41 var uri2 = Uri.parse('package:foo/bar.dart'); 41 var uri2 = Uri.parse('package:foo/bar.dart');
42 var path2 = fileRepository.store(uri2, 'contents2'); 42 var path2 = fileRepository.store(uri2, 'contents2');
43 expect(fileRepository.pathForUri(uri1), path1); 43 expect(fileRepository.pathForUri(uri1), path1);
44 expect(fileRepository.pathForUri(uri2), path2); 44 expect(fileRepository.pathForUri(uri2), path2);
45 } 45 }
46 46
47 test_pathForUri_allocate() {
48 var uri1 = Uri.parse('file:///foo/bar.dart');
49 var path1 = fileRepository.pathForUri(uri1, allocate: true);
50 var uri2 = Uri.parse('package:foo/bar.dart');
51 var path2 = fileRepository.pathForUri(uri2, allocate: true);
52 expect(fileRepository.store(uri1, 'contents1'), path1);
53 expect(fileRepository.store(uri2, 'contents2'), path2);
54 }
55
47 test_store() { 56 test_store() {
48 var uri = Uri.parse('file:///foo/bar.dart'); 57 var uri = Uri.parse('file:///foo/bar.dart');
49 var path = fileRepository.store(uri, 'contents1'); 58 var path = fileRepository.store(uri, 'contents1');
50 expect(path, endsWith('.dart')); 59 expect(path, endsWith('.dart'));
51 expect(fileRepository.contentsForPath(path), 'contents1'); 60 expect(fileRepository.contentsForPath(path), 'contents1');
52 expect(fileRepository.getContentsForTesting(), {path: 'contents1'}); 61 expect(fileRepository.getContentsForTesting(), {path: 'contents1'});
53 expect(fileRepository.store(uri, 'contents2'), path); 62 expect(fileRepository.store(uri, 'contents2'), path);
54 expect(fileRepository.contentsForPath(path), 'contents2'); 63 expect(fileRepository.contentsForPath(path), 'contents2');
55 expect(fileRepository.getContentsForTesting(), {path: 'contents2'}); 64 expect(fileRepository.getContentsForTesting(), {path: 'contents2'});
56 } 65 }
57 66
58 test_uriForPath() { 67 test_uriForPath() {
59 var uri1 = Uri.parse('file:///foo/bar.dart'); 68 var uri1 = Uri.parse('file:///foo/bar.dart');
60 var path1 = fileRepository.store(uri1, 'contents1'); 69 var path1 = fileRepository.store(uri1, 'contents1');
61 var uri2 = Uri.parse('package:foo/bar.dart'); 70 var uri2 = Uri.parse('package:foo/bar.dart');
62 var path2 = fileRepository.store(uri2, 'contents2'); 71 var path2 = fileRepository.store(uri2, 'contents2');
63 expect(fileRepository.uriForPath(path1), uri1); 72 expect(fileRepository.uriForPath(path1), uri1);
64 expect(fileRepository.uriForPath(path2), uri2); 73 expect(fileRepository.uriForPath(path2), uri2);
65 } 74 }
66 } 75 }
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