Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / pretty-print-javascript-4.html
blob49abe7b08eca519967cfa35b75e63170beebdcbb
1 <html>
2 <head>
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>
8 <script>
10 function test()
12 var testJSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "text/javascript");
14 InspectorTest.runTestSuite([
15 function withStatementFormatting(next)
17 var mappingQueries = ["first", "obj", "nice", "1", "2", "done"];
18 testJSFormatter("with(obj)log('first');with(nice){log(1);log(2);}done();", mappingQueries, next);
21 function switchStatementFormatting(next)
23 var mappingQueries = ["even", "odd", "89", "done"];
24 testJSFormatter("switch (a) { case 1, 3: log(\"odd\");break;case 2:log(\"even\");break;case 42:case 89: log(a);default:log(\"interesting\");log(a);}log(\"done\");", mappingQueries, next);
27 function whileFormatting(next)
29 var mappingQueries = ["while", "infinity", ");"];
30 testJSFormatter("while(true){print('infinity');}", mappingQueries, next);
33 function doWhileFormatting(next)
35 var mappingQueries = ["while", "infinity"];
36 testJSFormatter("do{print('infinity');}while(true);", mappingQueries, next);
39 function functionFormatting(next)
41 var mappingQueries = ["return", "*="];
42 testJSFormatter("function test(a,b,c){a*=b;return c+a;}", mappingQueries, next);
44 ]);
47 </script>
49 </head>
51 <body onload="runTest()">
52 <p>Verifies JavaScript pretty-printing functionality.</p>
53 </body>
54 </html>