Update of /project/s-xml/cvsroot/s-xml/test In directory common-lisp.net:/tmp/cvs-serv28410/test
Modified Files: test-xml.lisp Log Message: fixed a bug: in a tag containing whitespace, like <foo> </foo> the parser collapsed and ingnored all whitespace and considered the tag to be empty! this is now fixed and a unit test has been added cleaned up xml character escaping a bit: single quotes and all normal whitespace (newline, return and tab) is preserved a unit test for this has been added
Date: Fri Oct 22 12:37:00 2004 Author: scaekenberghe
Index: s-xml/test/test-xml.lisp diff -u s-xml/test/test-xml.lisp:1.1.1.1 s-xml/test/test-xml.lisp:1.2 --- s-xml/test/test-xml.lisp:1.1.1.1 Mon Jun 7 20:49:59 2004 +++ s-xml/test/test-xml.lisp Fri Oct 22 12:37:00 2004 @@ -1,6 +1,6 @@ ;;;; -*- mode: lisp -*- ;;;; -;;;; $Id: test-xml.lisp,v 1.1.1.1 2004/06/07 18:49:59 scaekenberghe Exp $ +;;;; $Id: test-xml.lisp,v 1.2 2004/10/22 10:37:00 scaekenberghe Exp $ ;;;; ;;;; Unit and functional tests for xml.lisp ;;;; @@ -51,8 +51,13 @@ "<foo>"))
(assert - (string-equal (with-output-to-string (stream) (print-string-xml "' '" stream)) - "'	'")) + (string-equal (with-output-to-string (stream) (print-string-xml "' '" stream)) + "' '")) + +(assert + (let ((string (map 'string #'identity '(#\return #\tab #\newline)))) + (string-equal (with-output-to-string (stream) (print-string-xml string stream)) + string)))
(defun simple-echo-xml (in out) (start-parse-xml @@ -71,12 +76,19 @@ (declare (ignore seed)) (princ string out)))))
+(defun simple-echo-xml-string (string) + (with-input-from-string (in string) + (with-output-to-string (out) + (simple-echo-xml in out)))) + (assert (let ((xml "<FOO ATT1='1' ATT2='2'><B>Text</B><EMPTY></EMPTY>More text!<SUB><SUB></SUB></SUB></FOO>")) - (equal - (with-input-from-string (in xml) - (with-output-to-string (out) - (simple-echo-xml in out))) - xml))) + (equal (simple-echo-xml-string xml) + xml))) + +(assert + (let ((xml "<p> </p>")) + (equal (simple-echo-xml-string xml) + xml)))
;;;; eof