File: skip-tag-forward.el

package info (click to toggle)
emacs-jabber 0.8.92%2Bgit98dc8e-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,036 kB
  • ctags: 992
  • sloc: lisp: 12,234; makefile: 71; sh: 1
file content (23 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;; Tests for jabber-xml-skip-tag-forward

(require 'jabber-xml)
(require 'cl)

(flet ((parses-p
	(text)
	(with-temp-buffer
	  (insert text)
	  (goto-char (point-min))
	  (catch 'unfinished
	    (jabber-xml-skip-tag-forward)
	    (= (point) (point-max))))))
  
  ;; 1. Just plain XML
  (unless (parses-p "<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>ANONYMOUS</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features>")
    (error "Testcase 1 failed"))

  ;; 2. XML with CDATA
  (unless (parses-p "<message><body><![CDATA[<foo & bar>]]></body></message>")
    (error "Testcase 2 failed")))

;; arch-tag: a99d8666-0e6b-11dd-bd33-000a95c2fcd0