Index: runtime/vm/unit_test.cc |
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc |
index 421bbdcabc4444d2d9d233ad169b270a9f9a4598..969452759a1ad5ac821be0634ea7a1ad61dd0c8d 100644 |
--- a/runtime/vm/unit_test.cc |
+++ b/runtime/vm/unit_test.cc |
@@ -282,4 +282,24 @@ bool CompilerTest::TestCompileFunction(const Function& function) { |
} |
+void ElideJSONSubstring(const char* prefix, const char* in, char* out) { |
+ const char* pos = strstr(in, prefix); |
+ while (pos != NULL) { |
+ // Copy up to pos into the output buffer. |
+ while (in < pos) { |
+ *out++ = *in++; |
+ } |
+ |
+ // Skip to the close quote. |
+ in += strcspn(in, "\""); |
+ pos = strstr(in, prefix); |
+ } |
+ // Copy the remainder of in to out. |
+ while (*in != '\0') { |
+ *out++ = *in++; |
+ } |
+ *out = '\0'; |
+} |
+ |
+ |
} // namespace dart |