3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../http/tests/inspector/debugger-test.js"></script>
5 <script src=
"../../http/tests/inspector/sources-test.js"></script>
6 <script src=
"debugger/resources/obfuscated.js"></script>
12 var testJSFormatter
= InspectorTest
.testPrettyPrint
.bind(InspectorTest
, "text/javascript");
14 InspectorTest
.runTestSuite([
15 function trailingCommentsTest(next
)
17 var mappingQueries
= [];
18 testJSFormatter("noop(); //#sourceMappingURL=program.js.map", mappingQueries
, next
);
21 function inlinedScriptFormatting(next
)
23 var content
= "<html><body><script>function f(){}<" + "/script><script>function g(){var a;window.return = 10;if (a) return;}<" + "/script></body></html>";
24 InspectorTest
.testPrettyPrint("text/html", content
, [], next
);
27 function generatorFormatter(next
)
29 var mappingQueries
= ["max", "*", "else"];
30 testJSFormatter("function *max(){var a=yield;var b=yield 10;if(a>b)return a;else return b;}", mappingQueries
, next
);
33 function blockCommentFormatter(next
)
35 var mappingQueries
= ["this", "is", "block", "comment", "var", "10"];
36 testJSFormatter("/** this\n * is\n * block\n * comment\n */\nvar a=10;", mappingQueries
, next
);
39 function lexicalScoping(next
)
41 var mappingQueries
= ["for", "person", "name", "}"];
42 testJSFormatter("for(var i=0;i<names.length;++i){let name=names[i];let person=persons[i];}", mappingQueries
, next
);
45 function anonimousFunctionAsParameter(next
)
47 var mappingQueries
= ["setTimeout", "function", "alert", "2000"];
48 testJSFormatter("setTimeout(function(){alert(1);},2000);", mappingQueries
, next
);
57 <body onload=
"runTest()">
58 <p>Verifies JavaScript pretty-printing functionality.
</p>