-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.lisp
39 lines (31 loc) · 1.18 KB
/
test.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(defpackage :html2clwho.test
(:use :cl :html2clwho :fiveam))
(in-package :html2clwho.test)
(def-suite html2clwho-suite :description "Build sexp from html")
(in-suite html2clwho-suite)
(defun is-html (str sexp)
(is (equal (string-trim '(#\Newline) (html2clwho::build-sexp str)) sexp)))
(def-test empty-tag ()
(is-html "<html></html>" "(:html)"))
(def-test some-classes ()
(is-html "<div class=\"col-md-4\"></div>" "(:div :class \"col-md-4\")"))
(def-test some-content ()
(is-html "<div><span>Hello</span></div>" "(:div
(:span \"Hello\"))"))
(def-test simple-comment ()
(is-html "<html><!--with comment--></html>"
"(:html #| \"with comment\"|#)"))
(def-test complex-comment ()
(is-html " <p>This is a paragraph.</p>
<!--
<p>Look at this cool image:</p>
<img border=\"0\" src=\"pic_trulli.jpg\" alt=\"Trulli\">
-->
<p>This is a paragraph too.</p> "
"(:p \"This is a paragraph.\") #|
(:p \"Look at this cool image:\")
(:img :border \"0\" :src \"pic_trulli.jpg\" :alt \"Trulli\")|#
(:p \"This is a paragraph too.\")"))
;; https://stackoverflow.com/questions/54889460/asdftest-system-from-a-makefile-doesnt-return-an-error-return-code
(defun run-tests ()
(run! 'html2clwho-suite))