summaryrefslogtreecommitdiff
path: root/test/gdbm
diff options
context:
space:
mode:
Diffstat (limited to 'test/gdbm')
-rw-r--r--test/gdbm/test_gdbm.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb
index ca0110cd91..c90f4a6074 100644
--- a/test/gdbm/test_gdbm.rb
+++ b/test/gdbm/test_gdbm.rb
@@ -21,7 +21,7 @@ if defined? GDBM
FileUtils.rm_rf TMPROOT if File.directory?(TMPROOT)
end
- def test_open
+ def test_reader_open
GDBM.open("#{TMPROOT}/a.dbm") {}
v = GDBM.open("#{TMPROOT}/a.dbm", nil, GDBM::READER) {|d|
assert_raises(GDBMError) { d["k"] = "v" }
@@ -30,6 +30,18 @@ if defined? GDBM
assert(v)
end
+ def test_newdb_open
+ GDBM.open("#{TMPROOT}/a.dbm") {|dbm|
+ dbm["k"] = "v"
+ }
+ v = GDBM.open("#{TMPROOT}/a.dbm", nil, GDBM::NEWDB) {|d|
+ assert_equal(0, d.length)
+ assert_nil(d["k"])
+ true
+ }
+ assert(v)
+ end
+
def test_freeze
GDBM.open("#{TMPROOT}/a.dbm") {|d|
d.freeze