| 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.windows_test; | 5 library path.test.windows_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 expect(builder.join('a', '/b', '/c', 'd'), r'a/b/c\d'); | 165 expect(builder.join('a', '/b', '/c', 'd'), r'a/b/c\d'); |
| 166 expect(builder.join('a', r'c:\b', 'c', 'd'), r'c:\b\c\d'); | 166 expect(builder.join('a', r'c:\b', 'c', 'd'), r'c:\b\c\d'); |
| 167 expect(builder.join('a', r'\\b', r'\\c', 'd'), r'\\c\d'); | 167 expect(builder.join('a', r'\\b', r'\\c', 'd'), r'\\c\d'); |
| 168 }); | 168 }); |
| 169 | 169 |
| 170 test('ignores trailing nulls', () { | 170 test('ignores trailing nulls', () { |
| 171 expect(builder.join('a', null), equals('a')); | 171 expect(builder.join('a', null), equals('a')); |
| 172 expect(builder.join('a', 'b', 'c', null, null), equals(r'a\b\c')); | 172 expect(builder.join('a', 'b', 'c', null, null), equals(r'a\b\c')); |
| 173 }); | 173 }); |
| 174 | 174 |
| 175 test('ignores empty strings', () { |
| 176 expect(builder.join(''), ''); |
| 177 expect(builder.join('', ''), ''); |
| 178 expect(builder.join('', 'a'), 'a'); |
| 179 expect(builder.join('a', '', 'b', '', '', '', 'c'), r'a\b\c'); |
| 180 expect(builder.join('a', 'b', ''), r'a\b'); |
| 181 }); |
| 182 |
| 175 test('disallows intermediate nulls', () { | 183 test('disallows intermediate nulls', () { |
| 176 expect(() => builder.join('a', null, 'b'), throwsArgumentError); | 184 expect(() => builder.join('a', null, 'b'), throwsArgumentError); |
| 177 expect(() => builder.join(null, 'a'), throwsArgumentError); | 185 expect(() => builder.join(null, 'a'), throwsArgumentError); |
| 178 }); | 186 }); |
| 179 }); | 187 }); |
| 180 | 188 |
| 181 group('joinAll', () { | 189 group('joinAll', () { |
| 182 test('allows more than eight parts', () { | 190 test('allows more than eight parts', () { |
| 183 expect(builder.joinAll(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']), | 191 expect(builder.joinAll(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']), |
| 184 r'a\b\c\d\e\f\g\h\i'); | 192 r'a\b\c\d\e\f\g\h\i'); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 Uri.parse('file:///C:/path/to/foo/')); | 477 Uri.parse('file:///C:/path/to/foo/')); |
| 470 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/')); | 478 expect(builder.toUri(r'C:\'), Uri.parse('file:///C:/')); |
| 471 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/')); | 479 expect(builder.toUri(r'\\hostname\'), Uri.parse('file://hostname/')); |
| 472 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar')); | 480 expect(builder.toUri(r'foo\bar'), Uri.parse('foo/bar')); |
| 473 expect(builder.toUri(r'C:\path\to\foo#bar'), | 481 expect(builder.toUri(r'C:\path\to\foo#bar'), |
| 474 Uri.parse('file:///C:/path/to/foo%23bar')); | 482 Uri.parse('file:///C:/path/to/foo%23bar')); |
| 475 expect(builder.toUri(r'\\hostname\path\to\foo#bar'), | 483 expect(builder.toUri(r'\\hostname\path\to\foo#bar'), |
| 476 Uri.parse('file://hostname/path/to/foo%23bar')); | 484 Uri.parse('file://hostname/path/to/foo%23bar')); |
| 477 }); | 485 }); |
| 478 } | 486 } |
| OLD | NEW |