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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 test(); | 418 test(); |
419 } | 419 } |
420 | 420 |
421 if (uri2.hasFragment) { | 421 if (uri2.hasFragment) { |
422 fragment = uri2.fragment; | 422 fragment = uri2.fragment; |
423 tmp1 = tmp1.replace(fragment: fragment); | 423 tmp1 = tmp1.replace(fragment: fragment); |
424 test(); | 424 test(); |
425 } | 425 } |
426 } | 426 } |
427 } | 427 } |
| 428 |
| 429 // Regression test, http://dartbug.com/20814 |
| 430 var uri = Uri.parse("/no-authorty/"); |
| 431 uri = uri.replace(fragment: "fragment"); |
| 432 Expect.isFalse(uri.hasAuthority); |
428 } | 433 } |
429 | 434 |
430 main() { | 435 main() { |
431 testUri("http:", true); | 436 testUri("http:", true); |
432 testUri("file:///", true); | 437 testUri("file:///", true); |
433 testUri("file", false); | 438 testUri("file", false); |
434 testUri("http://user@example.com:8080/fisk?query=89&hest=silas", true); | 439 testUri("http://user@example.com:8080/fisk?query=89&hest=silas", true); |
435 testUri("http://user@example.com:8080/fisk?query=89&hest=silas#fragment", | 440 testUri("http://user@example.com:8080/fisk?query=89&hest=silas#fragment", |
436 false); | 441 false); |
437 Expect.stringEquals("http://user@example.com/a/b/c?query#fragment", | 442 Expect.stringEquals("http://user@example.com/a/b/c?query#fragment", |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 String dump(Uri uri) { | 602 String dump(Uri uri) { |
598 return "URI: $uri\n" | 603 return "URI: $uri\n" |
599 " Scheme: ${uri.scheme} #${uri.scheme.length}\n" | 604 " Scheme: ${uri.scheme} #${uri.scheme.length}\n" |
600 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n" | 605 " User-info: ${uri.userInfo} #${uri.userInfo.length}\n" |
601 " Host: ${uri.host} #${uri.host.length}\n" | 606 " Host: ${uri.host} #${uri.host.length}\n" |
602 " Port: ${uri.port}\n" | 607 " Port: ${uri.port}\n" |
603 " Path: ${uri.path} #${uri.path.length}\n" | 608 " Path: ${uri.path} #${uri.path.length}\n" |
604 " Query: ${uri.query} #${uri.query.length}\n" | 609 " Query: ${uri.query} #${uri.query.length}\n" |
605 " Fragment: ${uri.fragment} #${uri.fragment.length}\n"; | 610 " Fragment: ${uri.fragment} #${uri.fragment.length}\n"; |
606 } | 611 } |
OLD | NEW |