From 0fdcbf0a159c9ee4df69bad2c617de01dcb0fd3c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 16 Apr 2023 19:55:53 +0200 Subject: 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. --- test/run.lisp | 3 +++ test/xfdf.lisp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 test/run.lisp create mode 100644 test/xfdf.lisp (limited to 'test') diff --git a/test/run.lisp b/test/run.lisp new file mode 100644 index 0000000..067bcff --- /dev/null +++ b/test/run.lisp @@ -0,0 +1,3 @@ +(ql:quickload "xfdf-test") +(asdf:test-system :xfdf-test) +(quit) 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 + " + + + + Yes + + + Off + + + 123 Fake Street, Springfield + + +")))) -- cgit v1.2.3