Sha256: 9280fd06f1e2eaf94acc4fa5af516f60b7cd72e11de7d5d1c1d3fb4d50866379

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

#
# testing ruote
#
# Fri Sep 11 16:09:32 JST 2009
#

require File.join(File.dirname(__FILE__), 'base')


class EftAddBranchesTest < Test::Unit::TestCase
  include FunctionalBase


  def test_add_branches

    pdef = Ruote.process_definition :name => 'test' do
      concurrent_iterator :on => 'a, b' do
        sequence do
          echo '${v:i}'
          add_branches 'c, d', :if => '${v:ii} == 0'
        end
      end
    end

    #noisy

    assert_trace pdef, %w[ a b c d ]
  end

  def test_add_branches_times

    pdef = Ruote.process_definition :name => 'test' do
      concurrent_iterator :times => 3 do
        sequence do
          echo '${v:i}'
          add_branches 2, :if => '${v:i} == 1'
        end
      end
    end

    #noisy

    assert_trace pdef, %w[ 1 2 3 4 5 ]
  end

  def test_add_branches_times_and_whatever

    pdef = Ruote.process_definition :name => 'test' do
      concurrent_iterator :times => 3 do
        sequence do
          echo '${v:i}'
          add_branches 'a, b', :if => '${v:i} == 1'
        end
      end
    end

    #noisy

    assert_trace pdef, %w[ 1 2 3 a b ]
  end

  def test_add_branches_with_tag

    pdef = Ruote.process_definition :name => 'test' do
      concurrent_iterator :on => 'a, b', :to_v => 'x', :tag => 'here' do
        sequence do
          echo '<:${v:x}'
          concurrent_iterator :on => '0, 1' do
            sequence do
              echo '>:${v:i}'
              add_branch 'c', :ref => 'here', :if => '${v:x} == a'
            end
          end
        end
      end
    end

    #noisy

    assert_trace(
      pdef,
      "<:a\n<:b\n>:0\n>:1\n>:0\n>:1\n<:c\n<:c\n>:0\n>:1\n>:0\n>:1")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruote-2.1.6 test/functional/eft_24_add_branches.rb
ruote-2.1.5 test/functional/eft_24_add_branches.rb
ruote-2.1.4 test/functional/eft_24_add_branches.rb