From 34176b023eb42478bad22481d90d6223b5a31d48 Mon Sep 17 00:00:00 2001 From: tmm1 Date: Sun, 24 Nov 2013 00:22:19 +0000 Subject: * ext/objspace/objspace_dump.c: test fixes and win32 compatibility git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/objspace/test_objspace.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test/objspace') diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 850b523862..f3bb3cd8c6 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -239,30 +239,33 @@ class TestObjSpace < Test::Unit::TestCase end def test_dump_all - entry = /"value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please"/ - assert_in_out_err(%w[-robjspace], <<-'end;', entry) + entry = /"bytesize":11, "value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":/ + + assert_in_out_err(%w[-robjspace], <<-'end;') do |output, error| def dump_my_heap_please ObjectSpace.trace_object_allocations_start GC.start - "TEST STRING".force_encoding("UTF-8") + str = "TEST STRING".force_encoding("UTF-8") ObjectSpace.dump_all(output: :stdout) end dump_my_heap_please end; + assert_match(entry, output.grep(/TEST STRING/).join("\n")) + end assert_in_out_err(%w[-robjspace], <<-'end;') do |(output), (error)| def dump_my_heap_please ObjectSpace.trace_object_allocations_start GC.start - "TEST STRING".force_encoding("UTF-8") + str = "TEST STRING".force_encoding("UTF-8") ObjectSpace.dump_all().path end puts dump_my_heap_please end; skip if /is not supported/ =~ error - assert_match(entry, File.read(output)) + assert_match(entry, File.readlines(output).grep(/TEST STRING/).join("\n")) File.unlink(output) end end -- cgit v1.2.3