ruby-changes:60785
From: Nobuyoshi <ko1@a...>
Date: Wed, 15 Apr 2020 16:07:05 +0900 (JST)
Subject: [ruby-changes:60785] a9567cc2bf (master): Added test for `debug_level:` option of `RubyVM::InstructionSequence.compile`
https://git.ruby-lang.org/ruby.git/commit/?id=a9567cc2bf From a9567cc2bfad37cc22b3efe0971ba85bd9c1df34 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 15 Apr 2020 14:27:38 +0900 Subject: Added test for `debug_level:` option of `RubyVM::InstructionSequence.compile` diff --git a/bootstraptest/test_insns.rb b/bootstraptest/test_insns.rb index cb54d0d..abfb53f 100644 --- a/bootstraptest/test_insns.rb +++ b/bootstraptest/test_insns.rb @@ -438,3 +438,8 @@ tests.compact.each {|(insn, expr, *a)| https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_insns.rb#L438 assert_equal 'true', progn, 'trace_' + insn, *a end } + +assert_normal_exit("#{<<-"begin;"}\n#{<<-'end;'}") +begin; + RubyVM::InstructionSequence.compile("", debug_level: 5) +end; diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 02c3967..960b7b7 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -571,4 +571,12 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_iseq.rb#L571 assert_not_nil(invokebuiltin) assert_equal([:func_ptr, :argc, :index, :name], invokebuiltin[1].keys) end + + def test_iseq_option_debug_level + assert_raise(TypeError) {ISeq.compile("", debug_level: "")} + assert_ruby_status([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + RubyVM::InstructionSequence.compile("", debug_level: 5) + end; + end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/