bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22027: 25.1.50; Return uncorrupted default string


From: Tino Calancha
Subject: bug#22027: 25.1.50; Return uncorrupted default string
Date: Mon, 5 Jun 2017 09:22:30 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Sat, 3 Jun 2017, npostavs@users.sourceforge.net wrote:

Tino Calancha <f92capac@gmail.com> writes:

+                    (setq success (copy-sequence first))
+                  (when (and (arrayp first)
+                             (not (string= first "")))
+                    (clear-string first)
+                    (clear-string second)))

I think that is too complicated, how about this instead:
Yes, your is better.  Thank you.
We might add a test as well:

commit eb7fdeefadf08d7a781bee60df45fb045b582930
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Mon Jun 5 09:18:55 2017 +0900

    * test/lisp/subr-tests.el (subr-tests-bug22027): Add test.

diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index c0bfd40f80..81f61220d3 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -28,6 +28,7 @@
 ;;; Code:

 (require 'ert)
+(eval-when-compile (require 'cl-lib))

 (ert-deftest let-when-compile ()
   ;; good case
@@ -316,5 +317,13 @@ subr-tests--this-file
   (should-not (method-files 'subr-tests--undefined-generic))
   (should-not (method-files 'subr-tests--generic-without-methods)))

+(ert-deftest subr-tests-bug22027 ()
+  "Test for http://debbugs.gnu.org/22027 ."
+  (cl-letf* ((default "foo")
+             ((symbol-function 'read-string)
+              (lambda (&rest args) (mapconcat #'string default ""))))
+    (should (string= default (read-passwd "pass: " 'confirm default)))))
+
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here





reply via email to

[Prev in Thread] Current Thread [Next in Thread]