~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to test/ruby/test_gc.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    GC.start
52
52
    assert_operator(c, :<, GC.count)
53
53
  end
 
54
 
 
55
  def test_stat
 
56
    res = GC.stat
 
57
    assert_equal(false, res.empty?)
 
58
    assert_kind_of(Integer, res[:count])
 
59
 
 
60
    arg = Hash.new
 
61
    res = GC.stat(arg)
 
62
    assert_equal(arg, res)
 
63
    assert_equal(false, res.empty?)
 
64
    assert_kind_of(Integer, res[:count])
 
65
  end
 
66
 
 
67
  def test_singleton_method
 
68
    prev_stress = GC.stress
 
69
    assert_nothing_raised("[ruby-dev:42832]") do
 
70
      GC.stress = true
 
71
      10.times do
 
72
        obj = Object.new
 
73
        def obj.foo() end
 
74
        def obj.bar() raise "obj.foo is called, but this is obj.bar" end
 
75
        obj.foo
 
76
      end
 
77
    end
 
78
  ensure
 
79
    GC.stress = prev_stress
 
80
  end
54
81
end