From b79bf14ff26e11765c1605c7da9a3e72902c92d8 Mon Sep 17 00:00:00 2001 From: nari Date: Thu, 2 Aug 2012 02:47:12 +0000 Subject: [PATCH] * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821] * test/ruby/test_gc.rb: add test-case for this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ gc.c | 2 +- test/ruby/test_gc.rb | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b2d7c77431..9c7c6075a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Aug 2 11:39:25 2012 Narihiro Nakamura + + * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821] + + * test/ruby/test_gc.rb: add test-case for this bug. + Thu Aug 2 10:51:12 2012 Martin Bosslet * ext/openssl/lib/openssl/digest.rb diff --git a/gc.c b/gc.c index dcf90de6d4..13e572f31d 100644 --- a/gc.c +++ b/gc.c @@ -672,7 +672,7 @@ static VALUE gc_profile_enable_get(VALUE self) { rb_objspace_t *objspace = &rb_objspace; - return objspace->profile.run; + return objspace->profile.run ? Qtrue : Qfalse; } /* diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index f32a381239..39716eb7e2 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -109,4 +109,13 @@ class TestGc < Test::Unit::TestCase assert_in_out_err([env, "-W1", "-e", "exit"], "", [], [], "[ruby-core:39795]") assert_in_out_err([env, "-w", "-e", "exit"], "", [], /heap_min_slots=100000/, "[ruby-core:39795]") end + + def test_profiler_enabled + GC::Profiler.enable + assert_equal(true, GC::Profiler.enabled?) + GC::Profiler.disable + assert_equal(false, GC::Profiler.enabled?) + ensure + GC::Profiler.disable + end end