Index: runtime/vm/json_test.cc |
diff --git a/runtime/vm/json_test.cc b/runtime/vm/json_test.cc |
index 7c5b49f81a149483cbccde503cf832ef7b39f1ec..e8c4f5d959a52812890373d21543ee83526858fe 100644 |
--- a/runtime/vm/json_test.cc |
+++ b/runtime/vm/json_test.cc |
@@ -315,6 +315,33 @@ TEST_CASE(JSON_JSONStream_Params) { |
EXPECT(!js.ParamIs("dog", "banana")); |
} |
+ |
+TEST_CASE(JSON_JSONStream_AppendJSONStreamConsumer) { |
+ JSONStream js; |
+ |
+ { |
+ JSONObject obj(&js); |
+ { |
+ JSONArray arr(&obj, "test"); |
+ const char* test_data = "{a, b, c},"; |
+ AppendJSONStreamConsumer(Dart_StreamConsumer_kData, "", |
+ reinterpret_cast<const uint8_t*>(&test_data[0]), |
+ strlen(test_data), |
+ &js); |
+ AppendJSONStreamConsumer(Dart_StreamConsumer_kData, "", |
+ reinterpret_cast<const uint8_t*>(&test_data[0]), |
+ strlen(test_data), |
+ &js); |
+ AppendJSONStreamConsumer(Dart_StreamConsumer_kData, "", |
+ reinterpret_cast<const uint8_t*>(&test_data[0]), |
+ strlen(test_data) - 1, |
+ &js); |
+ } |
+ } |
+ |
+ EXPECT_STREQ("{\"test\":[{a, b, c},{a, b, c},{a, b, c}]}", js.ToCString()); |
+} |
+ |
#endif // !PRODUCT |
} // namespace dart |