diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-08-31 22:13:34 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-11-28 18:51:36 +0900 |
commit | 85aabef023e1a2e81c308ad98741137c73d4d80b (patch) | |
tree | bd71d9484743757b072a0d4d781f489daeaf84cd | |
parent | 3db21cf25f9c0830fafd9f72f228826515a5b566 (diff) |
[Feature #17136] Remove special behavior from $KCODE
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3483
-rw-r--r-- | re.c | 15 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 10 |
2 files changed, 0 insertions, 25 deletions
@@ -3920,19 +3920,6 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp) } 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) { rb_warn("variable $= is no longer effective"); @@ -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); diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 6243ead1ff..e124fc7952 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -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/) { $= } |