mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
7adbfbb793
commit
fcce99c52d
3 changed files with 11 additions and 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.
|
* 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>
|
Fri Oct 17 19:46:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* tool/ifchange, win32/ifchange.bat: --timestamp option added.
|
* tool/ifchange, win32/ifchange.bat: --timestamp option added.
|
||||||
|
|
2
re.c
2
re.c
|
@ -2795,7 +2795,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
|
||||||
char *kcode = StringValuePtr(argv[2]);
|
char *kcode = StringValuePtr(argv[2]);
|
||||||
if (kcode[0] == 'n' || kcode[1] == 'N') {
|
if (kcode[0] == 'n' || kcode[1] == 'N') {
|
||||||
enc = rb_ascii8bit_encoding();
|
enc = rb_ascii8bit_encoding();
|
||||||
flags |= ARG_ENCODING_FIXED;
|
flags |= ARG_ENCODING_NONE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_warn("encoding option is ignored - %s", kcode);
|
rb_warn("encoding option is ignored - %s", kcode);
|
||||||
|
|
|
@ -272,8 +272,9 @@ class TestRegexp < Test::Unit::TestCase
|
||||||
Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join
|
Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join
|
||||||
end
|
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("bar", "foobarbaz"[Regexp.new("b..", nil, "n")])
|
||||||
|
assert_equal(//n, Regexp.new("", nil, "n"))
|
||||||
|
|
||||||
assert_raise(RegexpError) { Regexp.new(")(") }
|
assert_raise(RegexpError) { Regexp.new(")(") }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue