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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
|
Anders Johnsen
2013/10/24 08:30:08
remove io import, and enable for dart2js.
Bill Hesse
2013/10/24 13:43:43
Done.
| |
| 7 import "dart:platform" as platform; | |
| 7 | 8 |
| 8 main() { | 9 main() { |
| 9 if (Platform.isWindows) { | 10 if (platform.isWindows) { |
| 10 Expect.equals("a\\b", Uri.parse("a/b").toFilePath()); | 11 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/b/").toFilePath()); |
| 12 Expect.equals("a b", Uri.parse("a%20b").toFilePath()); | 13 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%20b").toFilePath()); |
| 14 Expect.equals("\\a\\b", Uri.parse("file:///a/b").toFilePath()); | 15 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()); |
| 16 Expect.equals("C:\\", Uri.parse("file:///C:/").toFilePath()); | 17 Expect.equals("C:\\", Uri.parse("file:///C:/").toFilePath()); |
| 17 Expect.equals("\\\\host\\a\\b", Uri.parse("file://host/a/b").toFilePath()); | 18 Expect.equals("\\\\host\\a\\b", Uri.parse("file://host/a/b").toFilePath()); |
| 18 | 19 |
| 19 Expect.equals("a\\b", new Uri.file("a/b").toFilePath()); | 20 Expect.equals("a\\b", new Uri.file("a/b").toFilePath()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 31 Expect.equals("/C:", Uri.parse("file:///C:").toFilePath()); | 32 Expect.equals("/C:", Uri.parse("file:///C:").toFilePath()); |
| 32 Expect.equals("/C:/", Uri.parse("file:///C:/").toFilePath()); | 33 Expect.equals("/C:/", Uri.parse("file:///C:/").toFilePath()); |
| 33 Expect.throws(() => Uri.parse("file://host/a/b").toFilePath(), | 34 Expect.throws(() => Uri.parse("file://host/a/b").toFilePath(), |
| 34 (e) => e is UnsupportedError); | 35 (e) => e is UnsupportedError); |
| 35 | 36 |
| 36 Expect.equals("a/b", new Uri.file("a/b").toFilePath()); | 37 Expect.equals("a/b", new Uri.file("a/b").toFilePath()); |
| 37 Expect.equals("a\\b", new Uri.file("a\\b").toFilePath()); | 38 Expect.equals("a\\b", new Uri.file("a\\b").toFilePath()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 Expect.equals(Uri.base, | 41 Expect.equals(Uri.base, |
| 41 new Uri.file(Directory.current.path + Platform.pathSeparator)); | 42 new Uri.file(Directory.current.path + platform.pathSeparator)); |
| 42 } | 43 } |
| OLD | NEW |