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

Side by Side Diff: pkg/path/test/path_windows_test.dart

Issue 12314047: Add path.joinAll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/path/test/path_posix_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library path_test; 5 library path_test;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 8
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 expect(builder.join('a', null), equals('a')); 173 expect(builder.join('a', null), equals('a'));
174 expect(builder.join('a', 'b', 'c', null, null), equals(r'a\b\c')); 174 expect(builder.join('a', 'b', 'c', null, null), equals(r'a\b\c'));
175 }); 175 });
176 176
177 test('disallows intermediate nulls', () { 177 test('disallows intermediate nulls', () {
178 expect(() => builder.join('a', null, 'b'), throwsArgumentError); 178 expect(() => builder.join('a', null, 'b'), throwsArgumentError);
179 expect(() => builder.join(null, 'a'), throwsArgumentError); 179 expect(() => builder.join(null, 'a'), throwsArgumentError);
180 }); 180 });
181 }); 181 });
182 182
183 group('joinAll', () {
184 test('allows more than eight parts', () {
185 expect(builder.joinAll(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']),
186 r'a\b\c\d\e\f\g\h\i');
187 });
188
189 test('does not add separator if a part ends or begins in one', () {
190 expect(builder.joinAll([r'a\', 'b', r'c\', 'd']), r'a\b\c\d');
191 expect(builder.joinAll(['a/', 'b']), r'a/b');
192 expect(builder.joinAll(['a', '/b']), 'a/b');
193 expect(builder.joinAll(['a', r'\b']), r'a\b');
194 });
195
196 test('ignores parts before an absolute path', () {
197 expect(builder.joinAll(['a', '/b', '/c', 'd']), r'a/b/c\d');
198 expect(builder.joinAll(['a', r'c:\b', 'c', 'd']), r'c:\b\c\d');
199 expect(builder.joinAll(['a', r'\\b', r'\\c', 'd']), r'\\c\d');
200 });
201 });
202
183 group('split', () { 203 group('split', () {
184 test('simple cases', () { 204 test('simple cases', () {
185 expect(builder.split(''), []); 205 expect(builder.split(''), []);
186 expect(builder.split('.'), ['.']); 206 expect(builder.split('.'), ['.']);
187 expect(builder.split('..'), ['..']); 207 expect(builder.split('..'), ['..']);
188 expect(builder.split('foo'), equals(['foo'])); 208 expect(builder.split('foo'), equals(['foo']));
189 expect(builder.split(r'foo\bar.txt'), equals(['foo', 'bar.txt'])); 209 expect(builder.split(r'foo\bar.txt'), equals(['foo', 'bar.txt']));
190 expect(builder.split(r'foo\bar/baz'), equals(['foo', 'bar', 'baz'])); 210 expect(builder.split(r'foo\bar/baz'), equals(['foo', 'bar', 'baz']));
191 expect(builder.split(r'foo\..\bar\.\baz'), 211 expect(builder.split(r'foo\..\bar\.\baz'),
192 equals(['foo', '..', 'bar', '.', 'baz'])); 212 equals(['foo', '..', 'bar', '.', 'baz']));
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 expect(builder.withoutExtension(r'a\.'), r'a\.'); 425 expect(builder.withoutExtension(r'a\.'), r'a\.');
406 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); 426 expect(builder.withoutExtension(r'a\.b'), r'a\.b');
407 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); 427 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c');
408 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); 428 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d');
409 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); 429 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c');
410 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); 430 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c');
411 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); 431 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c');
412 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\'); 432 expect(builder.withoutExtension(r'a\b.c\'), r'a\b\');
413 }); 433 });
414 } 434 }
OLDNEW
« no previous file with comments | « 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