mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
d001539a05
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
52 lines
1 KiB
Ruby
52 lines
1 KiB
Ruby
require File.expand_path('../helper', __FILE__)
|
|
|
|
class TestRakeInvocationChain < Rake::TestCase
|
|
|
|
def setup
|
|
super
|
|
|
|
@empty = Rake::InvocationChain::EMPTY
|
|
|
|
@first_member = "A"
|
|
@second_member = "B"
|
|
@one = @empty.append(@first_member)
|
|
@two = @one.append(@second_member)
|
|
end
|
|
|
|
def test_append
|
|
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
|
|
|