diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_tdb.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/test_tdb.rb b/test/test_tdb.rb index 64f34c0..d7a6a8a 100644 --- a/test/test_tdb.rb +++ b/test/test_tdb.rb @@ -275,10 +275,20 @@ class TestTdb < Test::Unit::TestCase assert ! @tdb.include?("hello") end - def test_repack - @tdb = TDB.new(nil) + def test_repack_file + assert_nothing_raised do + @tmp = Tempfile.new('tdb') + File.unlink(@tmp.path) + end + @tdb = TDB.new(@tmp.path) @tdb["hello"] = "world" assert_equal @tdb, @tdb.repack assert_equal "world", @tdb["hello"] end if TDB.method_defined?(:repack) + + def test_repack_mem + @tdb = TDB.new(nil) + @tdb["hello"] = "world" + assert_raises(TDB::ERR::EINVAL) { @tdb.repack } + end if TDB.method_defined?(:repack) end |