Sha256: c8e0c2a5f2a64ebd90501874730c921e92af2f88ba1f35879a7fbc0f8da03264
Contents?: true
Size: 1.38 KB
Versions: 4
Compression:
Stored size: 1.38 KB
Contents
# Test facets/paramix.rb require 'facets/paramix.rb' require 'test/unit' class TC_Paramix_01 < Test::Unit::TestCase module M def f M(:p) end def self.included_with_parameters( base, parms ) base.class_eval do define_method :check do parms end end end end class C include M, :p => "check" end class D include M, :p => "steak" end def test_01_001 c = C.new assert_equal( "check", c.M(:p) ) assert_equal( "check", c.f ) end def test_01_002 d = D.new assert_equal( "steak", d.M(:p) ) assert_equal( "steak", d.f ) end def test_01_003 assert_equal( {M=>{:p => "check"}}, C.mixin_parameters ) assert_equal( {M=>{:p => "steak"}}, D.mixin_parameters ) end def test_01_004 c = C.new assert_equal( {:p => "check"}, c.check ) d = D.new assert_equal( {:p => "steak"}, d.check ) end end class TC_Paramix_02 < Test::Unit::TestCase module M def f M(:p) end end class C extend M, :p => "mosh" end class D extend M, :p => "many" end def test_02_001 assert_equal( "mosh", C.f ) end def test_02_002 assert_equal( "many", D.f ) end def test_02_003 assert_equal( {M=>{:p => "mosh"}}, (class << C; self; end).mixin_parameters ) assert_equal( {M=>{:p => "many"}}, (class << D; self; end).mixin_parameters ) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.1 | test/unit/test_paramix.rb |
facets-2.1.3 | test/unit/test_paramix.rb |
facets-2.2.0 | test/unit/test_paramix.rb |
facets-2.3.0 | test/more/test_paramix.rb |