(defun lisp-implementation-type ()
"JSCL")
+(defun lisp-implementation-version ()
+ #.*version*)
+
+;;; Javascript has not access to the hardware. Would it make sense to
+;;; have the browser data as machine abstraction instead?
+
+(defun machine-instance ()
+ nil)
+
+(defun machine-version ()
+ nil)
+
+(defun machine-type ()
+ nil)
+
+
(defmacro time (form)
(let ((start (gensym))
(end (gensym)))
-(format t "~%Finished. The execution took ~a seconds.~%"
- (/ (- (get-internal-real-time) *timestamp*) internal-time-units-per-second 1.0))
+(async
+ (format t "~%Finished. The execution took ~a seconds.~%"
+ (/ (- (get-internal-real-time) *timestamp*) internal-time-units-per-second 1.0))
-(if (= *passed-tests* *total-tests*)
- (format t "All the tests (~a) passed successfully.~%" *total-tests*)
- (format t "~a/~a test(s) passed successfully.~%" *passed-tests* *total-tests*))
+ (if (= *passed-tests* *total-tests*)
+ (format t "All the tests (~a) passed successfully.~%" *total-tests*)
+ (format t "~a/~a test(s) passed successfully.~%" *passed-tests* *total-tests*))
-(unless (zerop *expected-failures*)
- (format t "~a test(s) failed expectedly.~%" *expected-failures*))
+ (unless (zerop *expected-failures*)
+ (format t "~a test(s) failed expectedly.~%" *expected-failures*))
-(unless (zerop *unexpected-passes*)
- (format t "~a test(s) passed unexpectedly.~%" *unexpected-passes*))
+ (unless (zerop *unexpected-passes*)
+ (format t "~a test(s) passed unexpectedly.~%" *unexpected-passes*))
-(terpri)
+ (terpri)
+
+ (init))
(defvar *use-html-output-p* t)
(defvar *timestamp* nil)
+(defmacro async (&body body)
+ `(#j:setTimeout (lambda () ,@body)))
+
(defun test-fn (condition form)
- (cond
- (condition
- (format t "Test `~S' passed~%" form)
- (incf *passed-tests*))
- (t
- (if *use-html-output-p*
- (format t "<font color='red'>Test `~S' failed.</font>~%" form)
- (format t "Test `~S' failed.~%" form))
- (incf *failed-tests*)))
- (incf *total-tests*))
+ (async
+ (cond
+ (condition
+ (format t "Test `~S' passed~%" form)
+ (incf *passed-tests*))
+ (t
+ (if *use-html-output-p*
+ (format t "<font color='red'>Test `~S' failed.</font>~%" form)
+ (format t "Test `~S' failed.~%" form))
+ (incf *failed-tests*)))
+ (incf *total-tests*)))
(defun expected-failure-fn (condition form)
- (cond
- (condition
- (if *use-html-output-p*
- (format t "<font color='orange'>Test `~S' passed unexpectedly!</font>~%" form)
- (format t "Test `~S' passed unexpectedly!~%" form))
- (incf *unexpected-passes*))
- (t
- (format t "Test `~S' failed expectedly.~%" form)
- (incf *expected-failures*)))
- (incf *total-tests*))
+ (async
+ (cond
+ (condition
+ (if *use-html-output-p*
+ (format t "<font color='orange'>Test `~S' passed unexpectedly!</font>~%" form)
+ (format t "Test `~S' passed unexpectedly!~%" form))
+ (incf *unexpected-passes*))
+ (t
+ (format t "Test `~S' failed expectedly.~%" form)
+ (incf *expected-failures*)))
+ (incf *total-tests*)))
(defmacro test (condition)