summaryrefslogtreecommitdiff
path: root/test/rake/test_rake_file_task.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 03:07:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 03:07:37 +0000
commit6361928083d01906ab9d8782b6533b4ed7c834a0 (patch)
tree172488be8a74c9313d35b9cd7d53999cd55f561d /test/rake/test_rake_file_task.rb
parent031e1570b934d6b3a1e17ae8eb78a44dac8186d3 (diff)
* lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
[fix GH-668] * test/rake/*.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_file_task.rb')
-rw-r--r--test/rake/test_rake_file_task.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/rake/test_rake_file_task.rb b/test/rake/test_rake_file_task.rb
index fa3241b78bb..ae828c9ba19 100644
--- a/test/rake/test_rake_file_task.rb
+++ b/test/rake/test_rake_file_task.rb
@@ -98,6 +98,70 @@ class TestRakeFileTask < Rake::TestCase
assert @ran
end
+ def test_needed_eh_build_all
+ create_file 'a'
+
+ file 'a'
+
+ a_task = Task['a']
+
+ refute a_task.needed?
+
+ Rake.application.options.build_all = true
+
+ assert a_task.needed?
+ ensure
+ delete_file 'a'
+ end
+
+ def test_needed_eh_dependency
+ create_file 'a', Time.now
+ create_file 'b', Time.now - 60
+
+ create_file 'c', Time.now
+ create_file 'd', Time.now - 60
+
+ file 'b' => 'a'
+
+ b_task = Task['b']
+
+ assert b_task.needed?
+
+ file 'c' => 'd'
+
+ c_task = Task['c']
+
+ refute c_task.needed?
+ ensure
+ delete_file 'old'
+ delete_file 'new'
+ end
+
+ def test_needed_eh_exists
+ name = "dummy"
+ file name
+
+ ftask = Task[name]
+
+ assert ftask.needed?
+
+ create_file name
+
+ refute ftask.needed?
+ ensure
+ delete_file name
+ end
+
+ def test_source_is_first_prerequisite
+ t = file :f => ["preqA", "preqB"]
+ assert_equal "preqA", t.source
+ end
+
+ def test_sources_is_all_prerequisites
+ t = file :f => ["preqA", "preqB"]
+ assert_equal ["preqA", "preqB"], t.sources
+ end
+
# I have currently disabled this test. I'm not convinced that
# deleting the file target on failure is always the proper thing to
# do. I'm willing to hear input on this topic.