test/functional/ft_17_conditional.rb in ruote-2.1.11 vs test/functional/ft_17_conditional.rb in ruote-2.2.0

- old
+ new

@@ -43,15 +43,16 @@ echo '${f:d}' echo 'a', :if => '${f:d}' echo 'b', :if => '${f:d} == some dude' echo 'c', :if => "${f:d} == 'some dude'" - echo 'd', :if => '${f:d} is set' + echo 'd', :if => "${f:d} == ${'f:d}" + echo 'e', :if => '${f:d} is set' end end - assert_trace("some dude\na\nb\nd", pdef) + assert_trace("some dude\na\nc\nd\ne", pdef) end def test_unless pdef = Ruote.process_definition :name => 'test' do @@ -69,8 +70,30 @@ assert_trace(%w[ 2000 i . ], { 'f' => '2000' }, pdef) @tracer.clear assert_trace(%w[ other u . ], { 'f' => 'other' }, pdef) + end + + def test_and_or + + pdef = Ruote.process_definition do + + set 'f:t' => true + set 'f:f' => false + + sequence do + + echo '${f:t}/${f:f}' + + echo 'a', :if => '${f:t}' + echo 'b', :if => '${f:t} or ${f:f}' + echo 'c', :if => '${f:t} and ${f:f}' + echo 'd', :if => '${f:t} and (${f:t} or ${f:f})' + echo 'e', :if => '${f:t} and (${f:t} and ${f:f})' + end + end + + assert_trace(%w[ true/false a b d ], pdef) end end