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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 expect(context.isWithin(r'C:\', r'D:\foo\bar'), isFalse); | 532 expect(context.isWithin(r'C:\', r'D:\foo\bar'), isFalse); |
533 expect(context.isWithin(r'C:\', r'\foo\bar'), isTrue); | 533 expect(context.isWithin(r'C:\', r'\foo\bar'), isTrue); |
534 expect(context.isWithin(r'C:\foo', r'\foo\bar'), isTrue); | 534 expect(context.isWithin(r'C:\foo', r'\foo\bar'), isTrue); |
535 expect(context.isWithin(r'C:\foo', r'\bar\baz'), isFalse); | 535 expect(context.isWithin(r'C:\foo', r'\bar\baz'), isFalse); |
536 expect(context.isWithin(r'baz', r'C:\root\path\baz\bang'), isTrue); | 536 expect(context.isWithin(r'baz', r'C:\root\path\baz\bang'), isTrue); |
537 expect(context.isWithin(r'baz', r'C:\root\path\bang\baz'), isFalse); | 537 expect(context.isWithin(r'baz', r'C:\root\path\bang\baz'), isFalse); |
538 }); | 538 }); |
539 | 539 |
540 test('from a relative root', () { | 540 test('from a relative root', () { |
541 var r = new path.Context(style: path.Style.windows, current: r'foo\bar'); | 541 var r = new path.Context(style: path.Style.windows, current: r'foo\bar'); |
542 expect(context.isWithin('.', r'a\b\c'), isTrue); | 542 expect(r.isWithin('.', r'a\b\c'), isTrue); |
543 expect(context.isWithin('.', r'..\a\b\c'), isFalse); | 543 expect(r.isWithin('.', r'..\a\b\c'), isFalse); |
544 expect(context.isWithin('.', r'..\..\a\foo\b\c'), isFalse); | 544 expect(r.isWithin('.', r'..\..\a\foo\b\c'), isFalse); |
545 expect(context.isWithin(r'C:\', r'C:\baz\bang'), isTrue); | 545 expect(r.isWithin(r'C:\', r'C:\baz\bang'), isTrue); |
546 expect(context.isWithin('.', r'C:\baz\bang'), isFalse); | 546 expect(r.isWithin('.', r'C:\baz\bang'), isFalse); |
547 }); | 547 }); |
548 }); | 548 }); |
549 | 549 |
550 group('absolute', () { | 550 group('absolute', () { |
551 test('allows up to seven parts', () { | 551 test('allows up to seven parts', () { |
552 expect(context.absolute('a'), r'C:\root\path\a'); | 552 expect(context.absolute('a'), r'C:\root\path\a'); |
553 expect(context.absolute('a', 'b'), r'C:\root\path\a\b'); | 553 expect(context.absolute('a', 'b'), r'C:\root\path\a\b'); |
554 expect(context.absolute('a', 'b', 'c'), r'C:\root\path\a\b\c'); | 554 expect(context.absolute('a', 'b', 'c'), r'C:\root\path\a\b\c'); |
555 expect(context.absolute('a', 'b', 'c', 'd'), r'C:\root\path\a\b\c\d'); | 555 expect(context.absolute('a', 'b', 'c', 'd'), r'C:\root\path\a\b\c\d'); |
556 expect(context.absolute('a', 'b', 'c', 'd', 'e'), | 556 expect(context.absolute('a', 'b', 'c', 'd', 'e'), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 667 |
668 test('with a root-relative URI', () { | 668 test('with a root-relative URI', () { |
669 expect(context.prettyUri('/D:/a/b'), r'D:\a\b'); | 669 expect(context.prettyUri('/D:/a/b'), r'D:\a\b'); |
670 }); | 670 }); |
671 | 671 |
672 test('with a Uri object', () { | 672 test('with a Uri object', () { |
673 expect(context.prettyUri(Uri.parse('a/b')), r'a\b'); | 673 expect(context.prettyUri(Uri.parse('a/b')), r'a\b'); |
674 }); | 674 }); |
675 }); | 675 }); |
676 } | 676 } |
OLD | NEW |