 Chromium Code Reviews
 Chromium Code Reviews Issue 16848002:
  Add toUri and fromUri functions to pathos.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 16848002:
  Add toUri and fromUri functions to pathos.  (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 pathos_posix_test; | 5 library pathos_posix_test; | 
| 6 | 6 | 
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; | 
| 8 import 'package:pathos/path.dart' as path; | 8 import 'package:pathos/path.dart' as path; | 
| 9 | 9 | 
| 10 main() { | 10 main() { | 
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 expect(builder.withoutExtension('a/b/'), 'a/b/'); | 392 expect(builder.withoutExtension('a/b/'), 'a/b/'); | 
| 393 expect(builder.withoutExtension('a/.'), 'a/.'); | 393 expect(builder.withoutExtension('a/.'), 'a/.'); | 
| 394 expect(builder.withoutExtension('a/.b'), 'a/.b'); | 394 expect(builder.withoutExtension('a/.b'), 'a/.b'); | 
| 395 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); | 395 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); | 
| 396 expect(builder.withoutExtension(r'a.b\c'), r'a'); | 396 expect(builder.withoutExtension(r'a.b\c'), r'a'); | 
| 397 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); | 397 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); | 
| 398 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); | 398 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); | 
| 399 expect(builder.withoutExtension('a/b.c/'), 'a/b/'); | 399 expect(builder.withoutExtension('a/b.c/'), 'a/b/'); | 
| 400 expect(builder.withoutExtension('a/b.c//'), 'a/b//'); | 400 expect(builder.withoutExtension('a/b.c//'), 'a/b//'); | 
| 401 }); | 401 }); | 
| 402 | |
| 403 test('fromUri', () { | |
| 404 expect(builder.fromUri(Uri.parse('file:///path/to/foo')), '/path/to/foo'); | |
| 405 expect(builder.fromUri(Uri.parse('file:///')), '/'); | |
| 406 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar'); | |
| 407 expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo'); | |
| 408 expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo'); | |
| 409 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')), | |
| 410 throwsArgumentError); | |
| 411 }); | |
| 412 | |
| 413 test('toUri', () { | |
| 414 expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo')); | |
| 415 expect(builder.toUri('/'), Uri.parse('file:///')); | |
| 416 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar')); | |
| 
Bob Nystrom
2013/06/13 00:21:18
This feels odd to me. Will users expect this, or s
 
nweiz
2013/06/19 00:50:27
I think this is correct. Think about it from the p
 | |
| 417 }); | |
| 402 } | 418 } | 
| OLD | NEW |