unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Erik Anderson <erikbpanderson@gmail.com>
To: 15107@debbugs.gnu.org
Subject: bug#15107: [PATCH] Add replace-regexp-in-string regression test
Date: Tue, 30 Aug 2016 23:57:35 +0000	[thread overview]
Message-ID: <CAAFf7ayb=44oEhCErZZOeG=d11CR=NOERJ08Pg2iyMke1bHeKA@mail.gmail.com> (raw)
In-Reply-To: <87eh9uk3c6.fsf@blah.blah>

[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]

I can confirm the buggy behavior on emacs 24.5.1 and 25.1.50.1 for Kevin's
example as well as:

(replace-regexp-in-string "^.\\| ." #'upcase "foo bar")
> "Foo bar"  (should be "Foo Bar")

Some close variants which behave correctly:

(replace-regexp-in-string "^F\\| ." #'upcase "foo bar")
> "Foo Bar"
(replace-regexp-in-string "^.K\\| ." #'upcase "ok corral")
> "OK Corral"
(replace-regexp-in-string "^..\\| ." #'upcase "ok corral")
> "OK Corral"

This was discussed here:
http://emacs.stackexchange.com/questions/26590/replace-regexp-in-string-stops-replacement-with

Here is a regression test for when someone has a chance to tackle this:

---
 test/lisp/subr-tests.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index ce21290..969d5c2 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -224,5 +224,8 @@
               (error-message-string (should-error (version-to-list
"beta22_8alpha3")))
               "Invalid version syntax: `beta22_8alpha3' (must start with a
number)"))))

+(ert-deftest replace-regexp-in-string-test ()
+  (should (equal (replace-regexp-in-string "^.\\| ." #'upcase "foo bar")
"Foo Bar")))
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here
-- 

Regards,
Erik Anderson.

[-- Attachment #2: Type: text/html, Size: 2034 bytes --]

  parent reply	other threads:[~2016-08-30 23:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 22:15 bug#15107: 24.3; replace-regexp-in-string wrong on \` Kevin Ryde
2016-03-06  4:18 ` bug#15107: reproduced on emacs-25 branch Michael Wright
2016-08-30 23:57 ` Erik Anderson [this message]
2016-08-31 14:24   ` bug#15107: [PATCH] Add replace-regexp-in-string regression test Eli Zaretskii
2016-08-31 14:36     ` Erik Anderson
2016-08-31 15:01       ` Eli Zaretskii
2016-08-31 15:13         ` Noam Postavsky
2016-08-31 15:32           ` Erik Anderson
2016-08-31 16:04           ` Eli Zaretskii
2016-09-01 15:46   ` Eli Zaretskii

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='CAAFf7ayb=44oEhCErZZOeG=d11CR=NOERJ08Pg2iyMke1bHeKA@mail.gmail.com' \
    --to=erikbpanderson@gmail.com \
    --cc=15107@debbugs.gnu.org \
    /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).