unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <f92capac@gmail.com>
To: npostavs@users.sourceforge.net
Cc: Tino Calancha <f92capac@gmail.com>, 22027@debbugs.gnu.org
Subject: bug#22027: 25.1.50; Return uncorrupted default string
Date: Mon, 5 Jun 2017 09:22:30 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1706050920290.925@calancha-pc> (raw)
In-Reply-To: <87poekz9zi.fsf@users.sourceforge.net>



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	other threads:[~2017-06-05  0:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  9:53 bug#22027: 25.1.50; read-passwd fail to return default password Tino Calancha
     [not found] ` <handler.22027.B.14486178085232.ack@debbugs.gnu.org>
2015-11-27 10:16   ` bug#22027: Acknowledgement (25.1.50; read-passwd fail to return default password) Constantino Calancha
2016-05-09  3:26 ` bug#22027: 25.1.50; Return uncorrupted default string Tino Calancha
2017-06-04  3:51   ` npostavs
2017-06-05  0:22     ` Tino Calancha [this message]
2017-06-05  0:39       ` Tino Calancha
2017-06-05 23:03         ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1706050920290.925@calancha-pc \
    --to=f92capac@gmail.com \
    --cc=22027@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).