Chromium Code Reviews| 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.windows_test; | 5 library path.test.windows_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 | 9 |
| 10 import 'utils.dart'; | 10 import 'utils.dart'; |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 expect(context.withoutExtension(r'a\.'), r'a\.'); | 583 expect(context.withoutExtension(r'a\.'), r'a\.'); |
| 584 expect(context.withoutExtension(r'a\.b'), r'a\.b'); | 584 expect(context.withoutExtension(r'a\.b'), r'a\.b'); |
| 585 expect(context.withoutExtension(r'a.b\c'), r'a.b\c'); | 585 expect(context.withoutExtension(r'a.b\c'), r'a.b\c'); |
| 586 expect(context.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); | 586 expect(context.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); |
| 587 expect(context.withoutExtension(r'a\b/c'), r'a\b/c'); | 587 expect(context.withoutExtension(r'a\b/c'), r'a\b/c'); |
| 588 expect(context.withoutExtension(r'a\b/c.d'), r'a\b/c'); | 588 expect(context.withoutExtension(r'a\b/c.d'), r'a\b/c'); |
| 589 expect(context.withoutExtension(r'a.b/c'), r'a.b/c'); | 589 expect(context.withoutExtension(r'a.b/c'), r'a.b/c'); |
| 590 expect(context.withoutExtension(r'a\b.c\'), r'a\b\'); | 590 expect(context.withoutExtension(r'a\b.c\'), r'a\b\'); |
| 591 }); | 591 }); |
| 592 | 592 |
| 593 test('fromUri', () { | 593 group('fromUri', () { |
| 594 expect(context.fromUri(Uri.parse('file:///C:/path/to/foo')), | 594 test('with a URI', () { |
| 595 r'C:\path\to\foo'); | 595 expect(context.fromUri(Uri.parse('file:///C:/path/to/foo')), |
| 596 expect(context.fromUri(Uri.parse('file://server/share/path/to/foo')), | 596 r'C:\path\to\foo'); |
| 597 r'\\server\share\path\to\foo'); | 597 expect(context.fromUri(Uri.parse('file://server/share/path/to/foo')), |
| 598 expect(context.fromUri(Uri.parse('file:///C:/')), r'C:\'); | 598 r'\\server\share\path\to\foo'); |
| 599 expect(context.fromUri(Uri.parse('file://server/share')), | 599 expect(context.fromUri(Uri.parse('file:///C:/')), r'C:\'); |
| 600 r'\\server\share'); | 600 expect(context.fromUri(Uri.parse('file://server/share')), |
| 601 expect(context.fromUri(Uri.parse('foo/bar')), r'foo\bar'); | 601 r'\\server\share'); |
| 602 expect(context.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo'); | 602 expect(context.fromUri(Uri.parse('foo/bar')), r'foo\bar'); |
| 603 expect(context.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo'); | 603 expect(context.fromUri(Uri.parse('/C:/path/to/foo')), r'C:\path\to\foo'); |
| 604 expect(context.fromUri(Uri.parse('//server/share/path/to/foo')), | 604 expect(context.fromUri(Uri.parse('///C:/path/to/foo')), r'C:\path\to\foo') ; |
|
Bob Nystrom
2014/03/18 20:31:09
Long lines.
nweiz
2014/03/18 22:02:19
Done.
| |
| 605 r'\\server\share\path\to\foo'); | 605 expect(context.fromUri(Uri.parse('//server/share/path/to/foo')), |
| 606 expect(context.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')), | 606 r'\\server\share\path\to\foo'); |
| 607 r'C:\path\to\foo#bar'); | 607 expect(context.fromUri(Uri.parse('file:///C:/path/to/foo%23bar')), |
| 608 expect(context.fromUri(Uri.parse('file://server/share/path/to/foo%23bar')), | 608 r'C:\path\to\foo#bar'); |
| 609 r'\\server\share\path\to\foo#bar'); | 609 expect(context.fromUri(Uri.parse('file://server/share/path/to/foo%23bar')) , |
| 610 expect(context.fromUri(Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')), | 610 r'\\server\share\path\to\foo#bar'); |
| 611 r'_{_}_`_^_ _"_%_'); | 611 expect(context.fromUri(Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')), |
| 612 expect(() => context.fromUri(Uri.parse('http://dartlang.org')), | 612 r'_{_}_`_^_ _"_%_'); |
| 613 throwsArgumentError); | 613 expect(() => context.fromUri(Uri.parse('http://dartlang.org')), |
| 614 throwsArgumentError); | |
| 615 }); | |
| 616 | |
| 617 test('with a string', () { | |
| 618 expect(context.fromUri('file:///C:/path/to/foo'), r'C:\path\to\foo'); | |
| 619 }); | |
| 614 }); | 620 }); |
| 615 | 621 |
| 616 test('toUri', () { | 622 test('toUri', () { |
| 617 expect(context.toUri(r'C:\path\to\foo'), | 623 expect(context.toUri(r'C:\path\to\foo'), |
| 618 Uri.parse('file:///C:/path/to/foo')); | 624 Uri.parse('file:///C:/path/to/foo')); |
| 619 expect(context.toUri(r'C:\path\to\foo\'), | 625 expect(context.toUri(r'C:\path\to\foo\'), |
| 620 Uri.parse('file:///C:/path/to/foo/')); | 626 Uri.parse('file:///C:/path/to/foo/')); |
| 621 expect(context.toUri(r'C:\'), Uri.parse('file:///C:/')); | 627 expect(context.toUri(r'C:\'), Uri.parse('file:///C:/')); |
| 622 expect(context.toUri(r'\\server\share'), Uri.parse('file://server/share')); | 628 expect(context.toUri(r'\\server\share'), Uri.parse('file://server/share')); |
| 623 expect(context.toUri(r'\\server\share\'), | 629 expect(context.toUri(r'\\server\share\'), |
| 624 Uri.parse('file://server/share/')); | 630 Uri.parse('file://server/share/')); |
| 625 expect(context.toUri(r'foo\bar'), Uri.parse('foo/bar')); | 631 expect(context.toUri(r'foo\bar'), Uri.parse('foo/bar')); |
| 626 expect(context.toUri(r'C:\path\to\foo#bar'), | 632 expect(context.toUri(r'C:\path\to\foo#bar'), |
| 627 Uri.parse('file:///C:/path/to/foo%23bar')); | 633 Uri.parse('file:///C:/path/to/foo%23bar')); |
| 628 expect(context.toUri(r'\\server\share\path\to\foo#bar'), | 634 expect(context.toUri(r'\\server\share\path\to\foo#bar'), |
| 629 Uri.parse('file://server/share/path/to/foo%23bar')); | 635 Uri.parse('file://server/share/path/to/foo%23bar')); |
| 630 expect(context.toUri(r'C:\_{_}_`_^_ _"_%_'), | 636 expect(context.toUri(r'C:\_{_}_`_^_ _"_%_'), |
| 631 Uri.parse('file:///C:/_%7B_%7D_%60_%5E_%20_%22_%25_')); | 637 Uri.parse('file:///C:/_%7B_%7D_%60_%5E_%20_%22_%25_')); |
| 632 expect(context.toUri(r'_{_}_`_^_ _"_%_'), | 638 expect(context.toUri(r'_{_}_`_^_ _"_%_'), |
| 633 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); | 639 Uri.parse('_%7B_%7D_%60_%5E_%20_%22_%25_')); |
| 634 }); | 640 }); |
| 635 } | 641 } |
| OLD | NEW |