Sha256: c948d419087a8f279a3aeba352b982e62f92057ef222482412ae803f752461ca
Contents?: true
Size: 770 Bytes
Versions: 1
Compression:
Stored size: 770 Bytes
Contents
require 'test/unit' module Yargi # Checks some hypotheses that we make about Ruby class HypothesesTest < Test::Unit::TestCase def test_method_missing_handles_block_as_expected p = Object.new def p.say_hello who = block_given? ? yield : "anonymous" "Hello #{who}" end o = Object.new def o.set_obj(obj) @obj = obj end def o.method_missing(name, *args, &block) @obj.send(name, *args, &block) end assert_equal "Hello anonymous", p.say_hello assert_equal "Hello blambeau", p.say_hello {"blambeau"} o.set_obj(p) assert_equal "Hello anonymous", o.say_hello assert_equal "Hello blambeau", o.say_hello {"blambeau"} end end # class HypothesesTest end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yargi-0.2.0 | test/yargi/hypotheses_test.rb |