Chromium Code Reviews| 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 // Test the Path class in dart:io. | 5 // Test the Path class in dart:io. |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 void testWindowsDrive() { | 316 void testWindowsDrive() { |
| 317 // Windows drive information only makes sense on Windows. | 317 // Windows drive information only makes sense on Windows. |
| 318 if (Platform.operatingSystem != 'windows') return; | 318 if (Platform.operatingSystem != 'windows') return; |
| 319 // Test that case of drive letters is ignored, and that drive letters | 319 // Test that case of drive letters is ignored, and that drive letters |
| 320 // are treated specially. | 320 // are treated specially. |
| 321 var CPath = new Path(r'C:\a\b\..\c'); | 321 var CPath = new Path(r'C:\a\b\..\c'); |
| 322 var cPath = new Path(r'c:\a\b\d'); | 322 var cPath = new Path(r'c:\a\b\d'); |
| 323 var C2Path = new Path(r'C:\a\b\d'); | 323 var C2Path = new Path(r'C:\a\b\d'); |
| 324 var C3Path = new Path(r'C:\a\b'); | 324 var C3Path = new Path(r'C:\a\b'); |
| 325 var C4Path = new Path(r'C:\'); | 325 var C4Path = new Path(r'C:\'); |
| 326 var c4Path = new Path(r'C:\'); | |
|
Søren Gjesse
2013/04/08 14:54:16
Shouldn't it be a lower case c here???
Anders Johnsen
2013/04/08 14:55:58
Hehe, oops :)
| |
| 326 var DPath = new Path(r'D:\a\b\d\e'); | 327 var DPath = new Path(r'D:\a\b\d\e'); |
| 327 var NoPath = new Path(r'\a\b\c\.'); | 328 var NoPath = new Path(r'\a\b\c\.'); |
| 328 | 329 |
| 329 Expect.throws(() => CPath.relativeTo(DPath)); | 330 Expect.throws(() => CPath.relativeTo(DPath)); |
| 330 Expect.throws(() => CPath.relativeTo(NoPath)); | 331 Expect.throws(() => CPath.relativeTo(NoPath)); |
| 331 Expect.throws(() => NoPath.relativeTo(CPath)); | 332 Expect.throws(() => NoPath.relativeTo(CPath)); |
| 332 Expect.equals('../../c', CPath.relativeTo(cPath).toString()); | 333 Expect.equals('../../c', CPath.relativeTo(cPath).toString()); |
| 333 Expect.equals('../b/d', cPath.relativeTo(CPath).toString()); | 334 Expect.equals('../b/d', cPath.relativeTo(CPath).toString()); |
| 334 Expect.equals('.', DPath.relativeTo(DPath).toString()); | 335 Expect.equals('.', DPath.relativeTo(DPath).toString()); |
| 335 Expect.equals('.', NoPath.relativeTo(NoPath).toString()); | 336 Expect.equals('.', NoPath.relativeTo(NoPath).toString()); |
| 336 Expect.equals('.', C2Path.relativeTo(cPath).toString()); | 337 Expect.equals('.', C2Path.relativeTo(cPath).toString()); |
| 337 Expect.equals('..', C3Path.relativeTo(cPath).toString()); | 338 Expect.equals('..', C3Path.relativeTo(cPath).toString()); |
| 338 Expect.equals('d', cPath.relativeTo(C3Path).toString()); | 339 Expect.equals('d', cPath.relativeTo(C3Path).toString()); |
| 339 Expect.equals('a/b/d', cPath.relativeTo(C4Path).toString()); | 340 Expect.equals('a/b/d', cPath.relativeTo(C4Path).toString()); |
| 340 Expect.equals('../../../', C4Path.relativeTo(cPath).toString()); | 341 Expect.equals('../../../', C4Path.relativeTo(cPath).toString()); |
| 342 Expect.equals('a/b', C3Path.relativeTo(c4Path).toString()); | |
| 341 } | 343 } |
| OLD | NEW |