Commits

Anonymous committed cc09e09

fixed a bug serializing empty hashtables in s-expr format (thx to Sacha De Vos for reporting this)

Comments (0)

Files changed (2)

src/serialization.lisp

                          (write-string " . " stream)
                          (serialize-sexp-internal value stream serialization-state)
                          (princ ")" stream))
-                     object))
-          (write-string " ) )" stream)))))
+                     object)
+            (write-string " )" stream))
+          (write-string " )" stream)))))
 
 (defmethod serialize-xml-internal ((object structure-object) stream serialization-state)
   (let ((id (known-object-id serialization-state object)))

test/test-serialization.lisp

   (maphash #'(lambda (k v) (assert (equal v (gethash k h2)))) *hashtable*) 
   (maphash #'(lambda (k v) (assert (equal v (gethash k *hashtable*)))) h2))
 
+(defparameter *empty-hashtable* (make-hash-table))
+
+(let (h2)
+  (setf h2 (serialize-and-deserialize-xml *empty-hashtable*))
+  (maphash #'(lambda (k v) (assert (equal v (gethash k h2)))) *empty-hashtable*) 
+  (maphash #'(lambda (k v) (assert (equal v (gethash k *hashtable*)))) h2))
+
+(let (h2)
+  (setf h2 (serialize-and-deserialize-sexp *empty-hashtable*))
+  (maphash #'(lambda (k v) (assert (equal v (gethash k h2)))) *empty-hashtable*) 
+  (maphash #'(lambda (k v) (assert (equal v (gethash k *hashtable*)))) h2))
+
 ;;; eof