| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/source_report.h" | 5 #include "vm/source_report.h" |
| 6 #include "vm/dart_api_impl.h" | 6 #include "vm/dart_api_impl.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 TEST_CASE(SourceReport_Coverage_NoCalls) { | 25 TEST_CASE(SourceReport_Coverage_NoCalls) { |
| 26 char buffer[1024]; | 26 char buffer[1024]; |
| 27 const char* kScript = | 27 const char* kScript = |
| 28 "main() {\n" | 28 "main() {\n" |
| 29 "}"; | 29 "}"; |
| 30 | 30 |
| 31 Library& lib = Library::Handle(); | 31 Library& lib = Library::Handle(); |
| 32 lib ^= ExecuteScript(kScript); | 32 lib ^= ExecuteScript(kScript); |
| 33 ASSERT(!lib.IsNull()); | 33 ASSERT(!lib.IsNull()); |
| 34 const Script& script = Script::Handle(lib.LookupScript( | 34 const Script& script = |
| 35 String::Handle(String::New("test-lib")))); | 35 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 36 | 36 |
| 37 SourceReport report(SourceReport::kCoverage); | 37 SourceReport report(SourceReport::kCoverage); |
| 38 JSONStream js; | 38 JSONStream js; |
| 39 report.PrintJSON(&js, script); | 39 report.PrintJSON(&js, script); |
| 40 ElideJSONSubstring("libraries", js.ToCString(), buffer); | 40 ElideJSONSubstring("libraries", js.ToCString(), buffer); |
| 41 EXPECT_STREQ( | 41 EXPECT_STREQ( |
| 42 "{\"type\":\"SourceReport\",\"ranges\":" | 42 "{\"type\":\"SourceReport\",\"ranges\":" |
| 43 | 43 |
| 44 // One compiled range, no hits or misses. | 44 // One compiled range, no hits or misses. |
| 45 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":5,\"compiled\":true," | 45 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":5,\"compiled\":true," |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 " if (true) {\n" | 61 " if (true) {\n" |
| 62 " helper0();\n" | 62 " helper0();\n" |
| 63 " } else {\n" | 63 " } else {\n" |
| 64 " helper1();\n" | 64 " helper1();\n" |
| 65 " }\n" | 65 " }\n" |
| 66 "}"; | 66 "}"; |
| 67 | 67 |
| 68 Library& lib = Library::Handle(); | 68 Library& lib = Library::Handle(); |
| 69 lib ^= ExecuteScript(kScript); | 69 lib ^= ExecuteScript(kScript); |
| 70 ASSERT(!lib.IsNull()); | 70 ASSERT(!lib.IsNull()); |
| 71 const Script& script = Script::Handle(lib.LookupScript( | 71 const Script& script = |
| 72 String::Handle(String::New("test-lib")))); | 72 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 73 | 73 |
| 74 SourceReport report(SourceReport::kCoverage); | 74 SourceReport report(SourceReport::kCoverage); |
| 75 JSONStream js; | 75 JSONStream js; |
| 76 report.PrintJSON(&js, script); | 76 report.PrintJSON(&js, script); |
| 77 ElideJSONSubstring("classes", js.ToCString(), buffer); | 77 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 78 ElideJSONSubstring("libraries", buffer, buffer); | 78 ElideJSONSubstring("libraries", buffer, buffer); |
| 79 EXPECT_STREQ( | 79 EXPECT_STREQ( |
| 80 "{\"type\":\"SourceReport\",\"ranges\":[" | 80 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 81 | 81 |
| 82 // One range compiled with no hits or misses (helper0). | 82 // One range compiled with no hits or misses (helper0). |
| (...skipping 23 matching lines...) Expand all Loading... |
| 106 " if (true) {\n" | 106 " if (true) {\n" |
| 107 " helper0();\n" | 107 " helper0();\n" |
| 108 " } else {\n" | 108 " } else {\n" |
| 109 " helper1();\n" | 109 " helper1();\n" |
| 110 " }\n" | 110 " }\n" |
| 111 "}"; | 111 "}"; |
| 112 | 112 |
| 113 Library& lib = Library::Handle(); | 113 Library& lib = Library::Handle(); |
| 114 lib ^= ExecuteScript(kScript); | 114 lib ^= ExecuteScript(kScript); |
| 115 ASSERT(!lib.IsNull()); | 115 ASSERT(!lib.IsNull()); |
| 116 const Script& script = Script::Handle(lib.LookupScript( | 116 const Script& script = |
| 117 String::Handle(String::New("test-lib")))); | 117 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 118 | 118 |
| 119 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); | 119 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); |
| 120 JSONStream js; | 120 JSONStream js; |
| 121 report.PrintJSON(&js, script); | 121 report.PrintJSON(&js, script); |
| 122 ElideJSONSubstring("classes", js.ToCString(), buffer); | 122 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 123 ElideJSONSubstring("libraries", buffer, buffer); | 123 ElideJSONSubstring("libraries", buffer, buffer); |
| 124 EXPECT_STREQ( | 124 EXPECT_STREQ( |
| 125 "{\"type\":\"SourceReport\",\"ranges\":[" | 125 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 126 | 126 |
| 127 // One range compiled with no hits or misses (helper0). | 127 // One range compiled with no hits or misses (helper0). |
| (...skipping 22 matching lines...) Expand all Loading... |
| 150 "class Unused {\n" | 150 "class Unused {\n" |
| 151 " helper1() { helper0(); }\n" | 151 " helper1() { helper0(); }\n" |
| 152 "}\n" | 152 "}\n" |
| 153 "main() {\n" | 153 "main() {\n" |
| 154 " helper0();\n" | 154 " helper0();\n" |
| 155 "}"; | 155 "}"; |
| 156 | 156 |
| 157 Library& lib = Library::Handle(); | 157 Library& lib = Library::Handle(); |
| 158 lib ^= ExecuteScript(kScript); | 158 lib ^= ExecuteScript(kScript); |
| 159 ASSERT(!lib.IsNull()); | 159 ASSERT(!lib.IsNull()); |
| 160 const Script& script = Script::Handle(lib.LookupScript( | 160 const Script& script = |
| 161 String::Handle(String::New("test-lib")))); | 161 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 162 | 162 |
| 163 SourceReport report(SourceReport::kCoverage); | 163 SourceReport report(SourceReport::kCoverage); |
| 164 JSONStream js; | 164 JSONStream js; |
| 165 report.PrintJSON(&js, script); | 165 report.PrintJSON(&js, script); |
| 166 ElideJSONSubstring("classes", js.ToCString(), buffer); | 166 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 167 ElideJSONSubstring("libraries", buffer, buffer); | 167 ElideJSONSubstring("libraries", buffer, buffer); |
| 168 EXPECT_STREQ( | 168 EXPECT_STREQ( |
| 169 "{\"type\":\"SourceReport\",\"ranges\":[" | 169 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 170 | 170 |
| 171 // UnusedClass is not compiled. | 171 // UnusedClass is not compiled. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 193 "class Unused {\n" | 193 "class Unused {\n" |
| 194 " helper1() { helper0(); }\n" | 194 " helper1() { helper0(); }\n" |
| 195 "}\n" | 195 "}\n" |
| 196 "main() {\n" | 196 "main() {\n" |
| 197 " helper0();\n" | 197 " helper0();\n" |
| 198 "}"; | 198 "}"; |
| 199 | 199 |
| 200 Library& lib = Library::Handle(); | 200 Library& lib = Library::Handle(); |
| 201 lib ^= ExecuteScript(kScript); | 201 lib ^= ExecuteScript(kScript); |
| 202 ASSERT(!lib.IsNull()); | 202 ASSERT(!lib.IsNull()); |
| 203 const Script& script = Script::Handle(lib.LookupScript( | 203 const Script& script = |
| 204 String::Handle(String::New("test-lib")))); | 204 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 205 | 205 |
| 206 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); | 206 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); |
| 207 JSONStream js; | 207 JSONStream js; |
| 208 report.PrintJSON(&js, script); | 208 report.PrintJSON(&js, script); |
| 209 ElideJSONSubstring("classes", js.ToCString(), buffer); | 209 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 210 ElideJSONSubstring("libraries", buffer, buffer); | 210 ElideJSONSubstring("libraries", buffer, buffer); |
| 211 EXPECT_STREQ( | 211 EXPECT_STREQ( |
| 212 "{\"type\":\"SourceReport\",\"ranges\":[" | 212 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 213 | 213 |
| 214 // UnusedClass.helper1 is compiled. | 214 // UnusedClass.helper1 is compiled. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 237 "class Unused {\n" | 237 "class Unused {\n" |
| 238 " helper1() { helper0()+ }\n" // syntax error | 238 " helper1() { helper0()+ }\n" // syntax error |
| 239 "}\n" | 239 "}\n" |
| 240 "main() {\n" | 240 "main() {\n" |
| 241 " helper0();\n" | 241 " helper0();\n" |
| 242 "}"; | 242 "}"; |
| 243 | 243 |
| 244 Library& lib = Library::Handle(); | 244 Library& lib = Library::Handle(); |
| 245 lib ^= ExecuteScript(kScript); | 245 lib ^= ExecuteScript(kScript); |
| 246 ASSERT(!lib.IsNull()); | 246 ASSERT(!lib.IsNull()); |
| 247 const Script& script = Script::Handle(lib.LookupScript( | 247 const Script& script = |
| 248 String::Handle(String::New("test-lib")))); | 248 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 249 | 249 |
| 250 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); | 250 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile); |
| 251 JSONStream js; | 251 JSONStream js; |
| 252 report.PrintJSON(&js, script); | 252 report.PrintJSON(&js, script); |
| 253 ElideJSONSubstring("classes", js.ToCString(), buffer); | 253 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 254 ElideJSONSubstring("libraries", buffer, buffer); | 254 ElideJSONSubstring("libraries", buffer, buffer); |
| 255 EXPECT_STREQ( | 255 EXPECT_STREQ( |
| 256 "{\"type\":\"SourceReport\",\"ranges\":[" | 256 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 257 | 257 |
| 258 // UnusedClass has a syntax error. | 258 // UnusedClass has a syntax error. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 " if (true) {\n" | 290 " if (true) {\n" |
| 291 " helper0();\n" | 291 " helper0();\n" |
| 292 " } else {\n" | 292 " } else {\n" |
| 293 " helper1();\n" | 293 " helper1();\n" |
| 294 " }\n" | 294 " }\n" |
| 295 "}"; | 295 "}"; |
| 296 | 296 |
| 297 Library& lib = Library::Handle(); | 297 Library& lib = Library::Handle(); |
| 298 lib ^= ExecuteScript(kScript); | 298 lib ^= ExecuteScript(kScript); |
| 299 ASSERT(!lib.IsNull()); | 299 ASSERT(!lib.IsNull()); |
| 300 const Script& script = Script::Handle(lib.LookupScript( | 300 const Script& script = |
| 301 String::Handle(String::New("test-lib")))); | 301 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 302 | 302 |
| 303 SourceReport report(SourceReport::kCoverage); | 303 SourceReport report(SourceReport::kCoverage); |
| 304 JSONStream js; | 304 JSONStream js; |
| 305 report.PrintJSON(&js, script); | 305 report.PrintJSON(&js, script); |
| 306 ElideJSONSubstring("classes", js.ToCString(), buffer); | 306 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 307 ElideJSONSubstring("libraries", buffer, buffer); | 307 ElideJSONSubstring("libraries", buffer, buffer); |
| 308 EXPECT_STREQ( | 308 EXPECT_STREQ( |
| 309 "{\"type\":\"SourceReport\",\"ranges\":[" | 309 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 310 | 310 |
| 311 // One range compiled with one hit (helper0). | 311 // One range compiled with one hit (helper0). |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 " if (true) {\n" | 346 " if (true) {\n" |
| 347 " helper0();\n" | 347 " helper0();\n" |
| 348 " } else {\n" | 348 " } else {\n" |
| 349 " helper1();\n" | 349 " helper1();\n" |
| 350 " }\n" | 350 " }\n" |
| 351 "}"; | 351 "}"; |
| 352 | 352 |
| 353 Library& lib = Library::Handle(); | 353 Library& lib = Library::Handle(); |
| 354 lib ^= ExecuteScript(kScript); | 354 lib ^= ExecuteScript(kScript); |
| 355 ASSERT(!lib.IsNull()); | 355 ASSERT(!lib.IsNull()); |
| 356 const Script& script = Script::Handle(lib.LookupScript( | 356 const Script& script = |
| 357 String::Handle(String::New("test-lib")))); | 357 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 358 const Function& helper = Function::Handle( | 358 const Function& helper = Function::Handle( |
| 359 lib.LookupLocalFunction(String::Handle(String::New("helper0")))); | 359 lib.LookupLocalFunction(String::Handle(String::New("helper0")))); |
| 360 | 360 |
| 361 SourceReport report(SourceReport::kCoverage); | 361 SourceReport report(SourceReport::kCoverage); |
| 362 JSONStream js; | 362 JSONStream js; |
| 363 // Restrict the report to only helper0 and it's nested functions. | 363 // Restrict the report to only helper0 and it's nested functions. |
| 364 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos()); | 364 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos()); |
| 365 ElideJSONSubstring("classes", js.ToCString(), buffer); | 365 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 366 ElideJSONSubstring("libraries", buffer, buffer); | 366 ElideJSONSubstring("libraries", buffer, buffer); |
| 367 EXPECT_STREQ( | 367 EXPECT_STREQ( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 const char* kScript = | 473 const char* kScript = |
| 474 "helper0() {}\n" | 474 "helper0() {}\n" |
| 475 "helper1() {}\n" | 475 "helper1() {}\n" |
| 476 "main() {\n" | 476 "main() {\n" |
| 477 " helper0();\n" | 477 " helper0();\n" |
| 478 "}"; | 478 "}"; |
| 479 | 479 |
| 480 Library& lib = Library::Handle(); | 480 Library& lib = Library::Handle(); |
| 481 lib ^= ExecuteScript(kScript); | 481 lib ^= ExecuteScript(kScript); |
| 482 ASSERT(!lib.IsNull()); | 482 ASSERT(!lib.IsNull()); |
| 483 const Script& script = Script::Handle(lib.LookupScript( | 483 const Script& script = |
| 484 String::Handle(String::New("test-lib")))); | 484 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 485 | 485 |
| 486 SourceReport report(SourceReport::kCallSites); | 486 SourceReport report(SourceReport::kCallSites); |
| 487 JSONStream js; | 487 JSONStream js; |
| 488 report.PrintJSON(&js, script); | 488 report.PrintJSON(&js, script); |
| 489 ElideJSONSubstring("classes", js.ToCString(), buffer); | 489 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 490 ElideJSONSubstring("libraries", buffer, buffer); | 490 ElideJSONSubstring("libraries", buffer, buffer); |
| 491 EXPECT_STREQ( | 491 EXPECT_STREQ( |
| 492 "{\"type\":\"SourceReport\",\"ranges\":[" | 492 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 493 | 493 |
| 494 // One range compiled with no callsites (helper0). | 494 // One range compiled with no callsites (helper0). |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 " Common common = new Common();\n" | 530 " Common common = new Common();\n" |
| 531 " Uncommon uncommon = new Uncommon();\n" | 531 " Uncommon uncommon = new Uncommon();\n" |
| 532 " helper(common);\n" | 532 " helper(common);\n" |
| 533 " helper(common);\n" | 533 " helper(common);\n" |
| 534 " helper(uncommon);\n" | 534 " helper(uncommon);\n" |
| 535 "}"; | 535 "}"; |
| 536 | 536 |
| 537 Library& lib = Library::Handle(); | 537 Library& lib = Library::Handle(); |
| 538 lib ^= ExecuteScript(kScript); | 538 lib ^= ExecuteScript(kScript); |
| 539 ASSERT(!lib.IsNull()); | 539 ASSERT(!lib.IsNull()); |
| 540 const Script& script = Script::Handle(lib.LookupScript( | 540 const Script& script = |
| 541 String::Handle(String::New("test-lib")))); | 541 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 542 const Function& helper = Function::Handle( | 542 const Function& helper = Function::Handle( |
| 543 lib.LookupLocalFunction(String::Handle(String::New("helper")))); | 543 lib.LookupLocalFunction(String::Handle(String::New("helper")))); |
| 544 | 544 |
| 545 SourceReport report(SourceReport::kCallSites); | 545 SourceReport report(SourceReport::kCallSites); |
| 546 JSONStream js; | 546 JSONStream js; |
| 547 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos()); | 547 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos()); |
| 548 ElideJSONSubstring("classes", js.ToCString(), buffer); | 548 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 549 ElideJSONSubstring("libraries", buffer, buffer); | 549 ElideJSONSubstring("libraries", buffer, buffer); |
| 550 EXPECT_STREQ( | 550 EXPECT_STREQ( |
| 551 "{\"type\":\"SourceReport\",\"ranges\":[" | 551 "{\"type\":\"SourceReport\",\"ranges\":[" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 const char* kScript = | 594 const char* kScript = |
| 595 "helper0() {}\n" | 595 "helper0() {}\n" |
| 596 "helper1() {}\n" | 596 "helper1() {}\n" |
| 597 "main() {\n" | 597 "main() {\n" |
| 598 " helper0();\n" | 598 " helper0();\n" |
| 599 "}"; | 599 "}"; |
| 600 | 600 |
| 601 Library& lib = Library::Handle(); | 601 Library& lib = Library::Handle(); |
| 602 lib ^= ExecuteScript(kScript); | 602 lib ^= ExecuteScript(kScript); |
| 603 ASSERT(!lib.IsNull()); | 603 ASSERT(!lib.IsNull()); |
| 604 const Script& script = Script::Handle(lib.LookupScript( | 604 const Script& script = |
| 605 String::Handle(String::New("test-lib")))); | 605 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 606 | 606 |
| 607 SourceReport report(SourceReport::kCallSites|SourceReport::kCoverage); | 607 SourceReport report(SourceReport::kCallSites | SourceReport::kCoverage); |
| 608 JSONStream js; | 608 JSONStream js; |
| 609 report.PrintJSON(&js, script); | 609 report.PrintJSON(&js, script); |
| 610 ElideJSONSubstring("classes", js.ToCString(), buffer); | 610 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 611 ElideJSONSubstring("libraries", buffer, buffer); | 611 ElideJSONSubstring("libraries", buffer, buffer); |
| 612 EXPECT_STREQ( | 612 EXPECT_STREQ( |
| 613 "{\"type\":\"SourceReport\",\"ranges\":[" | 613 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 614 | 614 |
| 615 // One range compiled with no callsites (helper0). | 615 // One range compiled with no callsites (helper0). |
| 616 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":4,\"compiled\":true," | 616 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":4,\"compiled\":true," |
| 617 "\"callSites\":[]," | 617 "\"callSites\":[]," |
| (...skipping 29 matching lines...) Expand all Loading... |
| 647 " if (true) {\n" | 647 " if (true) {\n" |
| 648 " helper0();\n" | 648 " helper0();\n" |
| 649 " } else {\n" | 649 " } else {\n" |
| 650 " helper1();\n" | 650 " helper1();\n" |
| 651 " }\n" | 651 " }\n" |
| 652 "}"; | 652 "}"; |
| 653 | 653 |
| 654 Library& lib = Library::Handle(); | 654 Library& lib = Library::Handle(); |
| 655 lib ^= ExecuteScript(kScript); | 655 lib ^= ExecuteScript(kScript); |
| 656 ASSERT(!lib.IsNull()); | 656 ASSERT(!lib.IsNull()); |
| 657 const Script& script = Script::Handle(lib.LookupScript( | 657 const Script& script = |
| 658 String::Handle(String::New("test-lib")))); | 658 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 659 | 659 |
| 660 SourceReport report(SourceReport::kPossibleBreakpoints); | 660 SourceReport report(SourceReport::kPossibleBreakpoints); |
| 661 JSONStream js; | 661 JSONStream js; |
| 662 report.PrintJSON(&js, script); | 662 report.PrintJSON(&js, script); |
| 663 ElideJSONSubstring("classes", js.ToCString(), buffer); | 663 ElideJSONSubstring("classes", js.ToCString(), buffer); |
| 664 ElideJSONSubstring("libraries", buffer, buffer); | 664 ElideJSONSubstring("libraries", buffer, buffer); |
| 665 EXPECT_STREQ( | 665 EXPECT_STREQ( |
| 666 "{\"type\":\"SourceReport\",\"ranges\":[" | 666 "{\"type\":\"SourceReport\",\"ranges\":[" |
| 667 | 667 |
| 668 // helper0. | 668 // helper0. |
| 669 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":4,\"compiled\":true," | 669 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":4,\"compiled\":true," |
| 670 "\"possibleBreakpoints\":[1,4]}," | 670 "\"possibleBreakpoints\":[1,4]}," |
| 671 | 671 |
| 672 // One range not compiled (helper1). | 672 // One range not compiled (helper1). |
| 673 "{\"scriptIndex\":0,\"startPos\":6,\"endPos\":10,\"compiled\":false}," | 673 "{\"scriptIndex\":0,\"startPos\":6,\"endPos\":10,\"compiled\":false}," |
| 674 | 674 |
| 675 // main. | 675 // main. |
| 676 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," | 676 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," |
| 677 "\"possibleBreakpoints\":[13,23,32,39]}]," | 677 "\"possibleBreakpoints\":[13,23,32,39]}]," |
| 678 | 678 |
| 679 // Only one script in the script table. | 679 // Only one script in the script table. |
| 680 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 680 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 681 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 681 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 682 buffer); | 682 buffer); |
| 683 } | 683 } |
| 684 | 684 |
| 685 #endif // !PRODUCT | 685 #endif // !PRODUCT |
| 686 | 686 |
| 687 } // namespace dart | 687 } // namespace dart |
| OLD | NEW |