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

Side by Side Diff: test/paths_test.dart

Issue 111893006: Switch web_ui to use path 1.0.0 (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years 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 | « test/data/expected/trim_indentation_space2_test.html.txt ('k') | test/run.sh » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** Tests for [PathMapper]. */ 5 /** Tests for [PathMapper]. */
6 library path_info_test; 6 library path_info_test;
7 7
8 import 'package:path/path.dart' as path; 8 import 'package:path/path.dart' as path;
9 import 'package:unittest/compact_vm_config.dart'; 9 import 'package:unittest/compact_vm_config.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart'); 73 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
74 expect(pathMapper.importUrlFor(file1, file3), 74 expect(pathMapper.importUrlFor(file1, file3),
75 'package:e/_f.dart.dart'); 75 'package:e/_f.dart.dart');
76 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart'); 76 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
77 expect(pathMapper.importUrlFor(file2, file3), 77 expect(pathMapper.importUrlFor(file2, file3),
78 'package:e/_f.dart.dart'); 78 'package:e/_f.dart.dart');
79 }); 79 });
80 80
81 test('windows paths', () { 81 test('windows paths', () {
82 try { 82 try {
83 utils.path = new path.Builder(style: path.Style.windows); 83 utils.path = path.windows;
84 var pathMapper = _newPathMapper('a', 'a', false); 84 var pathMapper = _newPathMapper('a', 'a', false);
85 var file1 = _mockFile('a\\b.dart', pathMapper); 85 var file1 = _mockFile('a\\b.dart', pathMapper);
86 var file2 = _mockFile('a\\c\\d.dart', pathMapper); 86 var file2 = _mockFile('a\\c\\d.dart', pathMapper);
87 var file3 = _mockFile('a\\packages\\f.dart', pathMapper); 87 var file3 = _mockFile('a\\packages\\f.dart', pathMapper);
88 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart'); 88 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
89 expect(pathMapper.importUrlFor(file1, file3), 89 expect(pathMapper.importUrlFor(file1, file3),
90 '_from_packages/_f.dart.dart'); 90 '_from_packages/_f.dart.dart');
91 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart'); 91 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
92 expect(pathMapper.importUrlFor(file2, file3), 92 expect(pathMapper.importUrlFor(file2, file3),
93 '../_from_packages/_f.dart.dart'); 93 '../_from_packages/_f.dart.dart');
94 expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart'); 94 expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
95 expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart'); 95 expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
96 } finally { 96 } finally {
97 utils.path = new path.Builder(); 97 utils.path = new path.Context();
98 } 98 }
99 }); 99 });
100 }); 100 });
101 101
102 test('transformUrl simple paths', () { 102 test('transformUrl simple paths', () {
103 var pathMapper = _newPathMapper('a', 'a', false); 103 var pathMapper = _newPathMapper('a', 'a', false);
104 var file1 = 'a/b.dart'; 104 var file1 = 'a/b.dart';
105 var file2 = 'a/c/d.html'; 105 var file2 = 'a/c/d.html';
106 // when the output == input directory, no paths should be rewritten 106 // when the output == input directory, no paths should be rewritten
107 expect(pathMapper.transformUrl(file1, '/a.dart'), '/a.dart'); 107 expect(pathMapper.transformUrl(file1, '/a.dart'), '/a.dart');
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 '_from_packages/e/_f.dart.dart'); 221 '_from_packages/e/_f.dart.dart');
222 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart'); 222 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
223 expect(pathMapper.importUrlFor(file2, file3), 223 expect(pathMapper.importUrlFor(file2, file3),
224 '../_from_packages/e/_f.dart.dart'); 224 '../_from_packages/e/_f.dart.dart');
225 expect(pathMapper.importUrlFor(file3, file2), '../../c/_d.dart.dart'); 225 expect(pathMapper.importUrlFor(file3, file2), '../../c/_d.dart.dart');
226 expect(pathMapper.importUrlFor(file3, file1), '../../_b.dart.dart'); 226 expect(pathMapper.importUrlFor(file3, file1), '../../_b.dart.dart');
227 }); 227 });
228 228
229 test('windows paths', () { 229 test('windows paths', () {
230 try { 230 try {
231 utils.path = new path.Builder(style: path.Style.windows); 231 utils.path = path.windows;
232 var pathMapper = _newPathMapper('a', 'out', true); 232 var pathMapper = _newPathMapper('a', 'out', true);
233 var file1 = _mockFile('a\\b.dart', pathMapper); 233 var file1 = _mockFile('a\\b.dart', pathMapper);
234 var file2 = _mockFile('a\\c\\d.dart', pathMapper); 234 var file2 = _mockFile('a\\c\\d.dart', pathMapper);
235 var file3 = _mockFile('a\\packages\\f.dart', pathMapper); 235 var file3 = _mockFile('a\\packages\\f.dart', pathMapper);
236 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart'); 236 expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
237 expect(pathMapper.importUrlFor(file1, file3), 237 expect(pathMapper.importUrlFor(file1, file3),
238 '_from_packages/_f.dart.dart'); 238 '_from_packages/_f.dart.dart');
239 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart'); 239 expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
240 expect(pathMapper.importUrlFor(file2, file3), 240 expect(pathMapper.importUrlFor(file2, file3),
241 '../_from_packages/_f.dart.dart'); 241 '../_from_packages/_f.dart.dart');
242 expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart'); 242 expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
243 expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart'); 243 expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
244 } finally { 244 } finally {
245 utils.path = new path.Builder(); 245 utils.path = new path.Context();
246 } 246 }
247 }); 247 });
248 }); 248 });
249 249
250 group('transformUrl', () { 250 group('transformUrl', () {
251 test('simple source, not in packages/', () { 251 test('simple source, not in packages/', () {
252 var pathMapper = _newPathMapper('a', 'out', false); 252 var pathMapper = _newPathMapper('a', 'out', false);
253 var file1 = 'a/b.dart'; 253 var file1 = 'a/b.dart';
254 var file2 = 'a/c/d.html'; 254 var file2 = 'a/c/d.html';
255 // when the output == input directory, no paths should be rewritten 255 // when the output == input directory, no paths should be rewritten
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 var file = new FileInfo(new UrlInfo( 318 var file = new FileInfo(new UrlInfo(
319 url == null ? filePath : url, filePath, null)); 319 url == null ? filePath : url, filePath, null));
320 file.outputFilename = pathMapper.mangle( 320 file.outputFilename = pathMapper.mangle(
321 utils.path.basename(filePath), '.dart', false); 321 utils.path.basename(filePath), '.dart', false);
322 return file; 322 return file;
323 } 323 }
324 324
325 _checkPath(String filePath, String expected) { 325 _checkPath(String filePath, String expected) {
326 expect(utils.path.normalize(filePath), expected); 326 expect(utils.path.normalize(filePath), expected);
327 } 327 }
OLDNEW
« no previous file with comments | « test/data/expected/trim_indentation_space2_test.html.txt ('k') | test/run.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698