ruby-changes:48857
From: eregon <ko1@a...>
Date: Sat, 2 Dec 2017 02:51:22 +0900 (JST)
Subject: [ruby-changes:48857] eregon:r60975 (trunk): Update to ruby/spec@e2d0d1e
eregon 2017-12-02 02:51:16 +0900 (Sat, 02 Dec 2017) New Revision: 60975 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60975 Log: Update to ruby/spec@e2d0d1e Modified files: trunk/spec/ruby/core/tracepoint/disable_spec.rb trunk/spec/ruby/core/tracepoint/enable_spec.rb Index: spec/ruby/core/tracepoint/enable_spec.rb =================================================================== --- spec/ruby/core/tracepoint/enable_spec.rb (revision 60974) +++ spec/ruby/core/tracepoint/enable_spec.rb (revision 60975) @@ -5,20 +5,21 @@ describe 'TracePoint#enable' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/enable_spec.rb#L5 describe 'without a block' do it 'returns true if trace was enabled' do - event_name, method_name = nil, nil - method_name = [] + event_name = nil trace = TracePoint.new(:call) do |tp| event_name = tp.event - method_name << tp.method_id end test event_name.should == nil trace.enable - test - event_name.should equal(:call) - trace.disable + begin + test + event_name.should equal(:call) + ensure + trace.disable + end end it 'returns false if trace was disabled' do @@ -29,21 +30,27 @@ describe 'TracePoint#enable' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/enable_spec.rb#L30 end trace.enable.should be_false - event_name.should equal(:call) - test - method_name.equal?(:test).should be_true + begin + event_name.should equal(:call) + test + method_name.equal?(:test).should be_true + ensure + trace.disable + end - trace.disable event_name, method_name = nil test method_name.equal?(:test).should be_false event_name.should equal(nil) trace.enable.should be_false - event_name.should equal(:call) - test - method_name.equal?(:test).should be_true - trace.disable + begin + event_name.should equal(:call) + test + method_name.equal?(:test).should be_true + ensure + trace.disable + end end end @@ -71,9 +78,12 @@ describe 'TracePoint#enable' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/enable_spec.rb#L78 enabled = nil trace = TracePoint.new(:line) {} trace.enable - trace.enable { enabled = trace.enabled? } - enabled.should == true - trace.disable + begin + trace.enable { enabled = trace.enabled? } + enabled.should == true + ensure + trace.disable + end end it 'returns value returned by the block' do Index: spec/ruby/core/tracepoint/disable_spec.rb =================================================================== --- spec/ruby/core/tracepoint/disable_spec.rb (revision 60974) +++ spec/ruby/core/tracepoint/disable_spec.rb (revision 60975) @@ -3,18 +3,18 @@ require File.expand_path('../../../spec_ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/disable_spec.rb#L3 describe 'TracePoint#disable' do def test; end it 'returns true if trace was enabled' do - event_name, method_name = nil + called = false trace = TracePoint.new(:call) do |tp| - event_name = tp.event - method_name = tp.method_id + called = true end trace.enable trace.disable.should be_true - event_name, method_name = nil + + # Check the TracePoint is disabled + called = false test - method_name.equal?(:test).should be_false - event_name.should equal(nil) + called.should == false end it 'returns false if trace was disabled' do @@ -35,18 +35,24 @@ describe 'TracePoint#disable' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/disable_spec.rb#L35 enabled = nil trace = TracePoint.new(:line) {} trace.enable - trace.disable { enabled = trace.enabled? } - enabled.should be_false - trace.enabled?.should be_true - trace.disable + begin + trace.disable { enabled = trace.enabled? } + enabled.should be_false + trace.enabled?.should be_true + ensure + trace.disable + end end it 'is disabled within a block & also returns false when its called with a block' do trace = TracePoint.new(:line) {} trace.enable - trace.disable { trace.enabled? }.should == false - trace.enabled?.should equal(true) - trace.disable + begin + trace.disable { trace.enabled? }.should == false + trace.enabled?.should equal(true) + ensure + trace.disable + end end ruby_bug "#14057", "2.0"..."2.5" do @@ -54,11 +60,14 @@ describe 'TracePoint#disable' do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/tracepoint/disable_spec.rb#L60 event_name = nil trace = TracePoint.new(:line) {} trace.enable - trace.disable do |*args| - args.should == [] + begin + trace.disable do |*args| + args.should == [] + end + trace.enabled?.should be_true + ensure + trace.disable end - trace.enabled?.should be_true - trace.disable end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/