(defpackage :xfdf-test
(:use :cl
:1am
:xfdf))
(in-package :xfdf-test)
(test generates-xfdf-xml
(let ((xfdf-string
(with-output-to-string (xfdf-stream)
(xfdf:write-xfdf
xfdf-stream
'(("checkbox-on" . t)
("checkbox-off" . nil)
("text" . "123 Fake Street, Springfield"))))))
(is (string=
xfdf-string
"
Yes
Off
123 Fake Street, Springfield
"))))
(test generates-hierarchical-xfdf
(let ((xfdf-string
(with-output-to-string (xfdf-stream)
(xfdf:write-xfdf
xfdf-stream
'(("topmostSubform[0]"
. (("Page1[0]"
. (("c1_01[1]" . "2")
("f1_02[0]" . "Homer J.")
("f1_03[0]" . "Simpson")))
("Page2[0]"
. (("f2_02[0]" . "1234")))))
("bottommostSubform[0]"
. (("Page1[0]"
. (("f1_01[0]" . "Annoyed grunt!"))))))))))
(is (string=
xfdf-string
"
2
Homer J.
Simpson
1234
Annoyed grunt!
"))))