Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "package:expect/expect.dart"; | |
| 6 import "dart:io"; | |
| 7 | |
| 8 main() { | |
| 9 if (Platform.isWindows) { | |
| 10 Expect.equals("a\\b", Uri.parse("a/b").toFilePath()); | |
| 11 Expect.equals("a\\b\\", Uri.parse("a/b/").toFilePath()); | |
| 12 Expect.equals("a b", Uri.parse("a%20b").toFilePath()); | |
| 13 Expect.equals("\\a b", Uri.parse("file:///a%20b").toFilePath()); | |
| 14 Expect.equals("\\a\\b", Uri.parse("file:///a/b").toFilePath()); | |
| 15 Expect.equals("C:\\", Uri.parse("file:///C:").toFilePath()); | |
| 16 Expect.equals("C:\\", Uri.parse("file:///C:/").toFilePath()); | |
| 17 Expect.equals("\\\\host\\a\\b", Uri.parse("file://host/a/b").toFilePath()); | |
| 18 | |
| 19 Expect.equals("a\\b", new Uri.file("a\\b").toFilePath()); | |
| 20 Expect.throws(() => new Uri.file("a/b"), | |
| 21 (e) => e is ArgumentError); | |
| 22 } else { | |
| 23 Expect.equals("a/b", Uri.parse("a/b").toFilePath()); | |
|
ahe
2013/07/29 15:30:16
Many of these should pass on Windows.
Søren Gjesse
2013/07/30 13:41:26
Added tests to Windows case.
| |
| 24 Expect.equals("a/b/", Uri.parse("a/b/").toFilePath()); | |
| 25 Expect.equals("a b", Uri.parse("a%20b").toFilePath()); | |
| 26 Expect.equals("/a b", Uri.parse("file:///a%20b").toFilePath()); | |
| 27 Expect.equals("/a/b", Uri.parse("file:///a/b").toFilePath()); | |
| 28 Expect.equals("/C:", Uri.parse("file:///C:").toFilePath()); | |
| 29 Expect.equals("/C:/", Uri.parse("file:///C:/").toFilePath()); | |
| 30 Expect.throws(() => Uri.parse("file://host/a/b").toFilePath(), | |
| 31 (e) => e is UnsupportedError); | |
| 32 | |
| 33 Expect.equals("a/b", new Uri.file("a/b").toFilePath()); | |
| 34 Expect.equals("a\\b", new Uri.file("a\\b").toFilePath()); | |
| 35 } | |
| 36 } | |
| OLD | NEW |