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

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

Issue 11416197: Support Windows share paths in the Path class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 a2b39a603dbbdbb3b5baf3a200e31d5b1ca87791..fbc2ce95289f976e599ece3e519bbd6e203d82b6 100644
--- a/tests/standalone/io/path_test.dart
+++ b/tests/standalone/io/path_test.dart
@@ -11,6 +11,7 @@ void main() {
testCanonicalize();
testJoinAppend();
testRelativeTo();
+ testWindowsShare();
}
void testBaseFunctions() {
@@ -194,3 +195,36 @@ void testRelativeTo() {
Expect.throws(() =>
new Path('a/b').relativeTo(new Path('../../d')));
}
+
+// Test that Windows share information is maintain through
+// Path operations.
+void testWindowsShare() {
+ // Windows share information only makes sense on Windows.
+ if (Platform.operatingSystem != 'windows') return;
+ var path = new Path.fromNative(r'\\share\a\b\..\c');
+ Expect.isTrue(path.isAbsolute);
+ Expect.isTrue(path.isWindowsShare);
+ Expect.isFalse(path.hasTrailingSeparator);
+ var canonical = path.canonicalize();
+ Expect.isTrue(canonical.isAbsolute);
+ Expect.isTrue(canonical.isWindowsShare);
+ Expect.isFalse(path.isCanonical);
+ Expect.isTrue(canonical.isCanonical);
+ var joined = canonical.join(new Path('d/e/f'));
+ Expect.isTrue(joined.isAbsolute);
+ Expect.isTrue(joined.isWindowsShare);
+ var relativeTo = joined.relativeTo(canonical);
+ Expect.isFalse(relativeTo.isAbsolute);
+ Expect.isFalse(relativeTo.isWindowsShare);
+ var nonShare = new Path('/share/a/c/d/e');
+ Expect.throws(() => nonShare.relativeTo(canonical));
+ Expect.isTrue(canonical.toString().startsWith('/share/a'));
+ Expect.isTrue(canonical.toNativePath().startsWith(r'\\share\a'));
+ Expect.listEquals(['share', 'a', 'c'], canonical.segments());
+ var appended = canonical.append('d');
+ Expect.isTrue(appended.isAbsolute);
+ Expect.isTrue(appended.isWindowsShare);
+ var directoryPath = canonical.directoryPath;
+ Expect.isTrue(directoryPath.isAbsolute);
+ Expect.isTrue(directoryPath.isWindowsShare);
+}
« 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