summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-19 06:25:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-19 06:25:01 +0000
commitc92322b537265ff40e7669763c49a128c1f1992e (patch)
treee39d06a21181ea48e406b665bded0e25778e2bd7 /test
parent7594a99322d95040637b3b46ee81bf53592bf40a (diff)
objspace_dump.c: special const
* ext/objspace/objspace_dump.c: support special constant objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/objspace/test_objspace.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 0ac54bf..de71994 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -255,11 +255,17 @@ class TestObjSpace < Test::Unit::TestCase
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))
+ assert_equal('null', ObjectSpace.dump(nil))
+ assert_equal('true', ObjectSpace.dump(true))
+ assert_equal('false', ObjectSpace.dump(false))
+ assert_equal('0', ObjectSpace.dump(0))
+ assert_equal('{"type":"SYMBOL", "value":"foo"}', ObjectSpace.dump(:foo))
+ end
+
+ def test_dump_dynamic_symbol
+ dump = ObjectSpace.dump(("foobar%x" % rand(0x10000)).to_sym)
+ assert_match /"type":"SYMBOL"/, dump
+ assert_match /"value":"foobar\h+"/, dump
end
def test_dump_all