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

Side by Side Diff: pkg/pathos/test/pathos_windows_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/test/pathos_url_test.dart ('k') | pkg/stack_trace/lib/src/frame.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_windows_test; 5 library pathos_windows_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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); 434 expect(builder.withoutExtension(r'a\b\'), r'a\b\');
435 expect(builder.withoutExtension(r'a\.'), r'a\.'); 435 expect(builder.withoutExtension(r'a\.'), r'a\.');
436 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); 436 expect(builder.withoutExtension(r'a\.b'), r'a\.b');
437 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); 437 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c');
438 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); 438 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d');
439 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); 439 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c');
440 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); 440 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c');
441 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); 441 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c');
442 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\'); 442 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\');
443 }); 443 });
444
445 test('fromUri', () {
446 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo')),
447 r'C:\path\to\foo');
448 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo')),
449 r'\\hostname\path\to\foo');
450 expect(builder.fromUri(Uri.parse('file:///C:/')), r'C:\');
451 expect(builder.fromUri(Uri.parse('file://hostname/')), r'\\hostname\');
452 expect(builder.fromUri(Uri.parse('foo/bar')), r'foo\bar');
453 expect(builder.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo');
454 expect(builder.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo');
455 expect(builder.fromUri(Uri.parse('//hostname/path/to/foo')),
456 r'\\hostname\path\to\foo');
457 expect(builder.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')),
458 r'C:\path\to\foo#bar');
459 expect(builder.fromUri(Uri.parse('file://hostname/path/to/foo%23bar')),
460 r'\\hostname\path\to\foo#bar');
461 expect(() => builder.fromUri(Uri.parse('http://dartlang.org')),
462 throwsArgumentError);
463 });
464
465 test('toUri', () {
466 expect(builder.toUri(r'C:\path\to\foo'),
467 Uri.parse('file:///C:/path/to/foo'));
468 expect(builder.toUri(r'C:\path\to\foo\'),
469 Uri.parse('file:///C:/path/to/foo/'));
470 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/'));
471 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/'));
472 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar'));
473 expect(builder.toUri(r'C:\path\to\foo#bar'),
474 Uri.parse('file:///C:/path/to/foo%23bar'));
475 expect(builder.toUri(r'\\hostname\path\to\foo#bar'),
476 Uri.parse('file://hostname/path/to/foo%23bar'));
477 });
444 } 478 }
OLDNEW
« no previous file with comments | « pkg/pathos/test/pathos_url_test.dart ('k') | pkg/stack_trace/lib/src/frame.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698