hsx/tests/utils.lisp
2024-10-04 08:44:27 +09:00

30 lines
903 B
Common Lisp

(defpackage #:hsx-test/utils
(:use #:cl
#:rove
#:hsx/utils))
(in-package #:hsx-test/utils)
(deftest text-util-test
(testing "escape-html-attribute"
(ok (string= ""foo""
(escape-html-attribute "\"foo\""))))
(testing "escape-html-text-content"
(ok (string= "&<>"'/`="
(escape-html-text-content "&<>\"'/`=")))))
(defgroup fruit
apple banana)
(deftest group-util-test
(testing "defgroup"
(ok (expands '(defgroup fruit apple banana)
'(progn
(defparameter *fruit*
(hsx/utils::make-keyword-hash-table '(apple banana)))
(defun fruit-p (keyword)
(gethash keyword *fruit*)))))
(ok (hash-table-p *fruit*))
(ok (fboundp 'fruit-p))
(ok (fruit-p :apple))
(ng (fruit-p :tomato))))