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

Unified Diff: tests/standalone/io/path_test.dart

Issue 11959011: Fix Path.relativeTo in special case where base is a substring of this. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed another bug - added tests for it. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/path_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/path_test.dart
diff --git a/tests/standalone/io/path_test.dart b/tests/standalone/io/path_test.dart
index 1607cda58280f6c65fe5cbdcba99b01a7948a7ec..55c5031f658864b5c59af82ff36398706e26f008 100644
--- a/tests/standalone/io/path_test.dart
+++ b/tests/standalone/io/path_test.dart
@@ -236,6 +236,26 @@ void testRelativeTo() {
new Path('..').relativeTo(new Path('a/b')).toString());
Expect.equals('../b/c/d/',
new Path('b/c/d/').relativeTo(new Path('a/')).toString());
+ Expect.equals('../a/b/c',
+ new Path('x/y/a//b/./f/../c').relativeTo(new Path('x//y/z')).toString());
+
+ // Case where base is a substring of relative:
+ Expect.equals('a/b',
+ new Path('/x/y//a/b').relativeTo(new Path('/x/y/')).toString());
+ Expect.equals('a/b',
+ new Path('x/y//a/b').relativeTo(new Path('x/y/')).toString());
+ Expect.equals('../ya/b',
+ new Path('/x/ya/b').relativeTo(new Path('/x/y')).toString());
+ Expect.equals('../ya/b',
+ new Path('x/ya/b').relativeTo(new Path('x/y')).toString());
+ Expect.equals('../b',
+ new Path('x/y/../b').relativeTo(new Path('x/y/.')).toString());
+ Expect.equals('a/b/c',
+ new Path('x/y/a//b/./f/../c').relativeTo(new Path('x/y')).toString());
+ Expect.equals('.',
+ new Path('/x/y//').relativeTo(new Path('/x/y/')).toString());
+ Expect.equals('.',
+ new Path('/x/y/').relativeTo(new Path('/x/y')).toString());
// Should always throw - no relative path can be constructed.
Expect.throws(() =>
« no previous file with comments | « sdk/lib/io/path_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698