From a1b4816759418ca8fe510e8739622fc5d77ab0f0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 27 Apr 2019 18:53:23 +0200 Subject: Update to ruby/spec@15c9619 --- spec/ruby/core/tracepoint/callee_id_spec.rb | 22 ++++----- spec/ruby/core/tracepoint/disable_spec.rb | 20 ++++---- spec/ruby/core/tracepoint/enable_spec.rb | 56 +++++----------------- .../core/tracepoint/instruction_sequence_spec.rb | 25 ---------- spec/ruby/core/tracepoint/new_spec.rb | 2 +- 5 files changed, 32 insertions(+), 93 deletions(-) delete mode 100644 spec/ruby/core/tracepoint/instruction_sequence_spec.rb (limited to 'spec/ruby/core/tracepoint') diff --git a/spec/ruby/core/tracepoint/callee_id_spec.rb b/spec/ruby/core/tracepoint/callee_id_spec.rb index 39a7413648..d340290d8b 100644 --- a/spec/ruby/core/tracepoint/callee_id_spec.rb +++ b/spec/ruby/core/tracepoint/callee_id_spec.rb @@ -1,19 +1,17 @@ require_relative '../../spec_helper' require_relative 'fixtures/classes' -ruby_version_is '2.4' do - describe "TracePoint#callee_id" do - it "returns the called name of the method being called" do - a = [] - obj = TracePointSpec::ClassWithMethodAlias.new +describe "TracePoint#callee_id" do + it "returns the called name of the method being called" do + a = [] + obj = TracePointSpec::ClassWithMethodAlias.new - TracePoint.new(:call) do |tp| - a << tp.callee_id - end.enable do - obj.m_alias - end - - a.should == [:m_alias] + TracePoint.new(:call) do |tp| + a << tp.callee_id + end.enable do + obj.m_alias end + + a.should == [:m_alias] end end diff --git a/spec/ruby/core/tracepoint/disable_spec.rb b/spec/ruby/core/tracepoint/disable_spec.rb index 25d54502ab..612ca3c25a 100644 --- a/spec/ruby/core/tracepoint/disable_spec.rb +++ b/spec/ruby/core/tracepoint/disable_spec.rb @@ -58,18 +58,16 @@ describe 'TracePoint#disable' do end end - ruby_bug "#14057", ""..."2.5" do - it 'can accept param within a block but it should not yield arguments' do - trace = TracePoint.new(:line) {} - trace.enable - begin - trace.disable do |*args| - args.should == [] - end - trace.enabled?.should == true - ensure - trace.disable + it 'can accept param within a block but it should not yield arguments' do + trace = TracePoint.new(:line) {} + trace.enable + begin + trace.disable do |*args| + args.should == [] end + trace.enabled?.should == true + ensure + trace.disable end end end diff --git a/spec/ruby/core/tracepoint/enable_spec.rb b/spec/ruby/core/tracepoint/enable_spec.rb index 52c2248656..6eeec1d5db 100644 --- a/spec/ruby/core/tracepoint/enable_spec.rb +++ b/spec/ruby/core/tracepoint/enable_spec.rb @@ -58,16 +58,14 @@ describe 'TracePoint#enable' do end.enable { event_name.should equal(:line) } end - ruby_bug "#14057", ""..."2.5" do - it 'can accept arguments within a block but it should not yield arguments' do - event_name = nil - trace = TracePoint.new(:line) { |tp| event_name = tp.event } - trace.enable do |*args| - event_name.should equal(:line) - args.should == [] - end - trace.enabled?.should == false + it 'can accept arguments within a block but it should not yield arguments' do + event_name = nil + trace = TracePoint.new(:line) { |tp| event_name = tp.event } + trace.enable do |*args| + event_name.should equal(:line) + args.should == [] end + trace.enabled?.should == false end it 'enables trace object on calling with a block if it was already enabled' do @@ -193,7 +191,7 @@ describe 'TracePoint#enable' do end describe 'option value' do - it 'excepts Method' do + it 'accepts Method' do trace = TracePoint.new(:call) do |tp| ScratchPad << tp.method_id end @@ -208,7 +206,7 @@ describe 'TracePoint#enable' do ScratchPad.recorded.should == [:foo] end - it 'excepts UnboundMethod' do + it 'accepts UnboundMethod' do trace = TracePoint.new(:call) do |tp| ScratchPad << tp.method_id end @@ -225,7 +223,7 @@ describe 'TracePoint#enable' do ScratchPad.recorded.should == [:foo] end - it 'excepts Proc' do + it 'accepts Proc' do trace = TracePoint.new(:b_call) do |tp| ScratchPad << tp.lineno end @@ -240,36 +238,6 @@ describe 'TracePoint#enable' do ScratchPad.recorded.should == [lineno] lineno.should be_kind_of(Integer) end - - it 'excepts RubyVM::InstructionSequence' do - trace = TracePoint.new(:call) do |tp| - ScratchPad << tp.method_id - end - - obj = Object.new - def obj.foo; end - - iseq = RubyVM::InstructionSequence.of(obj.method(:foo)) - trace.enable(target: iseq) do - obj.foo - end - - ScratchPad.recorded.should == [:foo] - end - end - - it "raises ArgumentError when passed object isn't consisted of InstructionSequence (iseq)" do - trace = TracePoint.new(:call) do |tp| - ScratchPad << tp.method_id - end - - core_method = 'foo bar'.method(:bytes) - RubyVM::InstructionSequence.of(core_method).should == nil - - lambda { - trace.enable(target: core_method) do - end - }.should raise_error(ArgumentError, /specified target is not supported/) end it "raises ArgumentError if target object cannot trigger specified event" do @@ -286,7 +254,7 @@ describe 'TracePoint#enable' do }.should raise_error(ArgumentError, /can not enable any hooks/) end - it "raises ArgumentError if passed not Method/UnboundMethod/Proc/RubyVM::InstructionSequence" do + it "raises ArgumentError if passed not Method/UnboundMethod/Proc" do trace = TracePoint.new(:call) do |tp| end @@ -490,7 +458,7 @@ describe 'TracePoint#enable' do }.should raise_error(ArgumentError, /can not enable any hooks/) end - it "excepts value that could be coerced to Integer" do + it "accepts value that could be coerced to Integer" do trace = TracePoint.new(:line) do |tp| ScratchPad << tp.lineno end diff --git a/spec/ruby/core/tracepoint/instruction_sequence_spec.rb b/spec/ruby/core/tracepoint/instruction_sequence_spec.rb deleted file mode 100644 index 3e3b73cccc..0000000000 --- a/spec/ruby/core/tracepoint/instruction_sequence_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'fixtures/classes' - -ruby_version_is "2.6" do - describe "TracePoint#instruction_sequence" do - it "is an instruction sequence" do - ScratchPad.record [] - - script = <<-CODE - def foo - p :hello - end - CODE - - TracePoint.new(:script_compiled) do |e| - ScratchPad << e.instruction_sequence - end.enable do - eval script - end - - ScratchPad.recorded.size.should == 1 - ScratchPad.recorded[0].class.should == RubyVM::InstructionSequence - end - end -end diff --git a/spec/ruby/core/tracepoint/new_spec.rb b/spec/ruby/core/tracepoint/new_spec.rb index d333fd069a..916d826fdf 100644 --- a/spec/ruby/core/tracepoint/new_spec.rb +++ b/spec/ruby/core/tracepoint/new_spec.rb @@ -55,7 +55,7 @@ describe 'TracePoint.new' do -> { TracePoint.new(o) {}}.should raise_error(TypeError) end - ruby_bug "#140740", ""..."2.5" do + ruby_version_is "2.5" do it 'expects to be called with a block' do -> { TracePoint.new(:line) }.should raise_error(ArgumentError, "must be called with a block") end -- cgit v1.2.3