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

Side by Side Diff: pkg/pathos/test/pathos_posix_test.dart

Issue 16848002: Add toUri and fromUri functions to pathos. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Preserve trailing separators. Created 7 years, 6 months 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 | « pkg/pathos/lib/path.dart ('k') | pkg/pathos/test/pathos_url_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 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
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:///path/to/foo/')), '/path/to/foo/');
406 expect(builder.fromUri(Uri.parse('file:///')), '/');
407 expect(builder.fromUri(Uri.parse('foo/bar')), 'foo/bar');
408 expect(builder.fromUri(Uri.parse('/path/to/foo')), '/path/to/foo');
409 expect(builder.fromUri(Uri.parse('///path/to/foo')), '/path/to/foo');
410 expect(builder.fromUri(Uri.parse('file:///path/to/foo%23bar')),
411 '/path/to/foo#bar');
412 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')),
413 throwsArgumentError);
414 });
415
416 test('toUri', () {
417 expect(builder.toUri('/path/to/foo'), Uri.parse('file:///path/to/foo'));
418 expect(builder.toUri('/path/to/foo/'), Uri.parse('file:///path/to/foo/'));
419 expect(builder.toUri('/'), Uri.parse('file:///'));
420 expect(builder.toUri('foo/bar'), Uri.parse('foo/bar'));
421 expect(builder.toUri('/path/to/foo#bar'),
422 Uri.parse('file:///path/to/foo%23bar'));
423 });
402 } 424 }
OLDNEW
« no previous file with comments | « pkg/pathos/lib/path.dart ('k') | pkg/pathos/test/pathos_url_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698