changeset 4900:0eccfd4850d6

Add tests for the regexp-ranges-treat-control-1-chars badly bug. 2010-01-30 Aidan Kehoe <kehoea@parhasard.net> * automated/regexp-tests.el: Make sure that control-1 characters are no longer treated as second-class citizens in regexp ranges, as in http://mid.gmane.org/18829.34118.709782.704574@parhasard.net .
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 30 Jan 2010 19:23:43 +0000
parents aa8197436fdb
children 7504864a986c
files tests/ChangeLog tests/automated/regexp-tests.el
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/ChangeLog	Sat Jan 30 15:47:37 2010 +0000
+++ b/tests/ChangeLog	Sat Jan 30 19:23:43 2010 +0000
@@ -1,3 +1,10 @@
+2010-01-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* automated/regexp-tests.el:
+	Make sure that control-1 characters are no longer treated as
+	second-class citizens in regexp ranges, as in
+	http://mid.gmane.org/18829.34118.709782.704574@parhasard.net .
+
 2010-01-29  Ben Wing  <ben@xemacs.org>
 
 	* automated/search-tests.el:
--- a/tests/automated/regexp-tests.el	Sat Jan 30 15:47:37 2010 +0000
+++ b/tests/automated/regexp-tests.el	Sat Jan 30 19:23:43 2010 +0000
@@ -582,3 +582,19 @@
   (replace-match "\\U" t)
   (Assert (and (bobp) (eobp))))
 
+;; Control-1 characters were second-class citizens in regexp ranges
+;; for a while there.  Addressed in Ben's Mercurial changeset
+;; 2e15c29cc2b3; attempt to ensure this doesn't happen again.
+(Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "a") 0)
+(Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "é") nil)
+;; Gave nil in 21.5 for a couple of years.
+(Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "\x80") 0)
+(Assert-eql (string-match "[\x00-\x7f]\\|[\x80-\x9f]" "\x80") 0)
+;; Gave nil
+(Assert-eql (string-match "[\x7f\x80-\x9f]" "\x80") 0)
+(Assert-eql (string-match "[\x80-\x9f]" "\x80") 0)
+(Assert-eql (string-match "[\x7f\x80-\x9e]" "\x80") 0)
+;; Used to succeed even with the bug.
+(Assert-eql (string-match "[\x7f\x80\x9f]" "\x80") 0)
+(Assert-eql (string-match "[\x7e\x80-\x9f]" "\x80") 0)
+(Assert-eql (string-match "[\x7f\x81-\x9f]" "\x81") 0)