| 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 | 6 |
| 7 testFileUri() { | 7 testFileUri() { |
| 8 final unsupported = new UnsupportedError(""); | 8 final unsupported = new UnsupportedError(""); |
| 9 | 9 |
| 10 var tests = [ | 10 var tests = [ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ["file:///absolute", "/absolute", "\\absolute"], | 81 ["file:///absolute", "/absolute", "\\absolute"], |
| 82 ["file:///a/b", "/a/b", "\\a\\b"], | 82 ["file:///a/b", "/a/b", "\\a\\b"], |
| 83 ["file:///a/b", "/a/b", "\\a\\b"], | 83 ["file:///a/b", "/a/b", "\\a\\b"], |
| 84 | 84 |
| 85 ["file://server/a/b", "//server/a/b", "\\\\server\\a\\b"], | 85 ["file://server/a/b", "//server/a/b", "\\\\server\\a\\b"], |
| 86 ["file://server/a/b/", "//server/a/b/", "\\\\server\\a\\b\\"], | 86 ["file://server/a/b/", "//server/a/b/", "\\\\server\\a\\b\\"], |
| 87 | 87 |
| 88 ["file:///C:/", "C:/", "C:\\"], | 88 ["file:///C:/", "C:/", "C:\\"], |
| 89 ["file:///C:/a/b", "C:/a/b", "C:\\a\\b"], | 89 ["file:///C:/a/b", "C:/a/b", "C:\\a\\b"], |
| 90 ["file:///C:/a/b/", "C:/a/b/", "C:\\a\\b\\"], | 90 ["file:///C:/a/b/", "C:/a/b/", "C:\\a\\b\\"], |
| 91 |
| 92 ["file:///C:/xxx/yyy", "C:\\xxx\\yyy", "C:\\xxx\\yyy"], |
| 91 ]; | 93 ]; |
| 92 | 94 |
| 93 for (var test in tests) { | 95 for (var test in tests) { |
| 94 Uri uri = new Uri.file(test[1], windows: true); | 96 Uri uri = new Uri.file(test[1], windows: true); |
| 95 Expect.equals(test[0], uri.toString()); | 97 Expect.equals(test[0], uri.toString()); |
| 96 Expect.equals(test[2], uri.toFilePath(windows: true)); | 98 Expect.equals(test[2], uri.toFilePath(windows: true)); |
| 97 bool couldBeDir = uri.path.isEmpty || uri.path.endsWith('\\'); | 99 bool couldBeDir = uri.path.isEmpty || uri.path.endsWith('\\'); |
| 98 Uri dirUri = new Uri.directory(test[1], windows: true); | 100 Uri dirUri = new Uri.directory(test[1], windows: true); |
| 99 Expect.isTrue(dirUri.path.isEmpty || dirUri.path.endsWith('/')); | 101 Expect.isTrue(dirUri.path.isEmpty || dirUri.path.endsWith('/')); |
| 100 if (couldBeDir) { | 102 if (couldBeDir) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 main() { | 318 main() { |
| 317 testFileUri(); | 319 testFileUri(); |
| 318 testFileUriWindowsSlash(); | 320 testFileUriWindowsSlash(); |
| 319 testFileUriDriveLetter(); | 321 testFileUriDriveLetter(); |
| 320 testFileUriWindowsWin32Namespace(); | 322 testFileUriWindowsWin32Namespace(); |
| 321 testFileUriResolve(); | 323 testFileUriResolve(); |
| 322 testFileUriIllegalCharacters(); | 324 testFileUriIllegalCharacters(); |
| 323 testFileUriIllegalDriveLetter(); | 325 testFileUriIllegalDriveLetter(); |
| 324 testAdditionalComponents(); | 326 testAdditionalComponents(); |
| 325 } | 327 } |
| OLD | NEW |