Add basic testing framework
[jscl.git] / jscl.lisp
index 5f1aec2..f31de86 100644 (file)
--- a/jscl.lisp
+++ b/jscl.lisp
     ("print"     :target)
     ("read"      :both)
     ("compiler"  :both)
-    ("toplevel"  :target)))
+    ("toplevel"  :target)
+    ;; Tests
+    ("tests"            :test)
+    ("eval"             :test)
+    ("tests-report"     :test)))
 
 (defun source-pathname
     (filename &key (directory '(:relative "src")) (type nil) (defaults filename))
     (write-string (read-whole-file (source-pathname "prelude.js")) out)
     (dolist (input *source*)
       (when (member (cadr input) '(:target :both))
-        (ls-compile-file (source-pathname (car input) :type "lisp") out)))))
+        (ls-compile-file (source-pathname (car input) :type "lisp") out))))
+  ;; Tests
+  (with-open-file (out "tests.js" :direction :output :if-exists :supersede)
+    (dolist (input *source*)
+      (when (member (cadr input) '(:test))
+        (ls-compile-file (source-pathname (car input)
+                                          :directory '(:relative "tests")
+                                          :type "lisp")
+                         out)))))