# # Testing OpenWFE # # John Mettraux at openwfe.org # # Mon Oct 9 22:19:44 JST 2006 # require 'flowtestbase' class FlowTest4 < Test::Unit::TestCase include FlowTestBase #def setup #end #def teardown #end def test_print_0 dotest(\ ''' ${f:xxx} ''', "${f:xxx}") end def test_reval_0 dotest(\ ''' ${f:from_ruby} ''', "ok") end def test_reval_1 dotest(\ ''' workitem.attributes["${field-name}"] = "ok" ${f:${field-name}} ''', "ok") end def test_reval_2 dotest(\ ''' workitem.attributes["from_ruby"] = "${field-value}" ${f:from_ruby} ''', "ok") end def test_reval_3 dotest(\ ''' ${v} ''', "false") end class Reval4 < OpenWFE::ProcessDefinition reval """ tracer = self.application_context['__tracer'] tracer << 'hello\n' tracer << workitem.attributes.length.to_s """ end def test_reval_4 dotest(Reval4, "hello\n1") end class Reval5 < OpenWFE::ProcessDefinition sequence do reval """ wi.customer_name = 'dubious' 'surf' """ _print "${f:customer_name}" _print "${f:__result__}" end end def test_reval_5 dotest Reval5, "dubious\nsurf" end # # DRU tests def test_dru_0 dotest(\ ''' ${r:1+2} ''', "3") end def test_dru_1 dotest(\ ''' ${r:"x"*3} ''', "xxx") end def test_dru_2 dotest(\ ''' ${v} ''', "10") end def test_dru_3 dotest(\ ''' "W" * 3 ${v} ''', "WWW") end def test_dru_4 dotest(\ ''' fei.workflow_definition_name ${v} ${r:fei.workflow_definition_name} ''', """dru_4 dru_4""") end end