test/ft_15_iterator.rb in openwferu-0.9.12 vs test/ft_15_iterator.rb in openwferu-0.9.12.863
- old
+ new
@@ -56,12 +56,12 @@
end
end
end
end
- def test_ppd_1
#def xxxx_ppd_1
+ def test_ppd_1
dotest(
TestDefinition1,
"""0 -- x
1 -- y
2 -- z""")
@@ -108,9 +108,63 @@
end
#def xxxx_iterator_3
def test_iterator_3
dotest(TestDefinition3, "done.")
+ end
+
+
+ #
+ # Test 4
+ #
+
+ class TestDefinition4 < OpenWFE::ProcessDefinition
+ sequence do
+ iterator :on_value => "a, b, c", :to_field => "f0" do
+ sequence do
+ _print "${f:__ip__} -- ${f:f0}"
+ _break :if => "${f:__ip__} == 1"
+ end
+ end
+ _print "done."
+ end
+ end
+
+ #def xxxx_iterator_4
+ def test_iterator_4
+ dotest(TestDefinition4, "0 -- a\n1 -- b\ndone.")
+ end
+
+
+ #
+ # Test 5
+ #
+
+ class TestDefinition5 < OpenWFE::ProcessDefinition
+ sequence do
+ iterator :on_value => "a, b, c, e, f, g", :to_field => "f0" do
+ sequence do
+ _print "${f:__ip__} -- ${f:f0}"
+ skip 2, :if => "${f:__ip__} == 1"
+ end
+ end
+ _print "done."
+ end
+ end
+
+ #def xxxx_iterator_5
+ def test_iterator_5
+
+ dotest(
+ TestDefinition5,
+ """
+0 -- a
+1 -- b
+3 -- e
+4 -- f
+5 -- g
+done.
+ """.strip)
end
end