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

Unified Diff: runtime/vm/object_test.cc

Issue 466813002: Support non-ASCII script URLs in VM service by using IRIs (generalized URIs). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 | « runtime/vm/object.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 39113)
+++ runtime/vm/object_test.cc (working copy)
@@ -401,7 +401,7 @@
}
-TEST_CASE(StringEncodeURI) {
+TEST_CASE(StringEncodeIRI) {
const char* kInput =
"file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
const char* kOutput =
@@ -409,12 +409,12 @@
"dart-repo%2Fdart%2Ftest.dart";
const String& input = String::Handle(String::New(kInput));
const String& output = String::Handle(String::New(kOutput));
- const String& encoded = String::Handle(String::EncodeURI(input));
+ const String& encoded = String::Handle(String::EncodeIRI(input));
EXPECT(output.Equals(encoded));
}
-TEST_CASE(StringDecodeURI) {
+TEST_CASE(StringDecodeIRI) {
const char* kOutput =
"file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
const char* kInput =
@@ -422,11 +422,26 @@
"dart-repo%2Fdart%2Ftest.dart";
const String& input = String::Handle(String::New(kInput));
const String& output = String::Handle(String::New(kOutput));
- const String& decoded = String::Handle(String::DecodeURI(input));
+ const String& decoded = String::Handle(String::DecodeIRI(input));
EXPECT(output.Equals(decoded));
}
+TEST_CASE(StringIRITwoByte) {
+ const intptr_t kInputLen = 3;
+ const uint16_t kInput[kInputLen] = { 'x', '/', 256 };
+ const String& input = String::Handle(String::FromUTF16(kInput, kInputLen));
+ const intptr_t kOutputLen = 10;
+ const uint16_t kOutput[kOutputLen] =
+ { 'x', '%', '2', 'F', '%', 'C', '4', '%', '8', '0' };
+ const String& output = String::Handle(String::FromUTF16(kOutput, kOutputLen));
+ const String& encoded = String::Handle(String::EncodeIRI(input));
+ EXPECT(output.Equals(encoded));
+ const String& decoded = String::Handle(String::DecodeIRI(output));
+ EXPECT(input.Equals(decoded));
+}
+
+
TEST_CASE(Mint) {
// On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot
// be allocated if it does fit into a Smi.
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698