]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a new test for dom-search
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 9 Aug 2021 12:14:01 +0000 (14:14 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 9 Aug 2021 12:14:37 +0000 (14:14 +0200)
test/lisp/dom-tests.el

index 0a0d783b8245d4089a5cdaf2343cf4be6a5eff30..b55982c1a15eba9c17210982f352feaee834ad67 100644 (file)
@@ -209,5 +209,13 @@ child results in an error."
       (dom-pp node t)
       (should (equal (buffer-string) "(\"foo\" nil)")))))
 
+(ert-deftest dom-test-search ()
+  (let ((dom '(a nil (b nil (c nil)))))
+    (should (equal (dom-search dom (lambda (d) (eq (dom-tag d) 'a)))
+                   (list dom)))
+    (should (equal (dom-search dom (lambda (d) (memq (dom-tag d) '(b c))))
+                   (list (car (dom-children dom))
+                         (car (dom-children (car (dom-children dom)))))))))
+
 (provide 'dom-tests)
 ;;; dom-tests.el ends here