Sha256: d8f534bbb4ebaaaa0955481c27e27091c502007e586aafe7f82ae5f280c959e4

Contents?: true

Size: 1.48 KB

Versions: 258

Compression:

Stored size: 1.48 KB

Contents

require File.expand_path('../helper', __FILE__)

class TestRakeInvocationChain < Rake::TestCase
  include Rake

  def setup
    super

    @empty = InvocationChain.empty

    @first_member = "A"
    @second_member = "B"
    @one = @empty.append(@first_member)
    @two = @one.append(@second_member)
  end

  def test_conj_on_invocation_chains
    list = InvocationChain.empty.conj("B").conj("A")
    assert_equal InvocationChain.make("A", "B"), list
    assert_equal InvocationChain, list.class
  end

  def test_make_on_invocation_chains
    assert_equal @empty, InvocationChain.make()
    assert_equal @one, InvocationChain.make(@first_member)
    assert_equal @two, InvocationChain.make(@second_member, @first_member)
  end

  def test_append_with_one_argument
    chain = @empty.append("A")

    assert_equal 'TOP => A', chain.to_s # HACK
  end

  def test_append_one_circular
    ex = assert_raises RuntimeError do
      @one.append(@first_member)
    end
    assert_match(/circular +dependency/i, ex.message)
    assert_match(/A.*=>.*A/, ex.message)
  end

  def test_append_two_circular
    ex = assert_raises RuntimeError do
      @two.append(@first_member)
    end
    assert_match(/A.*=>.*B.*=>.*A/, ex.message)
  end

  def test_member_eh_one
    assert @one.member?(@first_member)
  end

  def test_member_eh_two
    assert @two.member?(@first_member)
    assert @two.member?(@second_member)
  end

  def test_to_s_empty
    assert_equal "TOP", @empty.to_s
    assert_equal "TOP => A", @one.to_s
  end

end

Version data entries

258 entries across 234 versions & 74 rubygems

Version Path
rake-10.1.1 test/test_rake_invocation_chain.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.2.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.2.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.2.0 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.0.3 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.0.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
bundle_depot-0.0.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
syllable_counter-1.0.0 vendor/bundle/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
challah-1.0.0 vendor/bundle/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/test/test_rake_invocation_chain.rb
rake-10.1.0 test/test_rake_invocation_chain.rb
rake-10.1.0.beta.3 test/test_rake_invocation_chain.rb
rake-10.1.0.beta.2 test/test_rake_invocation_chain.rb