test/functional/eft_5_subprocess.rb in ruote-2.2.0 vs test/functional/eft_5_subprocess.rb in ruote-2.3.0

- old
+ new

@@ -3,11 +3,11 @@ # testing ruote # # Wed May 20 17:08:17 JST 2009 # -require File.join(File.dirname(__FILE__), 'base') +require File.expand_path('../base', __FILE__) class EftSubprocessTest < Test::Unit::TestCase include FunctionalBase @@ -94,11 +94,11 @@ define :sub0 do alpha end end - @engine.register_participant :alpha do |workitem, fexp| + @dashboard.register_participant :alpha do |workitem, fexp| stash[:tree] = fexp.lookup_variable('tree') end #noisy @@ -132,17 +132,18 @@ end end #noisy - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) wait_for(wfid) assert_equal( "#<RuntimeError: no subprocess named 'nada' found>", - @engine.process(wfid).errors.first.message) + #"#<RuntimeError: unknown participant or subprocess 'nada'>", + @dashboard.process(wfid).errors.first.message) end def test_subprocess_in_engine_variable pdef = Ruote.process_definition do @@ -150,13 +151,34 @@ sub0 echo 'done.' end end - @engine.variables['sub0'] = Ruote.process_definition do + @dashboard.variables['sub0'] = Ruote.process_definition do echo 'in sub0' end assert_trace "in sub0\ndone.", pdef + end + + def test_atts_to_fields + + pdef = Ruote.define do + set 'address' => { 'city' => 'boston' } + subprocess( + 'sub0', + 'f:a' => 'fa', + 'field:b' => 'mi', + 'var:c' => 'sol', + 'f:address.city' => 'nyc') + define 'sub0' do + echo '${a} ${b} ${v:c} ${address.city}' + end + end + + wfid = @dashboard.launch(pdef) + @dashboard.wait_for(wfid) + + assert_equal 'fa mi sol nyc', @tracer.to_s end end