| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 }); | 146 }); |
| 147 | 147 |
| 148 test('disallows intermediate nulls', () { | 148 test('disallows intermediate nulls', () { |
| 149 expect(() => builder.join('a', null, 'b'), throwsArgumentError); | 149 expect(() => builder.join('a', null, 'b'), throwsArgumentError); |
| 150 expect(() => builder.join(null, 'a'), throwsArgumentError); | 150 expect(() => builder.join(null, 'a'), throwsArgumentError); |
| 151 }); | 151 }); |
| 152 }); | 152 }); |
| 153 | 153 |
| 154 group('split', () { | 154 group('split', () { |
| 155 test('simple cases', () { | 155 test('simple cases', () { |
| 156 expect(builder.split(''), []); |
| 157 expect(builder.split('.'), ['.']); |
| 158 expect(builder.split('..'), ['..']); |
| 156 expect(builder.split('foo'), equals(['foo'])); | 159 expect(builder.split('foo'), equals(['foo'])); |
| 157 expect(builder.split('foo/bar'), equals(['foo', 'bar'])); | 160 expect(builder.split('foo/bar.txt'), equals(['foo', 'bar.txt'])); |
| 158 expect(builder.split('foo/bar/baz'), equals(['foo', 'bar', 'baz'])); | 161 expect(builder.split('foo/bar/baz'), equals(['foo', 'bar', 'baz'])); |
| 159 expect(builder.split('foo/../bar/./baz'), | 162 expect(builder.split('foo/../bar/./baz'), |
| 160 equals(['foo', '..', 'bar', '.', 'baz'])); | 163 equals(['foo', '..', 'bar', '.', 'baz'])); |
| 161 expect(builder.split('foo//bar///baz'), equals(['foo', 'bar', 'baz'])); | 164 expect(builder.split('foo//bar///baz'), equals(['foo', 'bar', 'baz'])); |
| 162 expect(builder.split('foo/\\/baz'), equals(['foo', '\\', 'baz'])); | 165 expect(builder.split('foo/\\/baz'), equals(['foo', '\\', 'baz'])); |
| 163 expect(builder.split('.'), equals(['.'])); | 166 expect(builder.split('.'), equals(['.'])); |
| 164 expect(builder.split(''), equals([])); | 167 expect(builder.split(''), equals([])); |
| 165 expect(builder.split('foo/'), equals(['foo'])); | 168 expect(builder.split('foo/'), equals(['foo'])); |
| 166 expect(builder.split('//'), equals(['/'])); | 169 expect(builder.split('//'), equals(['/'])); |
| 167 }); | 170 }); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 expect(builder.withoutExtension('a/'), 'a/'); | 352 expect(builder.withoutExtension('a/'), 'a/'); |
| 350 expect(builder.withoutExtension('a/b/'), 'a/b/'); | 353 expect(builder.withoutExtension('a/b/'), 'a/b/'); |
| 351 expect(builder.withoutExtension('a/.'), 'a/.'); | 354 expect(builder.withoutExtension('a/.'), 'a/.'); |
| 352 expect(builder.withoutExtension('a/.b'), 'a/.b'); | 355 expect(builder.withoutExtension('a/.b'), 'a/.b'); |
| 353 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); | 356 expect(builder.withoutExtension('a.b/c'), 'a.b/c'); |
| 354 expect(builder.withoutExtension(r'a.b\c'), r'a'); | 357 expect(builder.withoutExtension(r'a.b\c'), r'a'); |
| 355 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); | 358 expect(builder.withoutExtension(r'a/b\c'), r'a/b\c'); |
| 356 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); | 359 expect(builder.withoutExtension(r'a/b\c.d'), r'a/b\c'); |
| 357 }); | 360 }); |
| 358 } | 361 } |
| OLD | NEW |