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

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

Issue 19231002: Port dart:io Path tests to package:path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows failures Created 7 years, 5 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
Index: pkg/path/test/windows_test.dart
diff --git a/pkg/path/test/windows_test.dart b/pkg/path/test/windows_test.dart
index 74094397461b7ab0cb859318cd8557d20782ea1a..bfbcf347b2e63f7b8d96cfd6e4df9319169d54e7 100644
--- a/pkg/path/test/windows_test.dart
+++ b/pkg/path/test/windows_test.dart
@@ -184,6 +184,14 @@ main() {
expect(() => builder.join('a', null, 'b'), throwsArgumentError);
expect(() => builder.join(null, 'a'), throwsArgumentError);
});
+ test('misc join tests ported from Path class', () {
+ expect(builder.join('a/', 'b/c/'), 'a/b/c/');
+ expect(builder.join(r'a\b\./c\..\\', r'd\..\.\..\\e\f\\'),
+ r'a\b\./c\..\\d\..\.\..\\e\f\\');
+ expect(builder.join(r'a\b', r'c\..\..\..\..'), r'a\b\c\..\..\..\..');
+ expect(builder.join('', ''), '');
+ expect(builder.join(r'a', 'b${builder.separator}'), r'a\b\');
+ });
});
group('joinAll', () {
@@ -238,10 +246,12 @@ main() {
group('normalize', () {
test('simple cases', () {
- expect(builder.normalize(''), '');
+ expect(builder.normalize(''), '.');
expect(builder.normalize('.'), '.');
expect(builder.normalize('..'), '..');
expect(builder.normalize('a'), 'a');
+ expect(builder.normalize(r'\'), '.');
+ expect(builder.normalize('/'), r'.');
expect(builder.normalize('C:/'), r'C:\');
expect(builder.normalize(r'C:\'), r'C:\');
expect(builder.normalize(r'\\'), r'\\');
@@ -278,12 +288,19 @@ main() {
expect(builder.normalize(r'c:\..'), r'c:\');
expect(builder.normalize(r'A:/..\..\..'), r'A:\');
expect(builder.normalize(r'b:\..\..\..\a'), r'b:\a');
+ expect(builder.normalize(r'b:\r\..\..\..\a\c\.\..'), r'b:\a');
expect(builder.normalize(r'a\..'), '.');
+ expect(builder.normalize(r'..\a'), r'..\a');
+ expect(builder.normalize(r'c:\..\a'), r'c:\a');
+ // A path starting with '\' is not an absolute path on Windows.
+ expect(builder.normalize(r'\..\a'), r'..\a');
expect(builder.normalize(r'a\b\..'), 'a');
+ expect(builder.normalize(r'..\a\b\..'), r'..\a');
expect(builder.normalize(r'a\..\b'), 'b');
expect(builder.normalize(r'a\.\..\b'), 'b');
expect(builder.normalize(r'a\b\c\..\..\d\e\..'), r'a\d');
expect(builder.normalize(r'a\b\..\..\..\..\c'), r'..\..\c');
+ expect(builder.normalize(r'a/b/c/../../..d/./.e/f././'), r'a\..d\.e\f.');
});
test('removes trailing separators', () {

Powered by Google App Engine
This is Rietveld 408576698