diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 01:06:24 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 01:06:24 +0000 |
commit | 0e586b35b80985097489c68e8085457d91165696 (patch) | |
tree | f8591c9934ab873db13a2f37dbee6ebe6067516f | |
parent | 01cd3467fbd3e9ea212063d0a7405642b8746b94 (diff) | |
download | ruby-0e586b35b80985097489c68e8085457d91165696.tar.gz |
* re.c (rb_reg_initialize_m): fix wrong index for the lang
option's value 'N'. reported by Masaya TARUI via IRC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 4 |
3 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed May 12 09:21:05 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * re.c (rb_reg_initialize_m): fix wrong index for the lang + option's value 'N'. reported by Masaya TARUI via IRC. + Tue May 11 23:07:22 2010 Tanaka Akira <akr@fsij.org> * ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants. @@ -2894,7 +2894,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) enc = 0; if (argc == 3 && !NIL_P(argv[2])) { char *kcode = StringValuePtr(argv[2]); - if (kcode[0] == 'n' || kcode[1] == 'N') { + if (kcode[0] == 'n' || kcode[0] == 'N') { enc = rb_ascii8bit_encoding(); flags |= ARG_ENCODING_NONE; } diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 00c2ddb5e9..888a0cb9e5 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -286,6 +286,10 @@ class TestRegexp < Test::Unit::TestCase assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")]) assert_equal(//n, Regexp.new("", nil, "n")) + arg_encoding_none = 32 # ARG_ENCODING_NONE is implementation defined value + assert_equal(arg_encoding_none, Regexp.new("", nil, "n").options) + assert_equal(arg_encoding_none, Regexp.new("", nil, "N").options) + assert_raise(RegexpError) { Regexp.new(")(") } end |