mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[Feature #17136] Remove special behavior from $KCODE
This commit is contained in:
parent
3db21cf25f
commit
85aabef023
Notes:
git
2020-11-28 18:52:00 +09:00
2 changed files with 0 additions and 25 deletions
15
re.c
15
re.c
|
@ -3919,19 +3919,6 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
|
|||
return val;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
kcode_getter(ID _x, VALUE *_y)
|
||||
{
|
||||
rb_warn("variable $KCODE is no longer effective");
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static void
|
||||
kcode_setter(VALUE val, ID id, VALUE *_)
|
||||
{
|
||||
rb_warn("variable $KCODE is no longer effective; ignored");
|
||||
}
|
||||
|
||||
static VALUE
|
||||
ignorecase_getter(ID _x, VALUE *_y)
|
||||
{
|
||||
|
@ -4062,8 +4049,6 @@ Init_Regexp(void)
|
|||
rb_gvar_ractor_local("$+");
|
||||
|
||||
rb_define_virtual_variable("$=", ignorecase_getter, ignorecase_setter);
|
||||
rb_define_virtual_variable("$KCODE", kcode_getter, kcode_setter);
|
||||
rb_define_virtual_variable("$-K", kcode_getter, kcode_setter);
|
||||
|
||||
rb_cRegexp = rb_define_class("Regexp", rb_cObject);
|
||||
rb_define_alloc_func(rb_cRegexp, rb_reg_s_alloc);
|
||||
|
|
|
@ -661,21 +661,11 @@ class TestRegexp < Test::Unit::TestCase
|
|||
assert_equal('foobazquux/foobazquux', result, bug8856)
|
||||
end
|
||||
|
||||
def test_KCODE
|
||||
assert_nil($KCODE)
|
||||
assert_nothing_raised { $KCODE = nil }
|
||||
end
|
||||
|
||||
def test_ignorecase
|
||||
assert_equal(false, $=)
|
||||
assert_nothing_raised { $= = nil }
|
||||
end
|
||||
|
||||
def test_KCODE_warning
|
||||
assert_warning(/variable \$KCODE is no longer effective; ignored/) { $KCODE = nil }
|
||||
assert_warning(/variable \$KCODE is no longer effective/) { $KCODE = nil }
|
||||
end
|
||||
|
||||
def test_ignorecase_warning
|
||||
assert_warning(/variable \$= is no longer effective; ignored/) { $= = nil }
|
||||
assert_warning(/variable \$= is no longer effective/) { $= }
|
||||
|
|
Loading…
Add table
Reference in a new issue