re.c: stop a wrong warning of "flags ignored" on Regexp.new(//)
[Bug #18669]
This commit is contained in:
parent
3a70d4cd60
commit
c499a4c28a
2
re.c
2
re.c
@ -3557,7 +3557,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
|
||||
if (RB_TYPE_P(src, T_REGEXP)) {
|
||||
VALUE re = src;
|
||||
|
||||
if (opts != Qundef) {
|
||||
if (opts != Qnil) {
|
||||
rb_warn("flags ignored");
|
||||
}
|
||||
rb_reg_check(re);
|
||||
|
@ -557,6 +557,8 @@ class TestRegexp < Test::Unit::TestCase
|
||||
def test_initialize
|
||||
assert_raise(ArgumentError) { Regexp.new }
|
||||
assert_equal(/foo/, assert_warning(/ignored/) {Regexp.new(/foo/, Regexp::IGNORECASE)})
|
||||
assert_equal(/foo/, assert_no_warning(/ignored/) {Regexp.new(/foo/)})
|
||||
assert_equal(/foo/, assert_no_warning(/ignored/) {Regexp.new(/foo/, timeout: nil)})
|
||||
|
||||
assert_equal(Encoding.find("US-ASCII"), Regexp.new("b..", nil, "n").encoding)
|
||||
assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")])
|
||||
|
Loading…
x
Reference in New Issue
Block a user