hsx/tests/utils.lisp

31 lines
902 B
Common Lisp
Raw Normal View History

2024-10-03 00:54:43 +00:00
(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= "&<>"'/`="
2024-10-03 23:44:27 +00:00
(escape-html-text-content "&<>\"'/`=")))))
2024-10-03 01:25:30 +00:00
(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))
2025-01-11 06:59:40 +00:00
(ok (fruit-p :appl))
2024-10-03 01:25:30 +00:00
(ng (fruit-p :tomato))))