summaryrefslogtreecommitdiff
path: root/test/dbm/test_dbm.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-18 10:06:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-18 10:06:24 +0000
commit90cc116431fa4e946d8c8ea9cdba7b492da11ea4 (patch)
tree4f027c5faa303ba0a6883a180148aad438392055 /test/dbm/test_dbm.rb
parentfc0111cce1bc77a277b1f098027a898a919f0981 (diff)
simplify a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dbm/test_dbm.rb')
-rw-r--r--test/dbm/test_dbm.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb
index 1483a604dc4..99daee65077 100644
--- a/test/dbm/test_dbm.rb
+++ b/test/dbm/test_dbm.rb
@@ -98,18 +98,18 @@ if defined? DBM
def test_dbmfile_suffix
prefix = File.basename(@path)
- files = Dir.entries(@tmpdir).reject {|f| !f.start_with?(prefix) }.sort
+ suffixes = Dir.entries(@tmpdir).grep(/\A#{Regexp.escape prefix}/) { $' }.sort
case DBM::VERSION
when /\bNDBM\b/
- assert_equal(["#{prefix}.dir", "#{prefix}.pag"], files)
+ assert_equal(%w[.dir .pag], suffixes)
when /\bGDBM\b/
- assert_equal(["#{prefix}.dir", "#{prefix}.pag"], files)
+ assert_equal(%w[.dir .pag], suffixes)
when /\bBerkeley DB\b/
- assert_equal(["#{prefix}.db"], files)
+ assert_equal(%w[.db], suffixes)
when /\bQDBM\b/
- assert_equal(["#{prefix}.dir", "#{prefix}.pag"], files)
+ assert_equal(%w[.dir .pag], suffixes)
end
- if files == ["#{prefix}.db"]
+ if suffixes == %w[.db]
assert_match(/\bBerkeley DB\b/, DBM::VERSION)
end
end