test/functional/eft_14_cursor.rb in ruote-2.3.0.1 vs test/functional/eft_14_cursor.rb in ruote-2.3.0.2

- old
+ new

@@ -18,12 +18,10 @@ pdef = Ruote.process_definition :name => 'test' do cursor do end end - #noisy - assert_trace('', pdef) end def test_cursor @@ -32,12 +30,10 @@ echo 'a' echo 'b' end end - #noisy - assert_trace(%w[ a b ], pdef) end def test_skip @@ -48,12 +44,10 @@ echo 'b' echo 'c' end end - #noisy - assert_trace(%w[ a c ], pdef) end def test_break @@ -63,12 +57,10 @@ _break echo 'b' end end - #noisy - assert_trace('a', pdef) end def test_stop @@ -78,12 +70,10 @@ stop echo 'b' end end - #noisy - assert_trace('a', pdef) end def test_over @@ -93,48 +83,40 @@ over echo 'b' end end - #noisy - assert_trace('a', pdef) end def test_jump_to_tag pdef = Ruote.process_definition :name => 'test' do cursor do echo 'a' - jump :to => 'c' + jump :to => 'ctag' echo 'b' - echo 'c', :tag => 'c' + echo 'c', :tag => 'ctag' end end - #noisy - assert_trace(%w[ a c ], pdef) end def test_jump_to_variable_tag pdef = Ruote.process_definition :name => 'test' do cursor do echo 'a' - jump :to => 'd' + set :var => 'v0', :val => 'ctag' + jump :to => '${v:v0}' echo 'b' - set :var => 'v0', :val => 'd' - jump :to => 'd' - echo 'c' - echo 'd', :tag => '${v:v0}' + echo 'c', :tag => '${v:v0}' end end - #noisy - - assert_trace(%w[ a b d ], pdef) + assert_trace(%w[ a c ], pdef) end def test_rewind_if pdef = Ruote.process_definition :name => 'test' do @@ -151,12 +133,10 @@ workitem.fields['counter'] += 1 workitem.fields['rewind'] = workitem.fields['counter'] < 5 tracer << "a\n" end - #noisy - assert_trace(%w[ a ] * 5, pdef) end def test_jump_to @@ -180,16 +160,50 @@ end @dashboard.register_participant :publisher do |workitem| tracer << "p\n" end - #noisy - assert_trace %w[ a r a r a r p ], pdef # ARP nostalgy.... end + def test_jump_to_participant_name + + @dashboard.register '.+' do |workitem| + tracer << workitem.participant_name + "\n" + end + + pdef = Ruote.define do + cursor do + participant 'a' + jump :to => 'c' + participant 'b' + participant 'c' + end + end + + assert_trace %w[ a c ], pdef + end + + def test_jump_to_participant_ref_name + + @dashboard.register '.+' do |workitem| + tracer << workitem.participant_name + "\n" + end + + pdef = Ruote.define do + cursor do + participant :ref => 'a' + jump :to => 'c' + participant :ref => 'b' + participant :ref => 'c' + end + end + + assert_trace %w[ a c ], pdef + end + def test_deep_rewind pdef = Ruote.process_definition :name => 'test' do cursor do sequence do @@ -198,12 +212,10 @@ echo 'b' end end end - #noisy - wfid = @dashboard.launch(pdef) wait_for(14) #p @tracer.to_s @@ -226,12 +238,10 @@ end end @dashboard.register_participant :alpha, Ruote::NoOpParticipant - #noisy - wfid = @dashboard.launch(pdef) wait_for(:alpha) wait_for(wfid) @@ -253,12 +263,10 @@ end echo 'd' end end - #noisy - assert_trace %w[ a b ], pdef end def test_break_if @@ -267,12 +275,10 @@ echo 'c' end echo 'done.' end - #noisy - assert_trace 'done.', pdef end def test_over_unless @@ -281,12 +287,10 @@ echo 'c' end echo 'done.' end - #noisy - assert_trace 'done.', pdef end class Alpha include Ruote::LocalParticipant @@ -315,12 +319,10 @@ echo 'out' end echo 'done.' end - #noisy - @dashboard.register do alpha EftCursorTest::Alpha bravo EftCursorTest::Bravo end @@ -333,12 +335,10 @@ cursor do rewind end end - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for(9) assert_not_nil @dashboard.process(wfid) @@ -367,36 +367,30 @@ end end def test_workitem_command_and_jump_array - #noisy - @dashboard.register do charly EftCursorTest::Charly, 'command' => [ 'jump', 'delta' ] catchall Ruote::NoOpParticipant end assert_trace "top\nbottom", JUMP_DEF end def test_workitem_command_and_jump_string - #noisy - @dashboard.register do charly EftCursorTest::Charly, 'command' => 'jump delta' catchall Ruote::NoOpParticipant end assert_trace "top\nbottom", JUMP_DEF end def test_workitem_command_and_jump_to_string - #noisy - @dashboard.register do charly EftCursorTest::Charly, 'command' => 'jump to delta' catchall Ruote::NoOpParticipant end @@ -413,12 +407,10 @@ end end @dashboard.register { catchall } - #@dashboard.noisy = true - wfid = @dashboard.launch(pdef) @dashboard.wait_for(:alpha) assert_nil @dashboard.storage_participant.first.fields['toto'] @@ -437,11 +429,9 @@ set 'f:reset' => true end end @dashboard.register { catchall } - - #@dashboard.noisy = true wfid = @dashboard.launch(pdef) @dashboard.wait_for(:alpha) assert_nil @dashboard.storage_participant.first.fields['toto']