From d4b13c817667479af84f4af58afe05138d53ba3a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 18 Aug 2011 09:01:59 +0000 Subject: add fork test Just in case... --- test/test_tdb.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/test_tdb.rb b/test/test_tdb.rb index 7e77f14..7864ace 100644 --- a/test/test_tdb.rb +++ b/test/test_tdb.rb @@ -275,6 +275,23 @@ class TestTdb < Test::Unit::TestCase assert ! @tdb.include?("hello") end + def test_fork + @tmp = Tempfile.new('tdb') + File.unlink(@tmp.path) + @tdb = TDB.new(@tmp.path) + @tdb["hello"] = "world" + pid = fork do + assert_equal "world", @tdb["hello"] + @tdb["hello"] = "WORLD" + @tdb["#$$"] = "NO" + exit 0 + end + _, status = Process.waitpid2(pid) + assert status.success?, status.inspect + assert_equal "WORLD", @tdb["hello"] + assert_equal "NO", @tdb[pid.to_s] + end + def test_fetch_reuse_buf assert_nothing_raised do @tmp = Tempfile.new('tdb') -- cgit v1.2.3-24-ge0c7