Method: LazyMethodTest#test_method_methods

Defined in:
lib/lazy_method_test.rb

#test_method_methods(t) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/lazy_method_test.rb', line 52

def test_method_methods(t)
  foo = Foo.new
  LazyMethod::METHOD_METHODS.each do |m|
    s = foo.method.__send__(m)
    unless LazyMethod === s
      t.error("should be LazyMethod instance got #{s}")
    end

    expect = foo.method(:bar).__send__(m)

    next if m == :to_proc

    unless expect == s.bar
      t.error("call #{m} expect #{expect}, got #{s.bar}")
    end
  end
end