Index: test.lisp =================================================================== --- test.lisp (revision 0) +++ test.lisp (revision 0) @@ -0,0 +1,90 @@ +(in-package #:cl-user) + +(defpackage #:cl-who-test + (:use #:cl #:cl-who)) + +(in-package #:cl-who-test) + +(defmacro with-html (&body body) + `(with-html-output-to-string + (*standard-output* nil :prologue nil :indent nil) + ,@body)) + +(defmacro test= (result &rest args) + `(assert (string= ,result + (with-html ,@args)))) + +(defmacro test/= (result &rest args) + `(assert (string/= ,result + (with-html ,@args)))) + +(format t "~&Start running test...~%") + +(eval-when (:compile-toplevel :load-toplevel :execute) + (setq *downcase-tags-p* t) + (setf (html-mode) :xml) + (setq *attribute-quote-char* #\') + (setq *html-empty-tag-aware-p* t)) + +(test= "&" (esc "&")) +(test= "<" (esc "<")) +(test= ">" (esc ">")) +(test= "'" (esc "'")) +(test= """ (esc "\"")) +(test= "✓" (esc (string (code-char #x2713)))) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (setf (html-mode) :sgml)) + +(test= "✓" (esc (string (code-char #x2713)))) + +(test= "" + (:input :type "checkbox" :checked t)) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (setf (html-mode) :xml)) + +(test= "" + (:input :type "checkbox" :checked t)) + +(test= "
" + (:div)) + +(test= "