diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-21 15:38:59 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-21 15:38:59 +0000 |
commit | da7976235fbc2986925969646071bebe3702e49f (patch) | |
tree | 83bbf6a8e03cf990369feabe6c1c9d45c69f4c85 /spec/ruby/core/tracepoint/disable_spec.rb | |
parent | b8e389a0f3226c90e96e02e6396686a3bef6a456 (diff) | |
download | ruby-da7976235fbc2986925969646071bebe3702e49f.tar.gz |
Update to ruby/spec@7a16e01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/tracepoint/disable_spec.rb')
-rw-r--r-- | spec/ruby/core/tracepoint/disable_spec.rb | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/spec/ruby/core/tracepoint/disable_spec.rb b/spec/ruby/core/tracepoint/disable_spec.rb index e936d3498d..25d54502ab 100644 --- a/spec/ruby/core/tracepoint/disable_spec.rb +++ b/spec/ruby/core/tracepoint/disable_spec.rb @@ -1,34 +1,37 @@ require_relative '../../spec_helper' describe 'TracePoint#disable' do - def test; end it 'returns true if trace was enabled' do called = false - trace = TracePoint.new(:call) do |tp| + trace = TracePoint.new(:line) do |tp| called = true end trace.enable - trace.disable.should be_true + begin + line_event = true + ensure + ret = trace.disable + ret.should == true + end + called.should == true # Check the TracePoint is disabled called = false - test + line_event = true called.should == false end it 'returns false if trace was disabled' do - event_name, method_name = nil - trace = TracePoint.new(:call) do |tp| - event_name = tp.event - method_name = tp.method_id + called = false + trace = TracePoint.new(:line) do |tp| + called = true end - trace.disable.should be_false - event_name, method_name = nil - test - method_name.equal?(:test).should be_false - event_name.should equal(nil) + line_event = true + trace.disable.should == false + line_event = true + called.should == false end it 'is disabled within a block & is enabled outside the block' do @@ -37,19 +40,19 @@ describe 'TracePoint#disable' do trace.enable begin trace.disable { enabled = trace.enabled? } - enabled.should be_false - trace.enabled?.should be_true + enabled.should == false + trace.enabled?.should == true ensure trace.disable end end - it 'is disabled within a block & also returns false when its called with a block' do + it 'returns the return value of the block' do trace = TracePoint.new(:line) {} trace.enable begin - trace.disable { trace.enabled? }.should == false - trace.enabled?.should equal(true) + trace.disable { 42 }.should == 42 + trace.enabled?.should == true ensure trace.disable end @@ -57,14 +60,13 @@ describe 'TracePoint#disable' do ruby_bug "#14057", ""..."2.5" do it 'can accept param within a block but it should not yield arguments' do - event_name = nil trace = TracePoint.new(:line) {} trace.enable begin trace.disable do |*args| args.should == [] end - trace.enabled?.should be_true + trace.enabled?.should == true ensure trace.disable end |