1<script> 2 function createClickHandler(result, str) { 3 return function() { 4 console.assert(result, "%s", str); 5 } 6 } 7 8 function load() { 9 var tests = [ 10 "", 11 "false", 12 "null", 13 "document.body", 14 "!document.body", 15 "true" 16 ]; 17 18 for (var i = 0; i < tests.length; ++i) { 19 var test = tests[i]; 20 var result; 21 try { 22 result = eval(test); 23 } catch(e) { 24 result = false; 25 } 26 var button = document.createElement("button"); 27 button.innerText = "console.assert(" + test + "): should" + (result ? " not" : "") + " assert"; 28 button.onclick = createClickHandler(result, test); 29 var p = document.createElement("p"); 30 p.appendChild(button); 31 document.body.appendChild(p); 32 } 33 } 34</script> 35<body onload="load()"> 36<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=19134">Bug 19134: Inspector should support console.assert</a>.</p> 37<p>To test, click the buttons below and look at the Inspector's Console.</p> 38