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

Unified Diff: pkg/path/test/path_windows_test.dart

Issue 11638021: Make dirname and basename ignore trailing separators and double slashes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« pkg/path/test/path_posix_test.dart ('K') | « pkg/path/test/path_posix_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/path/test/path_windows_test.dart
diff --git a/pkg/path/test/path_windows_test.dart b/pkg/path/test/path_windows_test.dart
index a94d126b61f2f7e4a79aab0ebf40be1c2fecff4d..744b7ab59b0f193a0d4b1d5c58b89c3febda1f52 100644
--- a/pkg/path/test/path_windows_test.dart
+++ b/pkg/path/test/path_windows_test.dart
@@ -54,15 +54,19 @@ main() {
expect(builder.dirname(r'a\b'), 'a');
expect(builder.dirname(r'a\b\c'), r'a\b');
expect(builder.dirname(r'a\b.c'), 'a');
- expect(builder.dirname(r'a\'), 'a');
- expect(builder.dirname('a/'), 'a');
+ expect(builder.dirname(r'a\'), '.');
+ expect(builder.dirname('a/'), '.');
expect(builder.dirname(r'a\.'), 'a');
expect(builder.dirname(r'a\b/c'), r'a\b');
expect(builder.dirname(r'C:\a'), r'C:\');
- expect(builder.dirname('C:\\'), r'C:\');
- expect(builder.dirname(r'a\b\'), r'a\b');
+ expect(builder.dirname(r'C:\\\a'), r'C:\');
+ expect(builder.dirname(r'C:\'), r'C:\');
+ expect(builder.dirname(r'C:\\\'), r'C:\');
+ expect(builder.dirname(r'a\b\'), r'a');
expect(builder.dirname(r'a/b\c'), 'a/b');
- expect(builder.dirname(r'a\\'), r'a\');
+ expect(builder.dirname(r'a\\'), r'.');
+ expect(builder.dirname(r'a\b\\'), 'a');
+ expect(builder.dirname(r'a\\b'), 'a');
});
test('basename', () {
@@ -71,16 +75,17 @@ main() {
expect(builder.basename(r'a\b'), 'b');
expect(builder.basename(r'a\b\c'), 'c');
expect(builder.basename(r'a\b.c'), 'b.c');
- expect(builder.basename(r'a\'), '');
- expect(builder.basename(r'a/'), '');
+ expect(builder.basename(r'a\'), 'a');
+ expect(builder.basename(r'a/'), 'a');
expect(builder.basename(r'a\.'), '.');
expect(builder.basename(r'a\b/c'), r'c');
expect(builder.basename(r'C:\a'), 'a');
- // TODO(nweiz): this should actually return 'C:\'
- expect(builder.basename(r'C:\'), '');
- expect(builder.basename(r'a\b\'), '');
+ expect(builder.basename(r'C:\'), r'C:\');
+ expect(builder.basename(r'a\b\'), 'b');
expect(builder.basename(r'a/b\c'), 'c');
- expect(builder.basename(r'a\\'), '');
+ expect(builder.basename(r'a\\'), 'a');
+ expect(builder.basename(r'a\b\\'), 'b');
+ expect(builder.basename(r'a\\b'), 'b');
});
test('basenameWithoutExtension', () {
@@ -89,11 +94,16 @@ main() {
expect(builder.basenameWithoutExtension(r'a\b'), 'b');
expect(builder.basenameWithoutExtension(r'a\b\c'), 'c');
expect(builder.basenameWithoutExtension(r'a\b.c'), 'b');
- expect(builder.basenameWithoutExtension(r'a\'), '');
+ expect(builder.basenameWithoutExtension(r'a\'), 'a');
expect(builder.basenameWithoutExtension(r'a\.'), '.');
expect(builder.basenameWithoutExtension(r'a\b/c'), r'c');
expect(builder.basenameWithoutExtension(r'a\.bashrc'), '.bashrc');
expect(builder.basenameWithoutExtension(r'a\b\c.d.e'), 'c.d');
+ expect(builder.basenameWithoutExtension(r'a\\'), 'a');
+ expect(builder.basenameWithoutExtension(r'a\b\\'), 'b');
+ expect(builder.basenameWithoutExtension(r'a\\b'), 'b');
+ expect(builder.basenameWithoutExtension(r'a\b.c\'), 'b');
+ expect(builder.basenameWithoutExtension(r'a\b.c\\'), 'b');
});
test('isAbsolute', () {
@@ -392,5 +402,6 @@ main() {
expect(builder.withoutExtension(r'a\b/c'), r'a\b/c');
expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c');
expect(builder.withoutExtension(r'a.b/c'), r'a.b/c');
+ expect(builder.withoutExtension(r'a\b.c\'), r'a\b\');
});
}
« pkg/path/test/path_posix_test.dart ('K') | « pkg/path/test/path_posix_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698