diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | test/dbm/test_dbm.rb | 31 | ||||
-rw-r--r-- | test/gdbm/test_gdbm.rb | 7 |
4 files changed, 40 insertions, 1 deletions
@@ -2204,7 +2204,7 @@ Sun Feb 1 05:30:06 2004 Tanaka Akira <akr@m17n.org> * lib/open-uri.rb (URI::Generic#find_proxy): warn HTTP_PROXY. raise an errror on non-http proxy URI. - (OpenURI::Buffer#<<): make a tempfile binmode. [ruby-talk:90792] + (OpenURI::Buffer#<<): make a tempfile binmode. [ruby-talk:90793] Sun Feb 1 00:57:41 2004 Kouhei Sutou <kou@cozmixng.org> @@ -774,6 +774,7 @@ sample/wsdl/googleSearch/wsdlDriver.rb sample/wsdl/raa/raa.wsdl sample/wsdl/raa/soap4r.rb test/csv/test_csv.rb +test/dbm/test_dbm.rb test/digest/test_digest.rb test/drb/drbtest.rb test/drb/test_acl.rb diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb new file mode 100644 index 0000000000..f9198903a3 --- /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 diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb index a4bddfe078..ca0110cd91 100644 --- a/test/gdbm/test_gdbm.rb +++ b/test/gdbm/test_gdbm.rb @@ -29,5 +29,12 @@ if defined? GDBM } assert(v) end + + def test_freeze + GDBM.open("#{TMPROOT}/a.dbm") {|d| + d.freeze + assert_raises(TypeError) { d["k"] = "v" } + } + end end end |