aboutsummaryrefslogtreecommitdiffstats
path: root/test/xfdf.lisp
diff options
context:
space:
mode:
authorTeddy Wing2023-04-16 19:55:53 +0200
committerTeddy Wing2023-04-16 19:55:53 +0200
commit0fdcbf0a159c9ee4df69bad2c617de01dcb0fd3c (patch)
treefae2919fc7fcd11f389e6a2f5bf04f87ef79b7b3 /test/xfdf.lisp
parent3347a25d6abc00f0cbcea893282eef949ca9b25f (diff)
downloadxfdf-0fdcbf0a159c9ee4df69bad2c617de01dcb0fd3c.tar.bz2
Add test system
Write a test for the `write-xfdf` function. Worked out how to create the test system from: - https://lispcookbook.github.io/cl-cookbook/testing.html - https://github.com/sjl/cl-digraph/blob/master/cl-digraph.test.asd - https://github.com/fukamachi/dexador/blob/master/dexador-test.asd Add the test string to the `write-xfdf` function to pass the test and check that the test runner is set up correctly.
Diffstat (limited to 'test/xfdf.lisp')
-rw-r--r--test/xfdf.lisp37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/xfdf.lisp b/test/xfdf.lisp
new file mode 100644
index 0000000..87accaf
--- /dev/null
+++ b/test/xfdf.lisp
@@ -0,0 +1,37 @@
+(defpackage :xfdf-test
+ (:use :cl
+ :1am
+ :xfdf)
+
+ ; (:export #:run)
+ )
+
+(in-package :xfdf-test)
+
+; (defun run ()
+; (1am:run))
+
+(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
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<xfdf xmlns=\"http://ns.adobe.com/xfdf/\" xml:space=\"preserve\">
+ <fields>
+ <field name=\"checkbox-on\">
+ <value>Yes</value>
+ </field>
+ <field name=\"checkbox-off\">
+ <value>Off</value>
+ </field>
+ <field name=\"text\">
+ <value>123 Fake Street, Springfield</value>
+ </field>
+ </fields>
+</xfdf>"))))