Permalink
Browse files

add assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 460bb8a commit 1efa14169ac0b3f55b9026985095ca256c1315e9 @akr akr committed Feb 19, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 test/dbm/test_dbm.rb
View
@@ -110,6 +110,8 @@ def test_dbmfile_suffix
assert(File.zero?(dirname))
when /\bGDBM\b/
assert_equal(%w[.dir .pag], suffixes)
+ assert(!File.zero?(pagname))
+ assert(!File.zero?(dirname))
pag = File.binread(pagname, 16)
pag_magics = [
0x13579ace, # GDBM_OMAGIC
@@ -124,11 +126,14 @@ def test_dbmfile_suffix
end
when /\bBerkeley DB\b/
assert_equal(%w[.db], suffixes)
+ assert(!File.zero?(dbname))
db = File.binread(dbname, 16)
assert(db[0,4].unpack("N") == [0x00061561] || # Berkeley DB 1
db[12,4].unpack("L") == [0x00061561]) # Berkeley DBM 2 or later.
when /\bQDBM\b/
assert_equal(%w[.dir .pag], suffixes)
+ assert(!File.zero?(pagname))
+ assert(!File.zero?(dirname))
dir = File.binread(dirname, 16)
assert_equal("[depot]\0\v", dir[0, 9])
pag = File.binread(pagname, 16)

0 comments on commit 1efa141

Please sign in to comment.