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

Unified Diff: runtime/vm/source_report_test.cc

Issue 1586253002: Add PossibleBreakpoints source reporting. (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/source_report.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/source_report_test.cc
diff --git a/runtime/vm/source_report_test.cc b/runtime/vm/source_report_test.cc
index 0e1bb7984ff73eb34eeca1bedbbdbb2f1e4e7d59..b213a20311406ac4ae9ac50ce016d0c6f03ee953 100644
--- a/runtime/vm/source_report_test.cc
+++ b/runtime/vm/source_report_test.cc
@@ -458,4 +458,49 @@ TEST_CASE(SourceReport_MultipleReports) {
buffer);
}
+
+TEST_CASE(SourceReport_PossibleBreakpoints_Simple) {
+ char buffer[1024];
+ const char* kScript =
+ "helper0() {}\n"
+ "helper1() {}\n"
+ "main() {\n"
+ " if (true) {\n"
+ " helper0();\n"
+ " } else {\n"
+ " helper1();\n"
+ " }\n"
+ "}";
+
+ Library& lib = Library::Handle();
+ lib ^= ExecuteScript(kScript);
+ ASSERT(!lib.IsNull());
+ const Script& script = Script::Handle(lib.LookupScript(
+ String::Handle(String::New("test-lib"))));
+
+ SourceReport report(SourceReport::kPossibleBreakpoints);
+ JSONStream js;
+ report.PrintJSON(&js, script);
+ ElideJSONSubstring("classes", js.ToCString(), buffer);
+ ElideJSONSubstring("libraries", buffer, buffer);
+ EXPECT_STREQ(
+ "{\"type\":\"SourceReport\",\"ranges\":["
+
+ // helper0.
+ "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":4,\"compiled\":true,"
+ "\"possibleBreakpoints\":[1,4]},"
+
+ // One range not compiled (helper1).
+ "{\"scriptIndex\":0,\"startPos\":6,\"endPos\":10,\"compiled\":false},"
+
+ // main.
+ "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true,"
+ "\"possibleBreakpoints\":[13,23,32,39]}],"
+
+ // Only one script in the script table.
+ "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
+ "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}",
+ buffer);
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/source_report.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698