diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-13 05:26:00 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-07-13 05:26:00 +0000 |
commit | d8c3672b012ec6eb55e097162c6c638e8d932471 (patch) | |
tree | 570d361546288e014323e46cb92bd49192d3f4a8 /test | |
parent | bebb62e01b6d752756c8cb51794119c490cde77c (diff) | |
download | ruby-d8c3672b012ec6eb55e097162c6c638e8d932471.tar.gz |
* iseq.c (Init_ISeq): undef ISeq.translate and ISeq.load_iseq
to prevent calling super classes' methods.
Without this patch, you can write workaround like:
class << RubyVM::InstructionSequence
def translate; end
undef translate
end
* test/ruby/test_iseq.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_iseq.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index a71ad565f7..dba714aa62 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -235,4 +235,14 @@ class TestISeq < Test::Unit::TestCase end assert_equal([m1, e1.message], [m2, e2.message], feature11951) end + + def test_translate_by_object + assert_separately([], <<-"end;") + class Object + def translate + end + end + assert_equal(0, eval("0")) + end; + end end |