summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 14:12:49 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 14:12:49 +0000
commit1343c89ecb7b0527d514951be24b655247e5ed77 (patch)
tree0f0e256916df3b5c2fa377fd9ce346ee9da16786 /test
parentcaa4dfa2bb2d819e6835ca135c9ec205e6cf6833 (diff)
merge revision(s) 50982,50983: [Backport #11291]
* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object when passed object is a special const, instead of SEGV. Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291] * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/objspace/test_objspace.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index dbd070b969..868a46e543 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -234,6 +234,15 @@ class TestObjSpace < Test::Unit::TestCase
assert_match /"method":"#{loc.base_label}"/, info
end
+ def test_dump_special_consts
+ # [ruby-core:69692] [Bug #11291]
+ assert_equal('{}', ObjectSpace.dump(nil))
+ assert_equal('{}', ObjectSpace.dump(true))
+ assert_equal('{}', ObjectSpace.dump(false))
+ assert_equal('{}', ObjectSpace.dump(0))
+ assert_equal('{}', ObjectSpace.dump(:foo))
+ end
+
def test_dump_all
entry = /"bytesize":11, "value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":/