1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>LiveScript browser tests</title>
</head>
<body>
<h1>LiveScript browser tests</h1>
<div id="output">
</div>
<script src="../browser/livescript.js"></script>
<script type="text/ls">
do ->
window.YAY = true
</script>
<script>
(function () {
var LiveScript = require("LiveScript");
assert(LiveScript, "LiveScript exists");
assert(LiveScript.compile, "LiveScript.compile exists");
assert(/return x\(\)/.test(LiveScript.compile("do -> x!", {bare: true})), "LiveScript.compile worked");
assert(LiveScript.go, "LiveScript.go exists");
LiveScript.go();
assert(window.YAY,'LiveScript.go (auto loading) works');
function assert(test, msg) {
var color = test ? "green" : "red";
var stat = test ? "passed" : "failed";
document.getElementById("output").innerHTML += "<div style='color:" + color + "'>"
+ stat + ": " + msg
+ "</div>";
}
})();
</script>
</body>
</html>
|