#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Tue Jan 2 13:14:37 JST 2007
#
require 'rubygems'
require 'openwfe/def'
require 'flowtestbase'
class FlowTest9 < Test::Unit::TestCase
include FlowTestBase
#def setup
#end
#def teardown
#end
def test_cursor_0
dotest(
'
a
b
''', "a\nb")
end
def test_cursor_1
dotest(
'
a
b
c
''', "a\nb")
end
def test_cursor_2
dotest(
'
a
b
c
''', "a\nb")
end
def test_cursor_2b
#
# ZigZag test
#
dotest(
'
a
b
c
''', "a\nb\nc")
end
def test_cursor_3
dotest(
'
a
b
c
''', "a\nc")
end
def test_cursor_4
dotest(
'
a
b
c
d
''', "a\nc\nd")
end
def test_cursor_5
dotest(
'
a
2
b
c
''', "a\nc")
end
class TestCursor6 < OpenWFE::ProcessDefinition
cursor do
_print "a"
skip "2"
_print "b"
_print "c"
skip 2
_print "d"
end
end
def test_6
dotest TestCursor6, "a\nc"
end
class Test7 < OpenWFE::ProcessDefinition
cursor do
alpha
rewind :if => "${f:rewind} == true"
end
end
def test_7
@engine.register_participant :alpha do |wi|
wi.rewind = if wi.attributes['rewind'] == nil
true
else
! wi.rewind
end
@tracer << wi.rewind.to_s
end
dotest Test7, "truefalse"
end
end