| 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 |
| 11 #ifndef PRODUCT | 11 #ifndef PRODUCT |
| 12 | 12 |
| 13 static RawObject* ExecuteScript(const char* script) { | 13 static RawObject* ExecuteScript(const char* script) { |
| 14 Dart_Handle h_lib = TestCase::LoadTestScript(script, NULL); | 14 Dart_Handle h_lib = TestCase::LoadTestScript(script, NULL); |
| 15 EXPECT_VALID(h_lib); | 15 EXPECT_VALID(h_lib); |
| 16 Library& lib = Library::Handle(); | 16 Library& lib = Library::Handle(); |
| 17 lib ^= Api::UnwrapHandle(h_lib); | 17 lib ^= Api::UnwrapHandle(h_lib); |
| 18 EXPECT(!lib.IsNull()); | 18 EXPECT(!lib.IsNull()); |
| 19 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); | 19 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 20 EXPECT_VALID(result); | 20 EXPECT_VALID(result); |
| 21 return Api::UnwrapHandle(h_lib); | 21 return Api::UnwrapHandle(h_lib); |
| 22 } | 22 } |
| 23 | 23 |
| 24 | |
| 25 TEST_CASE(SourceReport_Coverage_NoCalls) { | 24 TEST_CASE(SourceReport_Coverage_NoCalls) { |
| 26 char buffer[1024]; | 25 char buffer[1024]; |
| 27 const char* kScript = | 26 const char* kScript = |
| 28 "main() {\n" | 27 "main() {\n" |
| 29 "}"; | 28 "}"; |
| 30 | 29 |
| 31 Library& lib = Library::Handle(); | 30 Library& lib = Library::Handle(); |
| 32 lib ^= ExecuteScript(kScript); | 31 lib ^= ExecuteScript(kScript); |
| 33 ASSERT(!lib.IsNull()); | 32 ASSERT(!lib.IsNull()); |
| 34 const Script& script = | 33 const Script& script = |
| 35 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); | 34 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib")))); |
| 36 | 35 |
| 37 SourceReport report(SourceReport::kCoverage); | 36 SourceReport report(SourceReport::kCoverage); |
| 38 JSONStream js; | 37 JSONStream js; |
| 39 report.PrintJSON(&js, script); | 38 report.PrintJSON(&js, script); |
| 40 ElideJSONSubstring("libraries", js.ToCString(), buffer); | 39 ElideJSONSubstring("libraries", js.ToCString(), buffer); |
| 41 EXPECT_STREQ( | 40 EXPECT_STREQ( |
| 42 "{\"type\":\"SourceReport\",\"ranges\":" | 41 "{\"type\":\"SourceReport\",\"ranges\":" |
| 43 | 42 |
| 44 // One compiled range, no hits or misses. | 43 // One compiled range, no hits or misses. |
| 45 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":5,\"compiled\":true," | 44 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":5,\"compiled\":true," |
| 46 "\"coverage\":{\"hits\":[],\"misses\":[]}}]," | 45 "\"coverage\":{\"hits\":[],\"misses\":[]}}]," |
| 47 | 46 |
| 48 // One script in the script table. | 47 // One script in the script table. |
| 49 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 48 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 50 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 49 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 51 buffer); | 50 buffer); |
| 52 } | 51 } |
| 53 | 52 |
| 54 | |
| 55 TEST_CASE(SourceReport_Coverage_SimpleCall) { | 53 TEST_CASE(SourceReport_Coverage_SimpleCall) { |
| 56 char buffer[1024]; | 54 char buffer[1024]; |
| 57 const char* kScript = | 55 const char* kScript = |
| 58 "helper0() {}\n" | 56 "helper0() {}\n" |
| 59 "helper1() {}\n" | 57 "helper1() {}\n" |
| 60 "main() {\n" | 58 "main() {\n" |
| 61 " if (true) {\n" | 59 " if (true) {\n" |
| 62 " helper0();\n" | 60 " helper0();\n" |
| 63 " } else {\n" | 61 " } else {\n" |
| 64 " helper1();\n" | 62 " helper1();\n" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 89 // One range with a hit and a miss (main). | 87 // One range with a hit and a miss (main). |
| 90 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," | 88 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," |
| 91 "\"coverage\":{\"hits\":[23],\"misses\":[32]}}]," | 89 "\"coverage\":{\"hits\":[23],\"misses\":[32]}}]," |
| 92 | 90 |
| 93 // Only one script in the script table. | 91 // Only one script in the script table. |
| 94 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 92 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 95 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 93 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 96 buffer); | 94 buffer); |
| 97 } | 95 } |
| 98 | 96 |
| 99 | |
| 100 TEST_CASE(SourceReport_Coverage_ForceCompile) { | 97 TEST_CASE(SourceReport_Coverage_ForceCompile) { |
| 101 char buffer[1024]; | 98 char buffer[1024]; |
| 102 const char* kScript = | 99 const char* kScript = |
| 103 "helper0() {}\n" | 100 "helper0() {}\n" |
| 104 "helper1() {}\n" | 101 "helper1() {}\n" |
| 105 "main() {\n" | 102 "main() {\n" |
| 106 " if (true) {\n" | 103 " if (true) {\n" |
| 107 " helper0();\n" | 104 " helper0();\n" |
| 108 " } else {\n" | 105 " } else {\n" |
| 109 " helper1();\n" | 106 " helper1();\n" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 135 // One range with a hit and a miss (main). | 132 // One range with a hit and a miss (main). |
| 136 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," | 133 "{\"scriptIndex\":0,\"startPos\":12,\"endPos\":39,\"compiled\":true," |
| 137 "\"coverage\":{\"hits\":[23],\"misses\":[32]}}]," | 134 "\"coverage\":{\"hits\":[23],\"misses\":[32]}}]," |
| 138 | 135 |
| 139 // Only one script in the script table. | 136 // Only one script in the script table. |
| 140 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 137 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 141 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 138 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 142 buffer); | 139 buffer); |
| 143 } | 140 } |
| 144 | 141 |
| 145 | |
| 146 TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) { | 142 TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) { |
| 147 char buffer[1024]; | 143 char buffer[1024]; |
| 148 const char* kScript = | 144 const char* kScript = |
| 149 "helper0() {}\n" | 145 "helper0() {}\n" |
| 150 "class Unused {\n" | 146 "class Unused {\n" |
| 151 " helper1() { helper0(); }\n" | 147 " helper1() { helper0(); }\n" |
| 152 "}\n" | 148 "}\n" |
| 153 "main() {\n" | 149 "main() {\n" |
| 154 " helper0();\n" | 150 " helper0();\n" |
| 155 "}"; | 151 "}"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 178 // One range with a hit (main). | 174 // One range with a hit (main). |
| 179 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," | 175 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," |
| 180 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," | 176 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," |
| 181 | 177 |
| 182 // Only one script in the script table. | 178 // Only one script in the script table. |
| 183 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 179 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 184 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 180 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 185 buffer); | 181 buffer); |
| 186 } | 182 } |
| 187 | 183 |
| 188 | |
| 189 TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) { | 184 TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) { |
| 190 char buffer[1024]; | 185 char buffer[1024]; |
| 191 const char* kScript = | 186 const char* kScript = |
| 192 "helper0() {}\n" | 187 "helper0() {}\n" |
| 193 "class Unused {\n" | 188 "class Unused {\n" |
| 194 " helper1() { helper0(); }\n" | 189 " helper1() { helper0(); }\n" |
| 195 "}\n" | 190 "}\n" |
| 196 "main() {\n" | 191 "main() {\n" |
| 197 " helper0();\n" | 192 " helper0();\n" |
| 198 "}"; | 193 "}"; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 222 // One range with a hit (main). | 217 // One range with a hit (main). |
| 223 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," | 218 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," |
| 224 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," | 219 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," |
| 225 | 220 |
| 226 // Only one script in the script table. | 221 // Only one script in the script table. |
| 227 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 222 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 228 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 223 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 229 buffer); | 224 buffer); |
| 230 } | 225 } |
| 231 | 226 |
| 232 | |
| 233 TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) { | 227 TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) { |
| 234 char buffer[1024]; | 228 char buffer[1024]; |
| 235 const char* kScript = | 229 const char* kScript = |
| 236 "helper0() {}\n" | 230 "helper0() {}\n" |
| 237 "class Unused {\n" | 231 "class Unused {\n" |
| 238 " helper1() { helper0()+ }\n" // syntax error | 232 " helper1() { helper0()+ }\n" // syntax error |
| 239 "}\n" | 233 "}\n" |
| 240 "main() {\n" | 234 "main() {\n" |
| 241 " helper0();\n" | 235 " helper0();\n" |
| 242 "}"; | 236 "}"; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 269 // One range with a hit (main). | 263 // One range with a hit (main). |
| 270 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," | 264 "{\"scriptIndex\":0,\"startPos\":22,\"endPos\":32,\"compiled\":true," |
| 271 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," | 265 "\"coverage\":{\"hits\":[27],\"misses\":[]}}]," |
| 272 | 266 |
| 273 // Only one script in the script table. | 267 // Only one script in the script table. |
| 274 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 268 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 275 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 269 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 276 buffer); | 270 buffer); |
| 277 } | 271 } |
| 278 | 272 |
| 279 | |
| 280 TEST_CASE(SourceReport_Coverage_NestedFunctions) { | 273 TEST_CASE(SourceReport_Coverage_NestedFunctions) { |
| 281 char buffer[1024]; | 274 char buffer[1024]; |
| 282 const char* kScript = | 275 const char* kScript = |
| 283 "helper0() {\n" | 276 "helper0() {\n" |
| 284 " nestedHelper0() {}\n" | 277 " nestedHelper0() {}\n" |
| 285 " nestedHelper1() {}\n" | 278 " nestedHelper1() {}\n" |
| 286 " nestedHelper0();\n" | 279 " nestedHelper0();\n" |
| 287 "}\n" | 280 "}\n" |
| 288 "helper1() {}\n" | 281 "helper1() {}\n" |
| 289 "main() {\n" | 282 "main() {\n" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 318 |
| 326 // Nested range not compiled (nestedHelper1). | 319 // Nested range not compiled (nestedHelper1). |
| 327 "{\"scriptIndex\":0,\"startPos\":11,\"endPos\":15,\"compiled\":false}]," | 320 "{\"scriptIndex\":0,\"startPos\":11,\"endPos\":15,\"compiled\":false}]," |
| 328 | 321 |
| 329 // Only one script in the script table. | 322 // Only one script in the script table. |
| 330 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 323 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 331 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 324 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 332 buffer); | 325 buffer); |
| 333 } | 326 } |
| 334 | 327 |
| 335 | |
| 336 TEST_CASE(SourceReport_Coverage_RestrictedRange) { | 328 TEST_CASE(SourceReport_Coverage_RestrictedRange) { |
| 337 char buffer[1024]; | 329 char buffer[1024]; |
| 338 const char* kScript = | 330 const char* kScript = |
| 339 "helper0() {\n" | 331 "helper0() {\n" |
| 340 " nestedHelper0() {}\n" | 332 " nestedHelper0() {}\n" |
| 341 " nestedHelper1() {}\n" | 333 " nestedHelper1() {}\n" |
| 342 " nestedHelper0();\n" | 334 " nestedHelper0();\n" |
| 343 "}\n" | 335 "}\n" |
| 344 "helper1() {}\n" | 336 "helper1() {}\n" |
| 345 "main() {\n" | 337 "main() {\n" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 369 |
| 378 // Nested range not compiled (nestedHelper1). | 370 // Nested range not compiled (nestedHelper1). |
| 379 "{\"scriptIndex\":0,\"startPos\":11,\"endPos\":15,\"compiled\":false}]," | 371 "{\"scriptIndex\":0,\"startPos\":11,\"endPos\":15,\"compiled\":false}]," |
| 380 | 372 |
| 381 // Only one script in the script table. | 373 // Only one script in the script table. |
| 382 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 374 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 383 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 375 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 384 buffer); | 376 buffer); |
| 385 } | 377 } |
| 386 | 378 |
| 387 | |
| 388 TEST_CASE(SourceReport_Coverage_AllFunctions) { | 379 TEST_CASE(SourceReport_Coverage_AllFunctions) { |
| 389 const char* kScript = | 380 const char* kScript = |
| 390 "helper0() {}\n" | 381 "helper0() {}\n" |
| 391 "helper1() {}\n" | 382 "helper1() {}\n" |
| 392 "main() {\n" | 383 "main() {\n" |
| 393 " if (true) {\n" | 384 " if (true) {\n" |
| 394 " helper0();\n" | 385 " helper0();\n" |
| 395 " } else {\n" | 386 " } else {\n" |
| 396 " helper1();\n" | 387 " helper1();\n" |
| 397 " }\n" | 388 " }\n" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 417 "\"startPos\":12,\"endPos\":39,\"compiled\":true," | 408 "\"startPos\":12,\"endPos\":39,\"compiled\":true," |
| 418 "\"coverage\":{\"hits\":[23],\"misses\":[32]}", | 409 "\"coverage\":{\"hits\":[23],\"misses\":[32]}", |
| 419 result); | 410 result); |
| 420 | 411 |
| 421 // More than one script is referenced in the report. | 412 // More than one script is referenced in the report. |
| 422 EXPECT_SUBSTRING("\"scriptIndex\":0", result); | 413 EXPECT_SUBSTRING("\"scriptIndex\":0", result); |
| 423 EXPECT_SUBSTRING("\"scriptIndex\":1", result); | 414 EXPECT_SUBSTRING("\"scriptIndex\":1", result); |
| 424 EXPECT_SUBSTRING("\"scriptIndex\":2", result); | 415 EXPECT_SUBSTRING("\"scriptIndex\":2", result); |
| 425 } | 416 } |
| 426 | 417 |
| 427 | |
| 428 TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) { | 418 TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) { |
| 429 const char* kScript = | 419 const char* kScript = |
| 430 "helper0() {}\n" | 420 "helper0() {}\n" |
| 431 "helper1() {}\n" | 421 "helper1() {}\n" |
| 432 "main() {\n" | 422 "main() {\n" |
| 433 " if (true) {\n" | 423 " if (true) {\n" |
| 434 " helper0();\n" | 424 " helper0();\n" |
| 435 " } else {\n" | 425 " } else {\n" |
| 436 " helper1();\n" | 426 " helper1();\n" |
| 437 " }\n" | 427 " }\n" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 460 "\"startPos\":12,\"endPos\":39,\"compiled\":true," | 450 "\"startPos\":12,\"endPos\":39,\"compiled\":true," |
| 461 "\"coverage\":{\"hits\":[23],\"misses\":[32]}", | 451 "\"coverage\":{\"hits\":[23],\"misses\":[32]}", |
| 462 result); | 452 result); |
| 463 | 453 |
| 464 // More than one script is referenced in the report. | 454 // More than one script is referenced in the report. |
| 465 EXPECT_SUBSTRING("\"scriptIndex\":0", result); | 455 EXPECT_SUBSTRING("\"scriptIndex\":0", result); |
| 466 EXPECT_SUBSTRING("\"scriptIndex\":1", result); | 456 EXPECT_SUBSTRING("\"scriptIndex\":1", result); |
| 467 EXPECT_SUBSTRING("\"scriptIndex\":2", result); | 457 EXPECT_SUBSTRING("\"scriptIndex\":2", result); |
| 468 } | 458 } |
| 469 | 459 |
| 470 | |
| 471 TEST_CASE(SourceReport_CallSites_SimpleCall) { | 460 TEST_CASE(SourceReport_CallSites_SimpleCall) { |
| 472 char buffer[1024]; | 461 char buffer[1024]; |
| 473 const char* kScript = | 462 const char* kScript = |
| 474 "helper0() {}\n" | 463 "helper0() {}\n" |
| 475 "helper1() {}\n" | 464 "helper1() {}\n" |
| 476 "main() {\n" | 465 "main() {\n" |
| 477 " helper0();\n" | 466 " helper0();\n" |
| 478 "}"; | 467 "}"; |
| 479 | 468 |
| 480 Library& lib = Library::Handle(); | 469 Library& lib = Library::Handle(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 "\"_native\":false}," | 570 "\"_native\":false}," |
| 582 | 571 |
| 583 "\"count\":1}]}]}]," | 572 "\"count\":1}]}]}]," |
| 584 | 573 |
| 585 // One script in the script table. | 574 // One script in the script table. |
| 586 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 575 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 587 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 576 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 588 buffer); | 577 buffer); |
| 589 } | 578 } |
| 590 | 579 |
| 591 | |
| 592 TEST_CASE(SourceReport_MultipleReports) { | 580 TEST_CASE(SourceReport_MultipleReports) { |
| 593 char buffer[1024]; | 581 char buffer[1024]; |
| 594 const char* kScript = | 582 const char* kScript = |
| 595 "helper0() {}\n" | 583 "helper0() {}\n" |
| 596 "helper1() {}\n" | 584 "helper1() {}\n" |
| 597 "main() {\n" | 585 "main() {\n" |
| 598 " helper0();\n" | 586 " helper0();\n" |
| 599 "}"; | 587 "}"; |
| 600 | 588 |
| 601 Library& lib = Library::Handle(); | 589 Library& lib = Library::Handle(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 630 "\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false," | 618 "\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false," |
| 631 "\"_intrinsic\":false,\"_native\":false},\"count\":1}]}]," | 619 "\"_intrinsic\":false,\"_native\":false},\"count\":1}]}]," |
| 632 "\"coverage\":{\"hits\":[17],\"misses\":[]}}]," | 620 "\"coverage\":{\"hits\":[17],\"misses\":[]}}]," |
| 633 | 621 |
| 634 // One script in the script table. | 622 // One script in the script table. |
| 635 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 623 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 636 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 624 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 637 buffer); | 625 buffer); |
| 638 } | 626 } |
| 639 | 627 |
| 640 | |
| 641 TEST_CASE(SourceReport_PossibleBreakpoints_Simple) { | 628 TEST_CASE(SourceReport_PossibleBreakpoints_Simple) { |
| 642 char buffer[1024]; | 629 char buffer[1024]; |
| 643 const char* kScript = | 630 const char* kScript = |
| 644 "helper0() {}\n" | 631 "helper0() {}\n" |
| 645 "helper1() {}\n" | 632 "helper1() {}\n" |
| 646 "main() {\n" | 633 "main() {\n" |
| 647 " if (true) {\n" | 634 " if (true) {\n" |
| 648 " helper0();\n" | 635 " helper0();\n" |
| 649 " } else {\n" | 636 " } else {\n" |
| 650 " helper1();\n" | 637 " helper1();\n" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 678 | 665 |
| 679 // Only one script in the script table. | 666 // Only one script in the script table. |
| 680 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," | 667 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\"," |
| 681 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", | 668 "\"uri\":\"test-lib\",\"_kind\":\"script\"}]}", |
| 682 buffer); | 669 buffer); |
| 683 } | 670 } |
| 684 | 671 |
| 685 #endif // !PRODUCT | 672 #endif // !PRODUCT |
| 686 | 673 |
| 687 } // namespace dart | 674 } // namespace dart |
| OLD | NEW |