diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-18 10:29:06 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-18 10:29:06 +0000 |
commit | fcce99c52d786e336ab0a8f8205a04841fc743d0 (patch) | |
tree | 2d45ec7eeace986f3226d9733639e44955f98b34 | |
parent | 7adbfbb7937f52a9df8792048882a93db466e52e (diff) |
* re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of
ARG_ENCODING_FIXED for Regexp.new("", nil, "n"). [ruby-dev:36761]
* test/ruby/test_regexp.rb (TestRegexp#test_initialize): test
updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 3 |
3 files changed, 11 insertions, 2 deletions
@@ -27,6 +27,14 @@ Fri Oct 17 22:04:38 2008 wanabe <s.wanabe@gmail.com> * array.c: recycle shared-array when it isn't referenced. +Fri Oct 17 20:29:26 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of + ARG_ENCODING_FIXED for Regexp.new("", nil, "n"). [ruby-dev:36761] + + * test/ruby/test_regexp.rb (TestRegexp#test_initialize): test + updated. + Fri Oct 17 19:46:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * tool/ifchange, win32/ifchange.bat: --timestamp option added. @@ -2795,7 +2795,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) char *kcode = StringValuePtr(argv[2]); if (kcode[0] == 'n' || kcode[1] == 'N') { enc = rb_ascii8bit_encoding(); - flags |= ARG_ENCODING_FIXED; + flags |= ARG_ENCODING_NONE; } else { rb_warn("encoding option is ignored - %s", kcode); diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index ad222c5483..fdfef04b4d 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -272,8 +272,9 @@ class TestRegexp < Test::Unit::TestCase Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join end - assert_equal(Encoding.find("ASCII-8BIT"), Regexp.new("b..", nil, "n").encoding) + assert_equal(Encoding.find("US-ASCII"), Regexp.new("b..", nil, "n").encoding) assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")]) + assert_equal(//n, Regexp.new("", nil, "n")) assert_raise(RegexpError) { Regexp.new(")(") } end |