Add testing environment
authorDavid Vazquez <davazp@gmail.com>
Fri, 14 Dec 2012 22:26:05 +0000 (22:26 +0000)
committerDavid Vazquez <davazp@gmail.com>
Fri, 14 Dec 2012 22:26:05 +0000 (22:26 +0000)
lispstrack.lisp
prelude.js [new file with mode: 0644]
test.html [new file with mode: 0644]
test.lisp [new file with mode: 0644]

index 4baeb39..8af6781 100644 (file)
@@ -96,9 +96,16 @@ body can access to the local environment through the variable env"
 
 (defun ls-compile-block (sexps env)
   (concat (join (mapcar (lambda (x)
-                          (ls-compile x env))
+                          (concat (ls-compile x env) ";"))
                         (butlast sexps))
-                ";
-")
-          ";
+                "")
+          "
 return " (ls-compile (car (last sexps)) env) ";"))
+
+
+(defun compile-test ()
+  (with-open-file (in "test.lisp")
+    (with-open-file (out "test.js" :direction :output :if-exists :supersede)
+      (loop
+         for x = (read in nil) while x
+         do (write-string (ls-compile x) out)))))
diff --git a/prelude.js b/prelude.js
new file mode 100644 (file)
index 0000000..4496eca
--- /dev/null
@@ -0,0 +1,7 @@
+//
+
+function Symbol(name){
+    this.name = name;
+}
+
+console.log('Running test.js...');
diff --git a/test.html b/test.html
new file mode 100644 (file)
index 0000000..18bd35b
--- /dev/null
+++ b/test.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<html>
+  <body>
+    <script type="text/javascript" src="prelude.js"></script>
+    <script type="text/javascript" src="test.js"></script>
+  </body>
+</html>
diff --git a/test.lisp b/test.lisp
new file mode 100644 (file)
index 0000000..87240de
--- /dev/null
+++ b/test.lisp
@@ -0,0 +1,3 @@
+
+(lambda (x y)
+  x)