summaryrefslogtreecommitdiff
path: root/test/ruby/test_weakmap.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r--test/ruby/test_weakmap.rb65
1 files changed, 3 insertions, 62 deletions
diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb
index a30004bce3..5ca6b0fbdd 100644
--- a/test/ruby/test_weakmap.rb
+++ b/test/ruby/test_weakmap.rb
@@ -59,7 +59,7 @@ class TestWeakMap < Test::Unit::TestCase
assert_weak_include(m, k)
end
GC.start
- pend('TODO: failure introduced from 837fd5e494731d7d44786f29e7d6e8c27029806f')
+ skip('TODO: failure introduced from r60440')
assert_not_send([@wm, m, k])
end
alias test_member? test_include?
@@ -82,22 +82,6 @@ class TestWeakMap < Test::Unit::TestCase
@wm.inspect)
end
- def test_delete
- k1 = "foo"
- x1 = Object.new
- @wm[k1] = x1
- assert_equal x1, @wm[k1]
- assert_equal x1, @wm.delete(k1)
- assert_nil @wm[k1]
- assert_nil @wm.delete(k1)
-
- fallback = @wm.delete(k1) do |key|
- assert_equal k1, key
- 42
- end
- assert_equal 42, fallback
- end
-
def test_each
m = __callee__[/test_(.*)/, 1]
x1 = Object.new
@@ -193,17 +177,14 @@ class TestWeakMap < Test::Unit::TestCase
end;
end
- def test_compaction
- omit "compaction is not supported on this platform" unless GC.respond_to?(:compact)
-
- # [Bug #19529]
+ def test_compaction_bug_19529
obj = Object.new
100.times do |i|
GC.compact
@wm[i] = obj
end
- assert_separately([], <<-'end;')
+ assert_separately(%w(--disable-gems), <<-'end;')
wm = ObjectSpace::WeakMap.new
obj = Object.new
100.times do
@@ -212,45 +193,5 @@ class TestWeakMap < Test::Unit::TestCase
end
GC.compact
end;
-
- assert_separately(%w(-robjspace), <<-'end;')
- wm = ObjectSpace::WeakMap.new
- key = Object.new
- val = Object.new
- wm[key] = val
-
- GC.verify_compaction_references(expand_heap: true, toward: :empty)
-
- assert_equal(val, wm[key])
- end;
-
- assert_separately(["-W0"], <<-'end;')
- wm = ObjectSpace::WeakMap.new
-
- ary = 10_000.times.map do
- o = Object.new
- wm[o] = 1
- o
- end
-
- GC.verify_compaction_references(expand_heap: true, toward: :empty)
- end;
- end
-
- def test_replaced_values_bug_19531
- a = "A".dup
- b = "B".dup
-
- @wm[1] = a
- @wm[1] = a
- @wm[1] = a
-
- @wm[1] = b
- assert_equal b, @wm[1]
-
- a = nil
- GC.start
-
- assert_equal b, @wm[1]
end
end