test/functional/ft_10_dollar.rb in ruote-2.1.4 vs test/functional/ft_10_dollar.rb in ruote-2.1.5

- old
+ new

@@ -41,10 +41,29 @@ #noisy assert_trace(pdef, %w[ a b0 c0 d0 ]) end + def test_nested_v + + pdef = Ruote.process_definition do + sequence do + set( + :var => 'v0', + :val => { + 'name' => 'toto', + 'address' => [ 'e-street', 'atlantic_city' ] }) + echo 'a:${v:v0.name}' + echo 'b:${v:v0.address.1}' + end + end + + #noisy + + assert_trace(pdef, %w[ a:toto b:atlantic_city ]) + end + def test_f pdef = Ruote.process_definition do sequence do set :field => 'f', :val => { 'name' => 'toto', 'address' => %w[ KL Asia ]} @@ -80,11 +99,75 @@ end end #noisy - @engine.context[:ruby_eval_allowed] = true + @engine.context['ruby_eval_allowed'] = true assert_trace(pdef, '>3<') + end + + def test_r_and_wi + + pdef = Ruote.process_definition do + sequence do + set 'f:toto' => 'person' + echo "${r:wi.fields['toto']}" + echo "${r:workitem.fields['toto']}" + end + end + + #noisy + + @engine.context['ruby_eval_allowed'] = true + + assert_trace pdef, "person\nperson" + end + + def test_r_and_d + + pdef = Ruote.process_definition do + sequence do + set 'f:toto' => 'person' + echo "${r:d('f:toto')}" + end + end + + #noisy + + @engine.context['ruby_eval_allowed'] = true + + assert_trace pdef, 'person' + end + + def test_nested + + pdef = Ruote.process_definition do + sequence do + set 'f:a' => 'a' + set 'v:a' => 'AA' + echo '${v:${f:a}}' + end + end + + #noisy + + assert_trace pdef, 'AA' + end + + def test_wfid + + pdef = Ruote.process_definition do + sequence do + echo '${fei}' + echo '${wfid}' + end + end + + wfid = @engine.launch(pdef) + + @engine.wait_for(wfid) + + assert_equal "0_0_0!!#{wfid}\n#{wfid}", @tracer.to_s end end