OLD | NEW |
(Empty) | |
| 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> |
| 7 |
| 8 <script> |
| 9 |
| 10 function test() |
| 11 { |
| 12 var testJSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "tex
t/javascript"); |
| 13 |
| 14 InspectorTest.runTestSuite([ |
| 15 function simpleLiteral(next) |
| 16 { |
| 17 var mappingQueries = ["foo", "bar"]; |
| 18 testJSFormatter("var foo = `bar`;", mappingQueries, next); |
| 19 }, |
| 20 |
| 21 function multilineLiteral(next) |
| 22 { |
| 23 var mappingQueries = ["foo", "bar"]; |
| 24 testJSFormatter("var foo = `this\nbar`;", mappingQueries, next); |
| 25 }, |
| 26 |
| 27 function stringSubstitution(next) |
| 28 { |
| 29 var mappingQueries = ["credit", "cash"]; |
| 30 testJSFormatter("var a=`I have ${credit+cash}$`;", mappingQueries, n
ext); |
| 31 }, |
| 32 |
| 33 function multipleStringSubstitution(next) |
| 34 { |
| 35 var mappingQueries = ["credit", "cash"]; |
| 36 testJSFormatter("var a=`${name} has ${credit+cash}${currency?currenc
y:\"$\"}`;", mappingQueries, next); |
| 37 }, |
| 38 |
| 39 function taggedTemplate(next) |
| 40 { |
| 41 var mappingQueries = ["escapeHtml", "width"]; |
| 42 testJSFormatter("escapeHtml`<div class=${classnName} width=${a+b}/>`
;", mappingQueries, next); |
| 43 }, |
| 44 |
| 45 function escapedApostrophe(next) |
| 46 { |
| 47 var mappingQueries = ["That", "great"]; |
| 48 testJSFormatter("var a=`That\`s great!`;", mappingQueries, next); |
| 49 } |
| 50 ]); |
| 51 } |
| 52 |
| 53 </script> |
| 54 |
| 55 </head> |
| 56 |
| 57 <body onload="runTest()"> |
| 58 <p>Verifies JavaScript pretty-printing functionality.</p> |
| 59 </body> |
| 60 </html> |
OLD | NEW |