Debian Codegraph @

test/-ext-/hash/test_delete.rb

raw
1 # frozen_string_literal: false
2 require 'test/unit'
3 require '-test-/hash'
4
5 class Test_Hash < Test::Unit::TestCase
6 class TestDelete < Test::Unit::TestCase
7 def test_delete
8 hash = Bug::Hash.new
9 hash[1] = 2
10 called = false
11 assert_equal 1, hash.size
12 assert_equal [2], hash.delete!(1) {called = true}
13 assert_equal false, called, "block called"
14 assert_equal 0, hash.size
15 assert_equal nil, hash.delete!(1) {called = true}
16 assert_equal false, called, "block called"
17 assert_equal 0, hash.size
18 end
19 end
20 end