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

Side by Side Diff: packages/path/test/windows_test.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « packages/path/test/utils.dart ('k') | packages/plugin/._AUTHORS » ('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 path.test.windows_test; 5 library path.test.windows_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:test/test.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';
11 11
12 main() { 12 main() {
13 var context = 13 var context =
14 new path.Context(style: path.Style.windows, current: r'C:\root\path'); 14 new path.Context(style: path.Style.windows, current: r'C:\root\path');
15 15
16 group('separator', () { 16 test('separator', () {
17 expect(context.separator, '\\'); 17 expect(context.separator, '\\');
18 }); 18 });
19 19
20 test('extension', () { 20 test('extension', () {
21 expect(context.extension(''), ''); 21 expect(context.extension(''), '');
22 expect(context.extension('.'), ''); 22 expect(context.extension('.'), '');
23 expect(context.extension('..'), ''); 23 expect(context.extension('..'), '');
24 expect(context.extension('a/..'), ''); 24 expect(context.extension('a/..'), '');
25 expect(context.extension('foo.dart'), '.dart'); 25 expect(context.extension('foo.dart'), '.dart');
26 expect(context.extension('foo.dart.js'), '.js'); 26 expect(context.extension('foo.dart.js'), '.js');
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 expect(context.isWithin(r'foo\bar', r'..\path\foo\bar\baz'), isTrue); 530 expect(context.isWithin(r'foo\bar', r'..\path\foo\bar\baz'), isTrue);
531 expect(context.isWithin(r'C:\', r'C:\foo\bar'), isTrue); 531 expect(context.isWithin(r'C:\', r'C:\foo\bar'), isTrue);
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('complex cases', () {
541 expect(context.isWithin(r'foo\.\bar', r'foo\bar\baz'), isTrue);
542 expect(context.isWithin(r'foo\\bar', r'foo\bar\baz'), isTrue);
543 expect(context.isWithin(r'foo\qux\..\bar', r'foo\bar\baz'), isTrue);
544 expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..\..'), isFalse);
545 expect(context.isWithin(r'foo\bar', r'foo\bar\\\'), isFalse);
546 expect(context.isWithin(r'foo\.bar', r'foo\.bar\baz'), isTrue);
547 expect(context.isWithin(r'foo\.\bar', r'foo\.bar\baz'), isFalse);
548 expect(context.isWithin(r'foo\..bar', r'foo\..bar\baz'), isTrue);
549 expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..'), isFalse);
550 expect(context.isWithin(r'foo\bar', r'foo\bar\baz\..\qux'), isTrue);
551 expect(context.isWithin(r'C:\', 'C:/foo'), isTrue);
552 expect(context.isWithin(r'C:\', r'D:\foo'), isFalse);
553 expect(context.isWithin(r'C:\', r'\\foo\bar'), isFalse);
554 });
555
556 test('with root-relative paths', () {
557 expect(context.isWithin(r'\foo', r'C:\foo\bar'), isTrue);
558 expect(context.isWithin(r'C:\foo', r'\foo\bar'), isTrue);
559 expect(context.isWithin(r'\root', r'foo\bar'), isTrue);
560 expect(context.isWithin(r'foo', r'\root\path\foo\bar'), isTrue);
561 expect(context.isWithin(r'\foo', r'\foo\bar'), isTrue);
562 });
563
540 test('from a relative root', () { 564 test('from a relative root', () {
541 var r = new path.Context(style: path.Style.windows, current: r'foo\bar'); 565 var r = new path.Context(style: path.Style.windows, current: r'foo\bar');
542 expect(r.isWithin('.', r'a\b\c'), isTrue); 566 expect(r.isWithin('.', r'a\b\c'), isTrue);
543 expect(r.isWithin('.', r'..\a\b\c'), isFalse); 567 expect(r.isWithin('.', r'..\a\b\c'), isFalse);
544 expect(r.isWithin('.', r'..\..\a\foo\b\c'), isFalse); 568 expect(r.isWithin('.', r'..\..\a\foo\b\c'), isFalse);
545 expect(r.isWithin(r'C:\', r'C:\baz\bang'), isTrue); 569 expect(r.isWithin(r'C:\', r'C:\baz\bang'), isTrue);
546 expect(r.isWithin('.', r'C:\baz\bang'), isFalse); 570 expect(r.isWithin('.', r'C:\baz\bang'), isFalse);
547 }); 571 });
548 }); 572 });
549 573
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 691
668 test('with a root-relative URI', () { 692 test('with a root-relative URI', () {
669 expect(context.prettyUri('/D:/a/b'), r'D:\a\b'); 693 expect(context.prettyUri('/D:/a/b'), r'D:\a\b');
670 }); 694 });
671 695
672 test('with a Uri object', () { 696 test('with a Uri object', () {
673 expect(context.prettyUri(Uri.parse('a/b')), r'a\b'); 697 expect(context.prettyUri(Uri.parse('a/b')), r'a\b');
674 }); 698 });
675 }); 699 });
676 } 700 }
OLDNEW
« no previous file with comments | « packages/path/test/utils.dart ('k') | packages/plugin/._AUTHORS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698