summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-30 15:19:49 +0900
committerGitHub <noreply@github.com>2020-11-30 15:19:49 +0900
commit555bd83a8e8b1e859f698089cbbd9ad938159a0e (patch)
treefb9ff23ae3bf790d9af16d76dae9baba95e1dd93 /test
parent73a337e21461469290005f169c05bc1791112d67 (diff)
Raise when loading unprovided builtin function [Bug #17192]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3622 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_iseq.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 78be07dc78..e3ca1ba926 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -590,6 +590,21 @@ class TestISeq < Test::Unit::TestCase
assert_equal([:func_ptr, :argc, :index, :name], invokebuiltin[1].keys)
end
+ def test_iseq_builtin_load
+ Tempfile.create(["builtin", ".iseq"]) do |f|
+ f.binmode
+ f.write(RubyVM::InstructionSequence.of(1.method(:abs)).to_binary)
+ f.close
+ assert_separately(["-", f.path], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ bin = File.binread(ARGV[0])
+ assert_raise(ArgumentError) do
+ RubyVM::InstructionSequence.load_from_binary(bin)
+ end
+ end;
+ end
+ end
+
def test_iseq_option_debug_level
assert_raise(TypeError) {ISeq.compile("", debug_level: "")}
assert_ruby_status([], "#{<<~"begin;"}\n#{<<~'end;'}")