File: browser.html

package info (click to toggle)
node-livescript 1.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 672 kB
  • sloc: makefile: 45
file content (39 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download | duplicates (3)
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>