aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMauro Aranda2023-09-09 21:59:30 +0800
committerEli Zaretskii2023-09-16 12:56:34 +0300
commit2ea98ea35c82da31ef419da3b49789ab750e8e00 (patch)
treeeb0329873307c052873b331105ec094c114e4246 /test
parent68976b00f1024f4bd3b5f2f91c090426c03f609a (diff)
downloademacs-2ea98ea35c82da31ef419da3b49789ab750e8e00.tar.gz
emacs-2ea98ea35c82da31ef419da3b49789ab750e8e00.zip
Avoid errors when a restricted-sexp widget is empty
* lisp/wid-edit.el (restricted-sexp): Don't try to read an empty string when converting the current value to the external format. (Bug#63838) * test/lisp/wid-edit-tests.el (widget-test-restricted-sexp-empty-val): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/wid-edit-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
index ebfe729bc9a..66bff4ad2e3 100644
--- a/test/lisp/wid-edit-tests.el
+++ b/test/lisp/wid-edit-tests.el
@@ -380,4 +380,15 @@ return nil, even with a non-nil bubblep argument."
380 :value (("1" . 1) ("2" . 2)))))) 380 :value (("1" . 1) ("2" . 2))))))
381 (should (equal '(("1" . 1) ("2" . 2)) (widget-default-get w)))))) 381 (should (equal '(("1" . 1) ("2" . 2)) (widget-default-get w))))))
382 382
383(ert-deftest widget-test-restricted-sexp-empty-val ()
384 "Test that we handle an empty restricted-sexp widget just fine."
385 (with-temp-buffer
386 (let ((w (widget-create '(restricted-sexp
387 :value 3
388 :match-alternatives (integerp)))))
389 (widget-setup)
390 (widget-backward 1)
391 (delete-char 1)
392 (should (string= (widget-value w) "")))))
393
383;;; wid-edit-tests.el ends here 394;;; wid-edit-tests.el ends here