mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rake*: Updated to rake 0.9.3
* test/rake*: ditto * bin/rake: ditto * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bfc95c6e16
commit
9c66bad9f3
45 changed files with 1409 additions and 231 deletions
|
@ -104,10 +104,12 @@ class TestRakeTask < Rake::TestCase
|
|||
end
|
||||
|
||||
def test_clear
|
||||
desc "a task"
|
||||
t = task("t" => "a") { }
|
||||
t.clear
|
||||
assert t.prerequisites.empty?, "prerequisites should be empty"
|
||||
assert t.actions.empty?, "actions should be empty"
|
||||
assert_nil t.comment, "comments should be empty"
|
||||
end
|
||||
|
||||
def test_clear_prerequisites
|
||||
|
@ -123,6 +125,22 @@ class TestRakeTask < Rake::TestCase
|
|||
assert t.actions.empty?, "actions should be empty"
|
||||
end
|
||||
|
||||
def test_clear_comments
|
||||
desc "the original foo"
|
||||
task :foo => [:x] do
|
||||
# Dummy action
|
||||
end
|
||||
|
||||
task(:foo).clear_comments
|
||||
|
||||
desc "a slightly different foo"
|
||||
task :foo
|
||||
|
||||
assert_equal "a slightly different foo", task(:foo).comment
|
||||
assert_equal ["x"], task(:foo).prerequisites
|
||||
assert_equal 1, task(:foo).actions.size
|
||||
end
|
||||
|
||||
def test_find
|
||||
task :tfind
|
||||
assert_equal "tfind", Task[:tfind].name
|
||||
|
@ -223,6 +241,38 @@ class TestRakeTask < Rake::TestCase
|
|||
assert_in_delta now + 10, a.timestamp, 0.1, 'computer too slow?'
|
||||
end
|
||||
|
||||
def test_always_multitask
|
||||
mx = Mutex.new
|
||||
result = []
|
||||
|
||||
t_a = task(:a) do |t|
|
||||
sleep 0.02
|
||||
mx.synchronize{ result << t.name }
|
||||
end
|
||||
|
||||
t_b = task(:b) do |t|
|
||||
mx.synchronize{ result << t.name }
|
||||
end
|
||||
|
||||
t_c = task(:c => [:a,:b]) do |t|
|
||||
mx.synchronize{ result << t.name }
|
||||
end
|
||||
|
||||
t_c.invoke
|
||||
|
||||
# task should always run in order
|
||||
assert_equal ['a', 'b', 'c'], result
|
||||
|
||||
[t_a, t_b, t_c].each { |t| t.reenable }
|
||||
result.clear
|
||||
|
||||
Rake.application.options.always_multitask = true
|
||||
t_c.invoke
|
||||
|
||||
# with multitask, task 'b' should grab the mutex first
|
||||
assert_equal ['b', 'a', 'c'], result
|
||||
end
|
||||
|
||||
def test_investigation_output
|
||||
t1 = task(:t1 => [:t2, :t3]) { |t| runlist << t.name; 3321 }
|
||||
task(:t2)
|
||||
|
@ -264,4 +314,3 @@ class TestRakeTask < Rake::TestCase
|
|||
assert_equal "HI", t.comment
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue