Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: tests/corelib/uri_test.dart

Issue 1396973004: Fix bug in Uri.removeFragment. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/uri_test.dart
diff --git a/tests/corelib/uri_test.dart b/tests/corelib/uri_test.dart
index 834cadc8409e5b19ae940e7f4ea1240992bc0acc..fd281c50574671bb613c49ed491ad1050f636c8b 100644
--- a/tests/corelib/uri_test.dart
+++ b/tests/corelib/uri_test.dart
@@ -7,13 +7,25 @@ library uriTest;
import "package:expect/expect.dart";
import 'dart:convert';
-testUri(String uri, bool isAbsolute) {
- Expect.equals(isAbsolute, Uri.parse(uri).isAbsolute);
- Expect.stringEquals(uri, Uri.parse(uri).toString());
+testUri(String uriText, bool isAbsolute) {
+ var uri = Uri.parse(uriText);
+
+ Expect.equals(isAbsolute, uri.isAbsolute);
+ Expect.stringEquals(uriText, uri.toString());
// Test equals and hashCode members.
- Expect.equals(Uri.parse(uri), Uri.parse(uri));
- Expect.equals(Uri.parse(uri).hashCode, Uri.parse(uri).hashCode);
+ var uri2 = Uri.parse(uriText);
+ Expect.equals(uri, uri2);
+ Expect.equals(uri.hashCode, uri2.hashCode);
+
+ // Test that removeFragment doesn't change anything else.
+ if (uri.hasFragment) {
+ Expect.equals(Uri.parse(uriText.substring(0, uriText.indexOf('#'))),
+ uri.removeFragment());
+ } else {
+ Expect.equals(uri,
+ Uri.parse(uriText + "#fragment").removeFragment());
+ }
}
testEncodeDecode(String orig, String encoded) {
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698