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

Side by Side Diff: test/url_test.dart

Issue 837563005: fixed relative root tests (Closed) Base URL: https://github.com/dart-lang/path.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « test/posix_test.dart ('k') | test/windows_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 import 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 7
8 main() { 8 main() {
9 var context = new path.Context(style: path.Style.url, 9 var context = new path.Context(style: path.Style.url,
10 current: 'http://dartlang.org/root/path'); 10 current: 'http://dartlang.org/root/path');
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 expect(context.isWithin('http://dartlang.org/foo', '/foo/bar'), isTrue); 632 expect(context.isWithin('http://dartlang.org/foo', '/foo/bar'), isTrue);
633 expect(context.isWithin('http://dartlang.org/foo', '/bar/baz'), isFalse); 633 expect(context.isWithin('http://dartlang.org/foo', '/bar/baz'), isFalse);
634 expect(context.isWithin('baz', 'http://dartlang.org/root/path/baz/bang'), 634 expect(context.isWithin('baz', 'http://dartlang.org/root/path/baz/bang'),
635 isTrue); 635 isTrue);
636 expect(context.isWithin('baz', 'http://dartlang.org/root/path/bang/baz'), 636 expect(context.isWithin('baz', 'http://dartlang.org/root/path/bang/baz'),
637 isFalse); 637 isFalse);
638 }); 638 });
639 639
640 test('from a relative root', () { 640 test('from a relative root', () {
641 var r = new path.Context(style: path.Style.url, current: 'foo/bar'); 641 var r = new path.Context(style: path.Style.url, current: 'foo/bar');
642 expect(context.isWithin('.', 'a/b/c'), isTrue); 642 expect(r.isWithin('.', 'a/b/c'), isTrue);
643 expect(context.isWithin('.', '../a/b/c'), isFalse); 643 expect(r.isWithin('.', '../a/b/c'), isFalse);
644 expect(context.isWithin('.', '../../a/foo/b/c'), isFalse); 644 expect(r.isWithin('.', '../../a/foo/b/c'), isFalse);
645 expect(context.isWithin( 645 expect(r.isWithin(
646 'http://dartlang.org/', 'http://dartlang.org/baz/bang'), 646 'http://dartlang.org/', 'http://dartlang.org/baz/bang'), isTrue);
647 isTrue); 647 expect(r.isWithin('.', 'http://dartlang.org/baz/bang'), isFalse);
648 expect(context.isWithin('.', 'http://dartlang.org/baz/bang'), isFalse);
649 }); 648 });
650 }); 649 });
651 650
652 group('absolute', () { 651 group('absolute', () {
653 test('allows up to seven parts', () { 652 test('allows up to seven parts', () {
654 expect(context.absolute('a'), 'http://dartlang.org/root/path/a'); 653 expect(context.absolute('a'), 'http://dartlang.org/root/path/a');
655 expect(context.absolute('a', 'b'), 'http://dartlang.org/root/path/a/b'); 654 expect(context.absolute('a', 'b'), 'http://dartlang.org/root/path/a/b');
656 expect(context.absolute('a', 'b', 'c'), 655 expect(context.absolute('a', 'b', 'c'),
657 'http://dartlang.org/root/path/a/b/c'); 656 'http://dartlang.org/root/path/a/b/c');
658 expect(context.absolute('a', 'b', 'c', 'd'), 657 expect(context.absolute('a', 'b', 'c', 'd'),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 765
767 test('with a root-relative URI', () { 766 test('with a root-relative URI', () {
768 expect(context.prettyUri('/a/b'), '/a/b'); 767 expect(context.prettyUri('/a/b'), '/a/b');
769 }); 768 });
770 769
771 test('with a Uri object', () { 770 test('with a Uri object', () {
772 expect(context.prettyUri(Uri.parse('a/b')), 'a/b'); 771 expect(context.prettyUri(Uri.parse('a/b')), 'a/b');
773 }); 772 });
774 }); 773 });
775 } 774 }
OLDNEW
« no previous file with comments | « test/posix_test.dart ('k') | test/windows_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698