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

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

Issue 12314047: Add path.joinAll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/path_posix_test.dart
diff --git a/pkg/path/test/path_posix_test.dart b/pkg/path/test/path_posix_test.dart
index e1c39421dd7adcfd5919e2819ca2f71cb5f6b824..c84da81566b74c4e541253c034016dfc705ace88 100644
--- a/pkg/path/test/path_posix_test.dart
+++ b/pkg/path/test/path_posix_test.dart
@@ -161,6 +161,30 @@ main() {
});
});
+ group('joinAll', () {
+ test('allows more than eight parts', () {
+ expect(builder.joinAll(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']),
+ 'a/b/c/d/e/f/g/h/i');
+ });
+
+ test('does not add separator if a part ends in one', () {
+ expect(builder.joinAll(['a/', 'b', 'c/', 'd']), 'a/b/c/d');
+ expect(builder.joinAll(['a\\', 'b']), r'a\/b');
+ });
+
+ test('ignores parts before an absolute path', () {
+ expect(builder.joinAll(['a', '/', 'b', 'c']), '/b/c');
+ expect(builder.joinAll(['a', '/b', '/c', 'd']), '/c/d');
+ expect(builder.joinAll(['a', r'c:\b', 'c', 'd']), r'a/c:\b/c/d');
+ expect(builder.joinAll(['a', r'\\b', 'c', 'd']), r'a/\\b/c/d');
+ });
+
+ test('disallows intermediate nulls', () {
Bob Nystrom 2013/02/21 22:03:27 I think it should disallow trailing nulls too.
nweiz 2013/02/21 22:19:25 I actually meant to remove this test. I don't thin
+ expect(() => builder.joinAll(['a', null, 'b']), throwsArgumentError);
+ expect(() => builder.joinAll([null, 'a']), throwsArgumentError);
+ });
+ });
+
group('split', () {
test('simple cases', () {
expect(builder.split(''), []);

Powered by Google App Engine
This is Rietveld 408576698