Sha256: 3597dd6120eb0acfbaf7742224756402e299c78e4fc6c57218a4a2cb8a176c24

Contents?: true

Size: 648 Bytes

Versions: 16

Compression:

Stored size: 648 Bytes

Contents

require 'facets/proc/bind.rb'
require 'test/unit'

class TestProc < Test::Unit::TestCase

  # Not sure why this is thread critical?

  def test_memory_leak
    a = 2
    tproc = lambda { |x| x + a }
    99.times {
      tmethod = tproc.bind(self) #to_method
      assert_equal( 3, tmethod.call(1) )
    }
    meths = (
      Object.instance_methods +
      Object.public_instance_methods +
      Object.private_instance_methods +
      Object.protected_instance_methods
    )
    meths = meths.select{ |s| s.to_s =~ /^_bind_/ }
    #meths = Symbol.all_symbols.select { |s| s.to_s =~ /^_bind_/ }  # why?
    assert_equal( 0, meths.size )
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/proc/test_bind.rb
facets-2.8.3 test/core/proc/test_bind.rb
facets-2.8.2 test/core/proc/test_bind.rb
facets-2.8.1 test/core/proc/test_bind.rb
facets-2.8.0 test/core/proc/test_bind.rb
facets-2.7.0 test/core/proc/test_bind.rb
facets-2.6.0 test/core/proc/test_bind.rb
facets-2.4.0 test/proc/test_bind.rb
facets-2.4.1 test/proc/test_bind.rb
facets-2.4.2 test/core/proc/test_bind.rb
facets-2.4.4 test/core/proc/test_bind.rb
facets-2.4.3 test/core/proc/test_bind.rb
facets-2.5.0 test/core/proc/test_bind.rb
facets-2.4.5 test/core/proc/test_bind.rb
facets-2.5.1 test/core/proc/test_bind.rb
facets-2.5.2 test/core/proc/test_bind.rb