Sha256: d865e76be662a8825ba75fefda9648ef906a805f3cc6dbc5d9e871c450f33030

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

# Test lib/facets/dependency.rb

require 'facets/dependency.rb'

require 'test/unit'

class DependableTest1 < Test::Unit::TestCase

  class C
    #extend MethodDependency

    attr :s
    def initialize
      @s = ''
    end

    def x ; @s << 'x'; end
    def y ; @s << 'y'; end
    def z ; @s << 'z'; end

    depend :x => :y
    depend :z => [:x, :y]
  end

  module M
    #extend MethodDependency

    attr :s
    def initialize
      @s = ''
    end

    def x ; @s << 'x'; end
    def y ; @s << 'y'; end
    def z ; @s << 'z'; end

    depend :x => :y
    depend :z => [:x, :y]
  end

  class D
    include M
  end

  def test_01
    c = C.new
    c.x
    assert_equal( 'yx', c.s )
  end

  def test_02
    c = C.new
    c.z
    assert_equal( 'yxz', c.s )
  end

  def test_03
    c = D.new
    c.x
    assert_equal( 'yx', c.s )
  end

  def test_04
    c = D.new
    c.z
    assert_equal( 'yxz', c.s )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.1.3 test/unit/test_dependency.rb
facets-2.2.1 test/unit/test_dependency.rb
facets-2.2.0 test/unit/test_dependency.rb