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 forInFormatting(next
)
17 var mappingQueries
= ["myMap", "print"];
18 testJSFormatter("for(var key in myMap)print(key);", mappingQueries
, next
);
21 function forOfFormatting(next
)
23 var mappingQueries
= ["myMap", "print"];
24 testJSFormatter("for(var value of myMap)print(value);", mappingQueries
, next
);
27 function commaBetweenStatementsFormatting(next
)
29 var mappingQueries
= ["noop", "hasNew"];
30 testJSFormatter("rebuild(),show(),hasNew?refresh():noop();", mappingQueries
, next
);
33 function complexScriptFormatting(next
)
35 InspectorTest
.showScriptSource("obfuscated.js", didShowScriptSource
);
37 function didShowScriptSource(sourceFrame
)
39 var mappingQueries
= [
43 " return \"functionWithComments\"",
51 testJSFormatter(sourceFrame
._textEditor
.text(), mappingQueries
, next
);
55 function ifStatementIndentRegression(next
)
57 var mappingQueries
= ["pretty", "reset"];
58 testJSFormatter("{if (a>b){a();pretty();}else if (a+b)e();reset();}", mappingQueries
, next
);
67 <body onload=
"runTest()">
68 <p>Verifies JavaScript pretty-printing functionality.
</p>