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

Side by Side Diff: test/posix_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 | « pubspec.yaml ('k') | test/url_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 library path.test.posix_test; 5 library path.test.posix_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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 expect(context.isWithin('foo/bar', 'foo/bar/baz'), isTrue); 414 expect(context.isWithin('foo/bar', 'foo/bar/baz'), isTrue);
415 expect(context.isWithin('foo/bar', 'foo/baz'), isFalse); 415 expect(context.isWithin('foo/bar', 'foo/baz'), isFalse);
416 expect(context.isWithin('foo/bar', '../path/foo/bar/baz'), isTrue); 416 expect(context.isWithin('foo/bar', '../path/foo/bar/baz'), isTrue);
417 expect(context.isWithin('/', '/foo/bar'), isTrue); 417 expect(context.isWithin('/', '/foo/bar'), isTrue);
418 expect(context.isWithin('baz', '/root/path/baz/bang'), isTrue); 418 expect(context.isWithin('baz', '/root/path/baz/bang'), isTrue);
419 expect(context.isWithin('baz', '/root/path/bang/baz'), isFalse); 419 expect(context.isWithin('baz', '/root/path/bang/baz'), isFalse);
420 }); 420 });
421 421
422 test('from a relative root', () { 422 test('from a relative root', () {
423 var r = new path.Context(style: path.Style.posix, current: 'foo/bar'); 423 var r = new path.Context(style: path.Style.posix, current: 'foo/bar');
424 expect(context.isWithin('.', 'a/b/c'), isTrue); 424 expect(r.isWithin('.', 'a/b/c'), isTrue);
425 expect(context.isWithin('.', '../a/b/c'), isFalse); 425 expect(r.isWithin('.', '../a/b/c'), isFalse);
426 expect(context.isWithin('.', '../../a/foo/b/c'), isFalse); 426 expect(r.isWithin('.', '../../a/foo/b/c'), isFalse);
427 expect(context.isWithin('/', '/baz/bang'), isTrue); 427 expect(r.isWithin('/', '/baz/bang'), isTrue);
428 expect(context.isWithin('.', '/baz/bang'), isFalse); 428 expect(r.isWithin('.', '/baz/bang'), isFalse);
429 }); 429 });
430 }); 430 });
431 431
432 group('absolute', () { 432 group('absolute', () {
433 test('allows up to seven parts', () { 433 test('allows up to seven parts', () {
434 expect(context.absolute('a'), '/root/path/a'); 434 expect(context.absolute('a'), '/root/path/a');
435 expect(context.absolute('a', 'b'), '/root/path/a/b'); 435 expect(context.absolute('a', 'b'), '/root/path/a/b');
436 expect(context.absolute('a', 'b', 'c'), '/root/path/a/b/c'); 436 expect(context.absolute('a', 'b', 'c'), '/root/path/a/b/c');
437 expect(context.absolute('a', 'b', 'c', 'd'), '/root/path/a/b/c/d'); 437 expect(context.absolute('a', 'b', 'c', 'd'), '/root/path/a/b/c/d');
438 expect(context.absolute('a', 'b', 'c', 'd', 'e'), '/root/path/a/b/c/d/e'); 438 expect(context.absolute('a', 'b', 'c', 'd', 'e'), '/root/path/a/b/c/d/e');
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 test('with a root-relative URI', () { 529 test('with a root-relative URI', () {
530 expect(context.prettyUri('/a/b'), '/a/b'); 530 expect(context.prettyUri('/a/b'), '/a/b');
531 }); 531 });
532 532
533 test('with a Uri object', () { 533 test('with a Uri object', () {
534 expect(context.prettyUri(Uri.parse('a/b')), 'a/b'); 534 expect(context.prettyUri(Uri.parse('a/b')), 'a/b');
535 }); 535 });
536 }); 536 });
537 } 537 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/url_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698