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

Side by Side Diff: utils/tests/pub/path/path_posix_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/pub/path.dart ('k') | utils/tests/pub/path/path_windows_test.dart » ('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 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // normalizes. 226 // normalizes.
227 expect(r.relative(''), '.'); 227 expect(r.relative(''), '.');
228 expect(r.relative('.'), '.'); 228 expect(r.relative('.'), '.');
229 expect(r.relative('..'), '..'); 229 expect(r.relative('..'), '..');
230 expect(r.relative('a'), 'a'); 230 expect(r.relative('a'), 'a');
231 expect(r.relative('a/b.txt'), 'a/b.txt'); 231 expect(r.relative('a/b.txt'), 'a/b.txt');
232 expect(r.relative('../a/b.txt'), '../a/b.txt'); 232 expect(r.relative('../a/b.txt'), '../a/b.txt');
233 expect(r.relative('a/./b/../c.txt'), 'a/c.txt'); 233 expect(r.relative('a/./b/../c.txt'), 'a/c.txt');
234 }); 234 });
235 }); 235 });
236
237 test('from a root with extension', () {
238 var r = new path.Builder(style: path.Style.posix, root: '/dir.ext');
239 expect(r.relative('/dir.ext/file'), 'file');
240 });
236 }); 241 });
237 242
238 group('resolve', () { 243 group('resolve', () {
239 test('allows up to seven parts', () { 244 test('allows up to seven parts', () {
240 expect(builder.resolve('a'), '/root/path/a'); 245 expect(builder.resolve('a'), '/root/path/a');
241 expect(builder.resolve('a', 'b'), '/root/path/a/b'); 246 expect(builder.resolve('a', 'b'), '/root/path/a/b');
242 expect(builder.resolve('a', 'b', 'c'), '/root/path/a/b/c'); 247 expect(builder.resolve('a', 'b', 'c'), '/root/path/a/b/c');
243 expect(builder.resolve('a', 'b', 'c', 'd'), '/root/path/a/b/c/d'); 248 expect(builder.resolve('a', 'b', 'c', 'd'), '/root/path/a/b/c/d');
244 expect(builder.resolve('a', 'b', 'c', 'd', 'e'), '/root/path/a/b/c/d/e'); 249 expect(builder.resolve('a', 'b', 'c', 'd', 'e'), '/root/path/a/b/c/d/e');
245 expect(builder.resolve('a', 'b', 'c', 'd', 'e', 'f'), 250 expect(builder.resolve('a', 'b', 'c', 'd', 'e', 'f'),
(...skipping 24 matching lines...) Expand all
270 expect(builder.withoutExtension('a/'), 'a/'); 275 expect(builder.withoutExtension('a/'), 'a/');
271 expect(builder.withoutExtension('a/b/'), 'a/b/'); 276 expect(builder.withoutExtension('a/b/'), 'a/b/');
272 expect(builder.withoutExtension('a/.'), 'a/.'); 277 expect(builder.withoutExtension('a/.'), 'a/.');
273 expect(builder.withoutExtension('a/.b'), 'a/.b'); 278 expect(builder.withoutExtension('a/.b'), 'a/.b');
274 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); 279 expect(builder.withoutExtension('a.b/c'), 'a.b/c');
275 expect(builder.withoutExtension(r'a.b\c'), r'a'); 280 expect(builder.withoutExtension(r'a.b\c'), r'a');
276 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); 281 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c');
277 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); 282 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c');
278 }); 283 });
279 } 284 }
OLDNEW
« no previous file with comments | « utils/pub/path.dart ('k') | utils/tests/pub/path/path_windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698