Sha256: 08bc50ccb2969990277591c8ecc819ab4cfa54cfcc898d169f0fe42ea16ff829

Contents?: true

Size: 1.74 KB

Versions: 38

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'rake'

######################################################################
class TestAnEmptyInvocationChain < Test::Unit::TestCase

  def setup
    @empty = Rake::InvocationChain::EMPTY
  end

  def test_should_be_able_to_add_members
    assert_nothing_raised do
      @empty.append("A")
    end
  end

  def test_to_s
    assert_equal "TOP", @empty.to_s
  end
end

######################################################################
class TestAnInvocationChainWithOneMember < Test::Unit::TestCase
  def setup
    @empty = Rake::InvocationChain::EMPTY
    @first_member = "A"
    @chain = @empty.append(@first_member)
  end

  def test_should_report_first_member_as_a_member
    assert @chain.member?(@first_member)
  end

  def test_should_fail_when_adding_original_member
    ex = assert_raise RuntimeError do
      @chain.append(@first_member)
    end
    assert_match(/circular +dependency/i, ex.message)
    assert_match(/A.*=>.*A/, ex.message)
  end

  def test_to_s
    assert_equal "TOP => A", @chain.to_s
  end

end

######################################################################
class TestAnInvocationChainWithMultipleMember < Test::Unit::TestCase
  def setup
    @first_member = "A"
    @second_member = "B"
    ch = Rake::InvocationChain::EMPTY.append(@first_member)
    @chain = ch.append(@second_member)
  end

  def test_should_report_first_member_as_a_member
    assert @chain.member?(@first_member)
  end

  def test_should_report_second_member_as_a_member
    assert @chain.member?(@second_member)
  end

  def test_should_fail_when_adding_original_member
    ex = assert_raise RuntimeError do
      @chain.append(@first_member)
    end
    assert_match(/A.*=>.*B.*=>.*A/, ex.message)
  end
end


Version data entries

38 entries across 38 versions & 5 rubygems

Version Path
elliottcable-echoe-3.1.1 vendor/rake/test/test_invocation_chain.rb
elliottcable-echoe-3.1.2 vendor/rake/test/test_invocation_chain.rb
jimweirich-rake-0.8.1.10 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.11 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.5 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.6 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.7 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.8 test/test_invocation_chain.rb
jimweirich-rake-0.8.1.9 test/test_invocation_chain.rb
jimweirich-rake-0.8.2.99 test/test_invocation_chain.rb
jimweirich-rake-0.8.2 test/test_invocation_chain.rb
jimweirich-rake-0.8.3.1 test/test_invocation_chain.rb
jimweirich-rake-0.8.3 test/test_invocation_chain.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rake-0.8.3/test/test_invocation_chain.rb
drake-0.8.1.10.0.1 test/test_invocation_chain.rb