Sha256: de1aa86d50e7a220732ea592ae623898724edab79792cd26b2f7a843d1a83b6b
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require 'thread' require 'rake' ###################################################################### class TestMultiTask < Test::Unit::TestCase include Rake def setup Task.clear @runs = ThreadSafeArray.new end def test_running_multitasks task :a do 3.times do |i| @runs << "A#{i}"; sleep 0.01; end end task :b do 3.times do |i| @runs << "B#{i}"; sleep 0.01; end end multitask :both => [:a, :b] Task[:both].invoke assert_equal 6, @runs.size assert @runs.index("A0") < @runs.index("A1") assert @runs.index("A1") < @runs.index("A2") assert @runs.index("B0") < @runs.index("B1") assert @runs.index("B1") < @runs.index("B2") end def test_all_multitasks_wait_on_slow_prerequisites task :slow do 3.times do |i| @runs << "S#{i}"; sleep 0.05 end end task :a => [:slow] do 3.times do |i| @runs << "A#{i}"; sleep 0.01 end end task :b => [:slow] do 3.times do |i| @runs << "B#{i}"; sleep 0.01 end end multitask :both => [:a, :b] Task[:both].invoke assert_equal 9, @runs.size assert @runs.index("S0") < @runs.index("S1") assert @runs.index("S1") < @runs.index("S2") assert @runs.index("S2") < @runs.index("A0") assert @runs.index("S2") < @runs.index("B0") assert @runs.index("A0") < @runs.index("A1") assert @runs.index("A1") < @runs.index("A2") assert @runs.index("B0") < @runs.index("B1") assert @runs.index("B1") < @runs.index("B2") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
drake-0.9.0.0.3.0 | test/lib/multitask_test.rb |