summaryrefslogtreecommitdiff
path: root/test/dbm
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-07 09:39:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-07 09:39:12 +0000
commitd92f10ac061b38952747aff06225019e7a6d37de (patch)
tree8fb3a8c664ba119a9086022bfca6df4f233527ec /test/dbm
parent1b0f90ca333ddbf7ed57eba28465fbb922daa957 (diff)
add freeze test for dbm and gdbm.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dbm')
-rw-r--r--test/dbm/test_dbm.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb
new file mode 100644
index 0000000..f919890
--- /dev/null
+++ b/test/dbm/test_dbm.rb
@@ -0,0 +1,31 @@
+require 'test/unit/testsuite'
+require 'test/unit/testcase'
+
+begin
+ require 'dbm'
+rescue LoadError
+end
+
+if defined? DBM
+ require 'tmpdir'
+ require 'fileutils'
+
+ class TestDBM < Test::Unit::TestCase
+ TMPROOT = "#{Dir.tmpdir}/ruby-gdbm.#{$$}"
+
+ def setup
+ Dir.mkdir TMPROOT
+ end
+
+ def teardown
+ FileUtils.rm_rf TMPROOT if File.directory?(TMPROOT)
+ end
+
+ def test_freeze
+ DBM.open("#{TMPROOT}/a.dbm") {|d|
+ d.freeze
+ assert_raises(TypeError) { d["k"] = "v" }
+ }
+ end
+ end
+end