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

Unified Diff: packages/path/test/posix_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/path/test/path_test.dart ('k') | packages/path/test/relative_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/path/test/posix_test.dart
diff --git a/packages/path/test/posix_test.dart b/packages/path/test/posix_test.dart
index 2368d9992b465ccc40728242bf1c7d9df74b7834..afd6b94f03d0ccb93670705bddee360a1e56ec74 100644
--- a/packages/path/test/posix_test.dart
+++ b/packages/path/test/posix_test.dart
@@ -4,7 +4,7 @@
library path.test.posix_test;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
import 'package:path/path.dart' as path;
import 'utils.dart';
@@ -419,6 +419,19 @@ main() {
expect(context.isWithin('baz', '/root/path/bang/baz'), isFalse);
});
+ test('complex cases', () {
+ expect(context.isWithin('foo/./bar', 'foo/bar/baz'), isTrue);
+ expect(context.isWithin('foo//bar', 'foo/bar/baz'), isTrue);
+ expect(context.isWithin('foo/qux/../bar', 'foo/bar/baz'), isTrue);
+ expect(context.isWithin('foo/bar', 'foo/bar/baz/../..'), isFalse);
+ expect(context.isWithin('foo/bar', 'foo/bar///'), isFalse);
+ expect(context.isWithin('foo/.bar', 'foo/.bar/baz'), isTrue);
+ expect(context.isWithin('foo/./bar', 'foo/.bar/baz'), isFalse);
+ expect(context.isWithin('foo/..bar', 'foo/..bar/baz'), isTrue);
+ expect(context.isWithin('foo/bar', 'foo/bar/baz/..'), isFalse);
+ expect(context.isWithin('foo/bar', 'foo/bar/baz/../qux'), isTrue);
+ });
+
test('from a relative root', () {
var r = new path.Context(style: path.Style.posix, current: 'foo/bar');
expect(r.isWithin('.', 'a/b/c'), isTrue);
« no previous file with comments | « packages/path/test/path_test.dart ('k') | packages/path/test/relative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698