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

Unified Diff: runtime/vm/json_test.cc

Issue 1653183002: getObject now supports specifying offset,count for strings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/json_stream.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/json_test.cc
diff --git a/runtime/vm/json_test.cc b/runtime/vm/json_test.cc
index 245bdd681e201fe1cffeeb887245523853f54c01..985b547592b1428db3841ac11fd52a257de41264 100644
--- a/runtime/vm/json_test.cc
+++ b/runtime/vm/json_test.cc
@@ -236,9 +236,22 @@ TEST_CASE(JSON_JSONStream_DartString) {
JSONStream js;
{
JSONObject jsobj(&js);
- jsobj.AddPropertyStr("ascci", obj);;
+ EXPECT(!jsobj.AddPropertyStr("ascii", obj));
}
- EXPECT_STREQ("{\"ascci\":\"Hello, World!\"}", js.ToCString());
+ EXPECT_STREQ("{\"ascii\":\"Hello, World!\"}", js.ToCString());
+ }
+
+ {
+ result = Dart_GetField(lib, NewString("ascii"));
+ EXPECT_VALID(result);
+ obj ^= Api::UnwrapHandle(result);
+
+ JSONStream js;
+ {
+ JSONObject jsobj(&js);
+ EXPECT(jsobj.AddPropertyStr("subrange", obj, 1, 4));
+ }
+ EXPECT_STREQ("{\"subrange\":\"ello\"}", js.ToCString());
}
{
@@ -249,7 +262,7 @@ TEST_CASE(JSON_JSONStream_DartString) {
JSONStream js;
{
JSONObject jsobj(&js);
- jsobj.AddPropertyStr("unicode", obj);
+ EXPECT(!jsobj.AddPropertyStr("unicode", obj));
}
EXPECT_STREQ("{\"unicode\":\"\\u00CE\\u00F1\\u0163\\u00E9r\\u00F1\\u00E5"
"\\u0163\\u00EE\\u00F6\\u00F1\\u00E5\\u013C\\u00EE\\u017E"
@@ -264,7 +277,7 @@ TEST_CASE(JSON_JSONStream_DartString) {
JSONStream js;
{
JSONObject jsobj(&js);
- jsobj.AddPropertyStr("surrogates", obj);
+ EXPECT(!jsobj.AddPropertyStr("surrogates", obj));
}
EXPECT_STREQ("{\"surrogates\":\"\\uD834\\uDD1E\\uD834\\uDD1E\\uD834\\uDD1E"
"\\uD834\\uDD1E\\uD834\\uDD1E\"}", js.ToCString());
@@ -278,7 +291,7 @@ TEST_CASE(JSON_JSONStream_DartString) {
JSONStream js;
{
JSONObject jsobj(&js);
- jsobj.AddPropertyStr("nullInMiddle", obj);
+ EXPECT(!jsobj.AddPropertyStr("nullInMiddle", obj));
}
EXPECT_STREQ("{\"nullInMiddle\":\"This has\\u0000 four words.\"}",
js.ToCString());
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698