Sha256: 361b0c2f6161c6b15d4eb2dad59fa8efd390ffc9c90a3e1f8c6e672bc9facb24

Contents?: true

Size: 1.43 KB

Versions: 126

Compression:

Stored size: 1.43 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'rake'

######################################################################
class TestMultiTask < Test::Unit::TestCase
  include Rake

  def setup
    Task.clear
    @runs = Array.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

126 entries across 98 versions & 11 rubygems

Version Path
craigmarksmith-rake-0.8.3.100 test/test_multitask.rb
craigmarksmith-rake-0.8.4.101 test/test_multitask.rb
craigmarksmith-rake-0.8.4.102 test/test_multitask.rb
craigmarksmith-rake-0.8.4.103 test/test_multitask.rb
elliottcable-echoe-3.1.1 vendor/rake/test/test_multitask.rb
elliottcable-echoe-3.1.2 vendor/rake/test/test_multitask.rb
jimweirich-rake-0.8.1.10 test/test_multitask.rb
jimweirich-rake-0.8.1.11 test/test_multitask.rb
jimweirich-rake-0.8.1.5 test/test_multitask.rb
jimweirich-rake-0.8.1.6 test/test_multitask.rb
jimweirich-rake-0.8.1.7 test/test_multitask.rb
jimweirich-rake-0.8.1.8 test/test_multitask.rb
jimweirich-rake-0.8.1.9 test/test_multitask.rb
jimweirich-rake-0.8.2.99 test/test_multitask.rb
jimweirich-rake-0.8.2 test/test_multitask.rb
jimweirich-rake-0.8.3.1 test/test_multitask.rb
jimweirich-rake-0.8.3.100 test/test_multitask.rb
jimweirich-rake-0.8.3.99 test/test_multitask.rb
jimweirich-rake-0.8.3 test/test_multitask.rb
jimweirich-rake-0.8.4.99 test/test_multitask.rb