summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-06 03:13:50 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-06 03:13:50 +0000
commitc2f5a574034cacd938d5af888646585c850f2747 (patch)
tree31fa2313b484d48843bdf4342daca0689408c0c4 /test
parent54c40f3db59d6875de0c2c0f47ab7edce0bd3f43 (diff)
* vm_trace.c: TracePoint#enable should not cause an error
when it is already enabled. TracePoint#disable is too. [ruby-core:50561] [ruby-trunk - Bug #7513] * test/ruby/test_settracefunc.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_settracefunc.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index 6ffb2dc6e4..6775b72b89 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -623,6 +623,16 @@ class TestSetTraceFunc < Test::Unit::TestCase
}
foo
assert_equal([:foo], ary)
+
+ trace = TracePoint.new{}
+ begin
+ assert_equal(false, trace.enable)
+ assert_equal(true, trace.enable)
+ trace.enable{}
+ assert_equal(true, trace.enable)
+ ensure
+ trace.disable
+ end
end
def test_tracepoint_disable
@@ -637,6 +647,14 @@ class TestSetTraceFunc < Test::Unit::TestCase
foo
trace.disable
assert_equal([:foo, :foo], ary)
+
+ trace = TracePoint.new{}
+ trace.enable{
+ assert_equal(true, trace.disable)
+ assert_equal(false, trace.disable)
+ trace.disable{}
+ assert_equal(false, trace.disable)
+ }
end
def test_tracepoint_enabled