Sha256: b51d98e2f460e61a750796c73e9bd6ce216ad106e131590e75a3f53b3d2dc17b

Contents?: true

Size: 916 Bytes

Versions: 11

Compression:

Stored size: 916 Bytes

Contents

# Test 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

11 entries across 11 versions & 1 rubygems

Version Path
facets-2.6.0 test/more/test_dependency.rb
facets-2.3.0 test/more/test_dependency.rb
facets-2.4.0 test/test_dependency.rb
facets-2.4.1 test/test_dependency.rb
facets-2.4.3 test/more/test_dependency.rb
facets-2.4.4 test/more/test_dependency.rb
facets-2.4.2 test/more/test_dependency.rb
facets-2.5.0 test/more/test_dependency.rb
facets-2.5.1 test/more/test_dependency.rb
facets-2.4.5 test/more/test_dependency.rb
facets-2.5.2 test/more/test_dependency.rb