| 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 uriTest; | 5 library uriTest; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 testUri(String uri, bool isAbsolute) { | 10 testUri(String uri, bool isAbsolute) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 uri = new Uri(scheme: "file", path: "y"); | 353 uri = new Uri(scheme: "file", path: "y"); |
| 354 Expect.equals("file:///y", uri.toString()); | 354 Expect.equals("file:///y", uri.toString()); |
| 355 | 355 |
| 356 // Empty host/query/fragment ensures the delimiter is there. | 356 // Empty host/query/fragment ensures the delimiter is there. |
| 357 // Different from not being there. | 357 // Different from not being there. |
| 358 Expect.equals("scheme:/", Uri.parse("scheme:/").toString()); | 358 Expect.equals("scheme:/", Uri.parse("scheme:/").toString()); |
| 359 Expect.equals("scheme:/", | 359 Expect.equals("scheme:/", |
| 360 new Uri(scheme: "scheme", path: "/").toString()); | 360 new Uri(scheme: "scheme", path: "/").toString()); |
| 361 | 361 |
| 362 Expect.equals("scheme:///?#", Uri.parse("scheme:///?#").toString()); | 362 Expect.equals("scheme:///?#", Uri.parse("scheme:///?#").toString()); |
| 363 Expect.equals("scheme:///?#", | 363 Expect.equals("scheme:///#", |
| 364 new Uri(scheme: "scheme", host: "", path: "/", | 364 new Uri(scheme: "scheme", host: "", path: "/", |
| 365 query: "", fragment: "").toString()); | 365 query: "", fragment: "").toString()); |
| 366 } | 366 } |
| 367 | 367 |
| 368 main() { | 368 main() { |
| 369 testUri("http:", true); | 369 testUri("http:", true); |
| 370 testUri("file://", true); | 370 testUri("file://", true); |
| 371 testUri("file", false); | 371 testUri("file", false); |
| 372 testUri("http://user@example.com:8080/fisk?query=89&hest=silas", true); | 372 testUri("http://user@example.com:8080/fisk?query=89&hest=silas", true); |
| 373 testUri("http://user@example.com:8080/fisk?query=89&hest=silas#fragment", | 373 testUri("http://user@example.com:8080/fisk?query=89&hest=silas#fragment", |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 String dump(Uri uri) { | 534 String dump(Uri uri) { |
| 535 return "URI: $uri\n" | 535 return "URI: $uri\n" |
| 536 " Scheme: ${uri.scheme} #${uri.scheme.length}\n" | 536 " Scheme: ${uri.scheme} #${uri.scheme.length}\n" |
| 537 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n" | 537 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n" |
| 538 " Host: ${uri.host} #${uri.host.length}\n" | 538 " Host: ${uri.host} #${uri.host.length}\n" |
| 539 " Port: ${uri.port}\n" | 539 " Port: ${uri.port}\n" |
| 540 " Path: ${uri.path} #${uri.path.length}\n" | 540 " Path: ${uri.path} #${uri.path.length}\n" |
| 541 " Query: ${uri.query} #${uri.query.length}\n" | 541 " Query: ${uri.query} #${uri.query.length}\n" |
| 542 " Fragment: ${uri.fragment} #${uri.fragment.length}\n"; | 542 " Fragment: ${uri.fragment} #${uri.fragment.length}\n"; |
| 543 } | 543 } |
| OLD | NEW |