summaryrefslogtreecommitdiff
path: root/ext/dbm/testdbm.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-06 06:51:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-06 06:51:31 +0000
commit7752fb4205ecf5de2021a7924c213516c8a8d858 (patch)
tree112f7e4154e500bf48240f8b4cfaab09e351fd6e /ext/dbm/testdbm.rb
parent6154ce97a7915ac70326c007ee04a22fe5742e04 (diff)
* object.c (rb_obj_methods): list singleton methods if recur
argument is false; list all methods otherwise. * numeric.c (num_step): double epsilon to make "1.1.step(1.5,0.1)" to work. * ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace select(index..). * ext/sdbm/init.c (fsdbm_values_at): ditto. * ext/dbm/dbm.c (fdbm_values_at): ditto. * ext/dbm/dbm.c (DBM::VERSION): defined. * ext/gdbm/testgdbm.rb: replace select with values_at. * ext/sdbm/testsdbm.rb: ditto. * ext/dbm/testdbm.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dbm/testdbm.rb')
-rw-r--r--ext/dbm/testdbm.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/dbm/testdbm.rb b/ext/dbm/testdbm.rb
index 0be627d346..7ccb3d7b23 100644
--- a/ext/dbm/testdbm.rb
+++ b/ext/dbm/testdbm.rb
@@ -32,9 +32,12 @@ class TestDBM < RUNIT::TestCase
assert_instance_of(DBM, @dbm = DBM.new(@path))
# prepare to make readonly DBM file
- DBM.open("tmptest_dbm_rdonly", 0400) {|dbm|
+ DBM.open("tmptest_dbm_rdonly") {|dbm|
dbm['foo'] = 'FOO'
}
+
+ File.chmod(0400, *Dir.glob("tmptest_dbm_rdonly.*"))
+
assert_instance_of(DBM, @dbm_rdonly = DBM.new("tmptest_dbm_rdonly", nil))
end
def teardown
@@ -83,7 +86,7 @@ class TestDBM < RUNIT::TestCase
}
begin
sleep 1
- assert_exception(Errno::EWOULDBLOCK) {
+ assert_exception(Errno::EWOULDBLOCK, "NEVER MIND IF YOU USE Berkeley DB3") {
begin
assert_instance_of(DBM, dbm2 = DBM.open("tmptest_dbm", 0644))
rescue Errno::EAGAIN, Errno::EACCES, Errno::EINVAL
@@ -154,7 +157,7 @@ class TestDBM < RUNIT::TestCase
def test_s_open_error
assert_instance_of(DBM, dbm = DBM.open("tmptest_dbm", 0))
- assert_exception(Errno::EACCES) {
+ assert_exception(Errno::EACCES, "NEVER MIND IF YOU USE Berkeley DB3") {
DBM.open("tmptest_dbm", 0)
}
dbm.close
@@ -245,11 +248,11 @@ class TestDBM < RUNIT::TestCase
assert_equals(values.reverse, @dbm.indexes(*keys.reverse))
end
- def test_select
+ def test_values_at
keys = %w(foo bar baz)
values = %w(FOO BAR BAZ)
@dbm[keys[0]], @dbm[keys[1]], @dbm[keys[2]] = values
- assert_equals(values.reverse, @dbm.select(*keys.reverse))
+ assert_equals(values.reverse, @dbm.values_at(*keys.reverse))
end
def test_select_with_block