 Chromium Code Reviews
 Chromium Code Reviews Issue 11512011:
  Handle relative paths where the trailing directory has an extension.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/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| OLD | NEW | 
|---|---|
| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 expect(r.relative(''), '.'); | 243 expect(r.relative(''), '.'); | 
| 244 expect(r.relative('.'), '.'); | 244 expect(r.relative('.'), '.'); | 
| 245 expect(r.relative('..'), '..'); | 245 expect(r.relative('..'), '..'); | 
| 246 expect(r.relative('a'), 'a'); | 246 expect(r.relative('a'), 'a'); | 
| 247 expect(r.relative(r'a\b.txt'), r'a\b.txt'); | 247 expect(r.relative(r'a\b.txt'), r'a\b.txt'); | 
| 248 expect(r.relative(r'..\a/b.txt'), r'..\a\b.txt'); | 248 expect(r.relative(r'..\a/b.txt'), r'..\a\b.txt'); | 
| 249 expect(r.relative(r'a\./b\../c.txt'), r'a\c.txt'); | 249 expect(r.relative(r'a\./b\../c.txt'), r'a\c.txt'); | 
| 250 }); | 250 }); | 
| 251 }); | 251 }); | 
| 252 | 252 | 
| 253 test('given absolute with differnt root prefix', () { | 253 test('from a root with extension', () { | 
| 254 var r = new path.Builder(style: path.Style.windows, root: r'C:\dir.ext'); | |
| 255 expect(r.relative(r'C:\dir.ext\file'), 'file'); | |
| 256 }); | |
| 257 | |
| 258 test('given absolute with different root prefix', () { | |
| 254 expect(builder.relative(r'D:\a\b'), r'D:\a\b'); | 259 expect(builder.relative(r'D:\a\b'), r'D:\a\b'); | 
| 255 expect(builder.relative(r'\\a\b'), r'\\a\b'); | 260 expect(builder.relative(r'\\a\b'), r'\\a\b'); | 
| 256 }); | 261 }); | 
| 257 }); | 262 }); | 
| 258 | 263 | 
| 259 group('resolve', () { | 264 group('resolve', () { | 
| 260 test('allows up to seven parts', () { | 265 test('allows up to seven parts', () { | 
| 261 expect(builder.resolve('a'), r'C:\root\path\a'); | 266 expect(builder.resolve('a'), r'C:\root\path\a'); | 
| 262 expect(builder.resolve('a', 'b'), r'C:\root\path\a\b'); | 267 expect(builder.resolve('a', 'b'), r'C:\root\path\a\b'); | 
| 263 expect(builder.resolve('a', 'b', 'c'), r'C:\root\path\a\b\c'); | 268 expect(builder.resolve('a', 'b', 'c'), r'C:\root\path\a\b\c'); | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 289 expect(builder.withoutExtension('a.b'), 'a'); | 294 expect(builder.withoutExtension('a.b'), 'a'); | 
| 290 expect(builder.withoutExtension(r'a\b.c'), r'a\b'); | 295 expect(builder.withoutExtension(r'a\b.c'), r'a\b'); | 
| 291 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c'); | 296 expect(builder.withoutExtension(r'a\b.c.d'), r'a\b.c'); | 
| 292 expect(builder.withoutExtension(r'a\'), r'a\'); | 297 expect(builder.withoutExtension(r'a\'), r'a\'); | 
| 293 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); | 298 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); | 
| 294 expect(builder.withoutExtension(r'a\.'), r'a\.'); | 299 expect(builder.withoutExtension(r'a\.'), r'a\.'); | 
| 295 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); | 300 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); | 
| 296 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); | 301 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); | 
| 297 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); | 302 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); | 
| 298 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); | 303 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); | 
| 304 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); | |
| 
nweiz
2012/12/11 02:09:42
This should probably also be added to path_posix_t
 | |
| 299 }); | 305 }); | 
| 300 } | 306 } | 
| OLD | NEW |