From 76a68577ce61c02689ad450c054b69bf1a8d6f60 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 4 Dec 2010 15:56:11 -0800 Subject: add support for "clear" and "repack" methods TDB#clear maps to tdb_wipe_all and TDB#repack maps to TDB#repack. --- test/test_tdb.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/test_tdb.rb b/test/test_tdb.rb index bd25203..64f34c0 100644 --- a/test/test_tdb.rb +++ b/test/test_tdb.rb @@ -267,4 +267,18 @@ class TestTdb < Test::Unit::TestCase TDB.constants.each { |const| values[TDB.const_get(const)] = const } assert_equal TDB.constants.size, values.size end + + def test_clear + @tdb = TDB.new(nil) + @tdb["hello"] = "world" + assert_equal @tdb, @tdb.clear + assert ! @tdb.include?("hello") + end + + def test_repack + @tdb = TDB.new(nil) + @tdb["hello"] = "world" + assert_equal @tdb, @tdb.repack + assert_equal "world", @tdb["hello"] + end if TDB.method_defined?(:repack) end -- cgit v1.2.3-24-ge0c7