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

Side by Side Diff: utils/tests/pub/path/path_windows_test.dart

Issue 11512011: Handle relative paths where the trailing directory has an extension. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge bug. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/path/path_posix_test.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) 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 library path_test; 5 library path_test;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import '../../../../pkg/unittest/lib/unittest.dart'; 9 import '../../../../pkg/unittest/lib/unittest.dart';
10 import '../../../pub/path.dart' as path; 10 import '../../../pub/path.dart' as path;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 expect(r.relative(''), '.'); 247 expect(r.relative(''), '.');
248 expect(r.relative('.'), '.'); 248 expect(r.relative('.'), '.');
249 expect(r.relative('..'), '..'); 249 expect(r.relative('..'), '..');
250 expect(r.relative('a'), 'a'); 250 expect(r.relative('a'), 'a');
251 expect(r.relative(r'a\b.txt'), r'a\b.txt'); 251 expect(r.relative(r'a\b.txt'), r'a\b.txt');
252 expect(r.relative(r'..\a/b.txt'), r'..\a\b.txt'); 252 expect(r.relative(r'..\a/b.txt'), r'..\a\b.txt');
253 expect(r.relative(r'a\./b\../c.txt'), r'a\c.txt'); 253 expect(r.relative(r'a\./b\../c.txt'), r'a\c.txt');
254 }); 254 });
255 }); 255 });
256 256
257 test('given absolute with differnt root prefix', () { 257 test('from a root with extension', () {
258 var r = new path.Builder(style: path.Style.windows, root: r'C:\dir.ext');
259 expect(r.relative(r'C:\dir.ext\file'), 'file');
260 });
261
262 test('given absolute with different root prefix', () {
258 expect(builder.relative(r'D:\a\b'), r'D:\a\b'); 263 expect(builder.relative(r'D:\a\b'), r'D:\a\b');
259 expect(builder.relative(r'\\a\b'), r'\\a\b'); 264 expect(builder.relative(r'\\a\b'), r'\\a\b');
260 }); 265 });
261 }); 266 });
262 267
263 group('resolve', () { 268 group('resolve', () {
264 test('allows up to seven parts', () { 269 test('allows up to seven parts', () {
265 expect(builder.resolve('a'), r'C:\root\path\a'); 270 expect(builder.resolve('a'), r'C:\root\path\a');
266 expect(builder.resolve('a', 'b'), r'C:\root\path\a\b'); 271 expect(builder.resolve('a', 'b'), r'C:\root\path\a\b');
267 expect(builder.resolve('a', 'b', 'c'), r'C:\root\path\a\b\c'); 272 expect(builder.resolve('a', 'b', 'c'), r'C:\root\path\a\b\c');
(...skipping 26 matching lines...) Expand all
294 expect(builder.withoutExtension(r'a\b.c'), r'a\b'); 299 expect(builder.withoutExtension(r'a\b.c'), r'a\b');
295 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c'); 300 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c');
296 expect(builder.withoutExtension(r'a\'), r'a\'); 301 expect(builder.withoutExtension(r'a\'), r'a\');
297 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); 302 expect(builder.withoutExtension(r'a\b\'), r'a\b\');
298 expect(builder.withoutExtension(r'a\.'), r'a\.'); 303 expect(builder.withoutExtension(r'a\.'), r'a\.');
299 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); 304 expect(builder.withoutExtension(r'a\.b'), r'a\.b');
300 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); 305 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c');
301 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); 306 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d');
302 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); 307 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c');
303 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); 308 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c');
309 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c');
304 }); 310 });
305 } 311 }
OLDNEW
« no previous file with comments | « utils/tests/pub/path/path_posix_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698