]> git.eshelyaron.com Git - emacs.git/commitdiff
Strengthen widget-get/put tests
authorMattias EngdegÄrd <mattiase@acm.org>
Sun, 2 Mar 2025 14:20:11 +0000 (15:20 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 21:03:36 +0000 (22:03 +0100)
* test/lisp/wid-edit-tests.el
(widget-test-editable-field-widget-get/put): Test on inherited properties.

(cherry picked from commit 932397ce52ec0fa112afcd8d52324b8cdfbb66af)

test/lisp/wid-edit-tests.el

index 1a3a35ff496197d2d36bc07d1ecfc2a56314fd9e..cf74a19a0ea297990d6de164db6bb6dd43bdb0ba 100644 (file)
       (should (eq (widget-put widget :size 1) 1))
       (should (equal (widget-put widget :format "foo") "foo"))
       (should (eq (widget-get widget :size) 1))
-      (should (equal (widget-get widget :format) "foo")))))
+      (should (equal (widget-get widget :format) "foo"))
+
+      ;; test get/put for inherited properties
+      (should-not (plist-member (cdr widget) :validate))
+      (should (eq (widget-get widget :validate) 'widget-field-validate))
+      (should (eq (widget-put widget :validate 'my-silly-validate)
+                  'my-silly-validate))
+      (should (plist-member (cdr widget) :validate))
+      (should (eq (widget-get widget :validate) 'my-silly-validate))
+      (should (eq (widget-get (get (widget-type widget) 'widget-type)
+                              :validate)
+                  'widget-field-validate)))))
 
 (ert-deftest widget-at ()
   (with-temp-buffer