Sha256: 94f05c28e5a2b5aeb9499449213e8cebb98d876cc84e060a7084663d6295bc4e

Contents?: true

Size: 738 Bytes

Versions: 6

Compression:

Stored size: 738 Bytes

Contents

require "test/unit"
require "glue/hash"

class TestCaseGlueCache < Test::Unit::TestCase # :nodoc: all
	include Glue

	def setup
		@safe_cache = SafeHash.new(Hash.new)
	end

	def teardown
		@safe_cache = nil
	end

	def test_safe_cache
		assert_equal(nil, @safe_cache["no_item"])
		item1 =  "item1"
		@safe_cache["key1"] = item1
		assert_equal(item1, @safe_cache["key1"])

		@safe_cache["rem1"] = item1
		@safe_cache.delete("rem1")
		assert_equal(nil, @safe_cache["rem1"])

		@safe_cache.clear()
		assert_equal(0, @safe_cache.size)

		@safe_cache["i1"] = "i1"
		@safe_cache["i2"] = "i1"
		@safe_cache["i3"] = "i1"
		assert_equal(3, @safe_cache.size)

		assert_equal(3, @safe_cache.values.size)
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
glue-0.16.0 test/glue/tc_hash.rb
glue-0.17.0 test/glue/tc_hash.rb
glue-0.18.0 test/glue/tc_hash.rb
glue-0.18.1 test/glue/tc_hash.rb
glue-0.19.0 test/glue/tc_hash.rb
glue-0.20.0 test/glue/tc_hash.rb