Move the functionality of reading the next complete stanza into a separate function, and add some test cases for it. I'd like to get rid of jabber-xml-skip-tag-forward at some point, so a good first step towards that should be moving calls to it into a function that's easy to test in isolation.pete
parent
d4d7782741
commit
98dc8e429b
@ -0,0 +1,18 @@
|
||||
;; Tests for jabber-xml-parse-next-stanza
|
||||
|
||||
(require 'jabber-xml)
|
||||
|
||||
(defun parse-it (text)
|
||||
(with-temp-buffer
|
||||
(insert text)
|
||||
(jabber-xml-parse-next-stanza)))
|
||||
|
||||
(unless (equal
|
||||
(parse-it "<presence from='foo@example.com/resource' type='unavailable' to='bar@example.com'/>")
|
||||
'((presence ((from . "foo@example.com/resource") (type . "unavailable") (to . "bar@example.com")))))
|
||||
(error "Testcase 1 failed"))
|
||||
|
||||
(unless (equal
|
||||
(parse-it "<presence from='foo@example.com/resource' ")
|
||||
nil)
|
||||
(error "Testcase 2 failed"))
|
Loading…
Reference in new issue