OLD | NEW |
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 '../../../../pkg/unittest/lib/unittest.dart'; | 9 import '../../../../pkg/unittest/lib/unittest.dart'; |
10 import '../../../pub/path.dart' as path; | 10 import '../../../pub/path.dart' as path; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 }); | 165 }); |
166 | 166 |
167 test('disallows intermediate nulls', () { | 167 test('disallows intermediate nulls', () { |
168 expect(() => builder.join('a', null, 'b'), throwsArgumentError); | 168 expect(() => builder.join('a', null, 'b'), throwsArgumentError); |
169 expect(() => builder.join(null, 'a'), throwsArgumentError); | 169 expect(() => builder.join(null, 'a'), throwsArgumentError); |
170 }); | 170 }); |
171 }); | 171 }); |
172 | 172 |
173 group('split', () { | 173 group('split', () { |
174 test('simple cases', () { | 174 test('simple cases', () { |
| 175 expect(builder.split(''), []); |
| 176 expect(builder.split('.'), ['.']); |
| 177 expect(builder.split('..'), ['..']); |
175 expect(builder.split('foo'), equals(['foo'])); | 178 expect(builder.split('foo'), equals(['foo'])); |
176 expect(builder.split(r'foo\bar'), equals(['foo', 'bar'])); | 179 expect(builder.split(r'foo\bar.txt'), equals(['foo', 'bar.txt'])); |
177 expect(builder.split(r'foo\bar\baz'), equals(['foo', 'bar', 'baz'])); | 180 expect(builder.split(r'foo\bar/baz'), equals(['foo', 'bar', 'baz'])); |
178 expect(builder.split(r'foo\..\bar\.\baz'), | 181 expect(builder.split(r'foo\..\bar\.\baz'), |
179 equals(['foo', '..', 'bar', '.', 'baz'])); | 182 equals(['foo', '..', 'bar', '.', 'baz'])); |
180 expect(builder.split(r'foo\\bar\\\baz'), equals(['foo', 'bar', 'baz'])); | 183 expect(builder.split(r'foo\\bar\\\baz'), equals(['foo', 'bar', 'baz'])); |
181 expect(builder.split(r'foo\/\baz'), equals(['foo', 'baz'])); | 184 expect(builder.split(r'foo\/\baz'), equals(['foo', 'baz'])); |
182 expect(builder.split('.'), equals(['.'])); | 185 expect(builder.split('.'), equals(['.'])); |
183 expect(builder.split(''), equals([])); | 186 expect(builder.split(''), equals([])); |
184 expect(builder.split('foo/'), equals(['foo'])); | 187 expect(builder.split('foo/'), equals(['foo'])); |
185 expect(builder.split(r'C:\'), equals([r'C:\'])); | 188 expect(builder.split(r'C:\'), equals([r'C:\'])); |
186 }); | 189 }); |
187 | 190 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); | 386 expect(builder.withoutExtension(r'a\b\'), r'a\b\'); |
384 expect(builder.withoutExtension(r'a\.'), r'a\.'); | 387 expect(builder.withoutExtension(r'a\.'), r'a\.'); |
385 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); | 388 expect(builder.withoutExtension(r'a\.b'), r'a\.b'); |
386 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); | 389 expect(builder.withoutExtension(r'a.b\c'), r'a.b\c'); |
387 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); | 390 expect(builder.withoutExtension(r'a/b.c/d'), r'a/b.c/d'); |
388 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); | 391 expect(builder.withoutExtension(r'a\b/c'), r'a\b/c'); |
389 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); | 392 expect(builder.withoutExtension(r'a\b/c.d'), r'a\b/c'); |
390 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); | 393 expect(builder.withoutExtension(r'a.b/c'), r'a.b/c'); |
391 }); | 394 }); |
392 } | 395 } |
OLD | NEW |