1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add freeze test for dbm and gdbm.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2004-05-07 09:39:12 +00:00
parent 1b0f90ca33
commit d92f10ac06
4 changed files with 40 additions and 1 deletions

View file

@ -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>

View file

@ -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

31
test/dbm/test_dbm.rb Normal file
View file

@ -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

View file

@ -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