test/ft_4_misc.rb in openwferu-0.9.15 vs test/ft_4_misc.rb in openwferu-0.9.16

- old
+ new

@@ -18,20 +18,32 @@ #def teardown #end def test_print_0 - dotest(\ + dotest( '''<process-definition name="print_0" revision="0"> <sequence> <print escape="true">${f:xxx}</print> </sequence> </process-definition>''', "${f:xxx}") end + class TestPrint1 < OpenWFE::ProcessDefinition + sequence do + _set :v => "toto", :value => '0' + _print "${toto}" + _print "${toto}", :escape => false + _print "${toto}", :escape => true + end + end + def test_print_1 + dotest TestPrint1, "0\n0\n${toto}" + end + def test_reval_0 - dotest(\ + dotest( '''<process-definition name="reval_0" revision="0"> <sequence> <reval><![CDATA[ workitem.attributes["from_ruby"] = "ok" ]]></reval> @@ -39,11 +51,11 @@ </sequence> </process-definition>''', "ok") end def test_reval_1 - dotest(\ + dotest( '''<process-definition name="reval_1" revision="0"> <sequence> <set variable="field-name" value="from_ruby" /> <reval> workitem.attributes["${field-name}"] = "ok" @@ -52,11 +64,11 @@ </sequence> </process-definition>''', "ok") end def test_reval_2 - dotest(\ + dotest( '''<process-definition name="reval_2" revision="0"> <sequence> <set variable="field-value" value="ok" /> <reval> workitem.attributes["from_ruby"] = "${field-value}" @@ -65,11 +77,11 @@ </sequence> </process-definition>''', "ok") end def test_reval_3 - dotest(\ + dotest( '''<process-definition name="reval_3" revision="0"> <sequence> <set variable="v"> <reval code="1 == 2" /> </set> @@ -85,13 +97,12 @@ tracer << 'hello\n' tracer << workitem.attributes.length.to_s """ end - def test_reval_4 - dotest(Reval4, "hello\n1") + dotest Reval4, [ "hello\n1", "hello\n0" ] end class Reval5 < OpenWFE::ProcessDefinition sequence do reval """ @@ -109,29 +120,29 @@ # # DRU tests def test_dru_0 - dotest(\ + dotest( '''<process-definition name="dru_0" revision="0"> <sequence> <print>${r:1+2}</print> </sequence> </process-definition>''', "3") end def test_dru_1 - dotest(\ + dotest( '''<process-definition name="dru_1" revision="0"> <sequence> <print>${r:"x"*3}</print> </sequence> </process-definition>''', "xxx") end def test_dru_2 - dotest(\ + dotest( '''<process-definition name="dru_2" revision="0"> <sequence> <set variable="v" value="${r:5*2}" @@ -140,11 +151,11 @@ </sequence> </process-definition>''', "10") end def test_dru_3 - dotest(\ + dotest( '''<process-definition name="dru_3" revision="0"> <sequence> <set variable="w" value="W" /> <set variable="v"> <!-- @@ -157,11 +168,11 @@ </sequence> </process-definition>''', "WWW") end def test_dru_4 - dotest(\ + dotest( '''<process-definition name="dru_4" revision="0"> <sequence> <set variable="v"> <reval>fei.workflow_definition_name</reval> </set> @@ -169,9 +180,37 @@ <print>${r:fei.workflow_definition_name}</print> </sequence> </process-definition>''', """dru_4 dru_4""") + end + + class TestSetEscape0 < OpenWFE::ProcessDefinition + sequence do + _set :v => "t0" do + "This is ${my template}" + end + _set :v => "t1", :escape => true do + "This is ${my template}" + end + _set :v => "t2", :val => "This is ${my template}", :escape => "true" + peek + #_print { v "t0" } + #_print { v "t1" } + end + end + def test_set_escape_0 + @engine.register_participant :peek do |fexp, wi| + @tracer << fexp.get_environment.variables['t0'] + @tracer << "\n" + @tracer << fexp.get_environment.variables['t1'] + @tracer << "\n" + @tracer << fexp.get_environment.variables['t2'] + @tracer << "\n" + end + dotest( + TestSetEscape0, + "This is \nThis is ${my template}\nThis is ${my template}") end end