| Index: packages/path/test/posix_test.dart
|
| diff --git a/packages/path/test/posix_test.dart b/packages/path/test/posix_test.dart
|
| index afd6b94f03d0ccb93670705bddee360a1e56ec74..4549ebdfd48e0b835e04f6e31d25288d18466f35 100644
|
| --- a/packages/path/test/posix_test.dart
|
| +++ b/packages/path/test/posix_test.dart
|
| @@ -2,8 +2,6 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library path.test.posix_test;
|
| -
|
| import 'package:test/test.dart';
|
| import 'package:path/path.dart' as path;
|
|
|
| @@ -319,6 +317,12 @@ main() {
|
| expect(context.normalize(r'a/b\'), r'a/b\');
|
| expect(context.normalize('a/b///'), 'a/b');
|
| });
|
| +
|
| + test('when canonicalizing', () {
|
| + expect(context.canonicalize('.'), '/root/path');
|
| + expect(context.canonicalize('foo/bar'), '/root/path/foo/bar');
|
| + expect(context.canonicalize('FoO'), '/root/path/FoO');
|
| + });
|
| });
|
|
|
| group('relative', () {
|
| @@ -350,6 +354,11 @@ main() {
|
| expect(context.relative('a/./b/../c.txt'), 'a/c.txt');
|
| });
|
|
|
| + test('is case-sensitive', () {
|
| + expect(context.relative('/RoOt'), '../../RoOt');
|
| + expect(context.relative('/rOoT/pAtH/a'), '../../rOoT/pAtH/a');
|
| + });
|
| +
|
| // Regression
|
| test('from root-only path', () {
|
| expect(context.relative('/', from: '/'), '.');
|
| @@ -442,6 +451,44 @@ main() {
|
| });
|
| });
|
|
|
| + group('equals and hash', () {
|
| + test('simple cases', () {
|
| + expectEquals(context, 'foo/bar', 'foo/bar');
|
| + expectNotEquals(context, 'foo/bar', 'foo/bar/baz');
|
| + expectNotEquals(context, 'foo/bar', 'foo');
|
| + expectNotEquals(context, 'foo/bar', 'foo/baz');
|
| + expectEquals(context, 'foo/bar', '../path/foo/bar');
|
| + expectEquals(context, '/', '/');
|
| + expectEquals(context, '/', '../..');
|
| + expectEquals(context, 'baz', '/root/path/baz');
|
| + });
|
| +
|
| + test('complex cases', () {
|
| + expectEquals(context, 'foo/./bar', 'foo/bar');
|
| + expectEquals(context, 'foo//bar', 'foo/bar');
|
| + expectEquals(context, 'foo/qux/../bar', 'foo/bar');
|
| + expectNotEquals(context, 'foo/qux/../bar', 'foo/qux');
|
| + expectNotEquals(context, 'foo/bar', 'foo/bar/baz/../..');
|
| + expectEquals(context, 'foo/bar', 'foo/bar///');
|
| + expectEquals(context, 'foo/.bar', 'foo/.bar');
|
| + expectNotEquals(context, 'foo/./bar', 'foo/.bar');
|
| + expectEquals(context, 'foo/..bar', 'foo/..bar');
|
| + expectNotEquals(context, 'foo/../bar', 'foo/..bar');
|
| + expectEquals(context, 'foo/bar', 'foo/bar/baz/..');
|
| + expectNotEquals(context, 'FoO/bAr', 'foo/bar');
|
| + });
|
| +
|
| + test('from a relative root', () {
|
| + var r = new path.Context(style: path.Style.posix, current: 'foo/bar');
|
| + expectEquals(r, 'a/b', 'a/b');
|
| + expectNotEquals(r, '.', 'foo/bar');
|
| + expectNotEquals(r, '.', '../a/b');
|
| + expectEquals(r, '.', '../bar');
|
| + expectEquals(r, '/baz/bang', '/baz/bang');
|
| + expectNotEquals(r, 'baz/bang', '/baz/bang');
|
| + });
|
| + });
|
| +
|
| group('absolute', () {
|
| test('allows up to seven parts', () {
|
| expect(context.absolute('a'), '/root/path/a');
|
|
|