aboutsummaryrefslogtreecommitdiffstats
path: root/test/rake/test_invocation_chain.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-02 19:07:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-02 19:07:55 +0000
commit719b0f8e3037e1033726b6487d7b0d9fc1412e7d (patch)
treec5a08c8c9abae9b7f0514f680f56553a7a03656a /test/rake/test_invocation_chain.rb
parenta0f667c33e24928374d494c9c33d0082355785e1 (diff)
downloadruby-719b0f8e3037e1033726b6487d7b0d9fc1412e7d.tar.gz
* lib/rake: updated to rake code to rake-0.8.7 source code base.
* lib/rake/loaders/makefile.rb (Rake::MakefileLoader#process_line): respace dependencies too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_invocation_chain.rb')
-rw-r--r--test/rake/test_invocation_chain.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/rake/test_invocation_chain.rb b/test/rake/test_invocation_chain.rb
new file mode 100644
index 0000000000..a5843bfd2a
--- /dev/null
+++ b/test/rake/test_invocation_chain.rb
@@ -0,0 +1,75 @@
+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
+
+