test/ft_15_iterator.rb in openwferu-0.9.15 vs test/ft_15_iterator.rb in openwferu-0.9.16
- old
+ new
@@ -41,12 +41,64 @@
"""0 -- x
1 -- y
2 -- z""")
end
+ #
+ # Test 0b
+ #
+ class Test0b < OpenWFE::ProcessDefinition
+ iterator :on_value => "1,2,3", :to_variable => "j" do
+ _print "${f:__ip__} -- ${j}"
+ end
+ end
+
+ def test_0b
+
+ dotest(
+ Test0b,
+ """0 -- 1
+1 -- 2
+2 -- 3""")
+ end
+
#
+ # Test 0c
+ #
+
+ TEST0C = '''
+<process-definition name="test" revision="0c">
+ <sequence>
+
+ <iterator on-value = "1,2,3" to-variable = "j">
+ <print>${f:__ip__} -- ${j}</print>
+ </iterator>
+
+ <set field="control" value="1,2,3" />
+ <iterator on-value = "${f:control}" to-variable = "j">
+ <print>${f:__ip__} -- ${j}</print>
+ </iterator>
+
+ </sequence>
+</process-definition>
+ '''.strip
+
+ def test_0c
+
+ dotest(
+ TEST0C,
+ """0 -- 1
+1 -- 2
+2 -- 3
+0 -- 1
+1 -- 2
+2 -- 3""")
+ end
+
+
+ #
# Test 1
#
class TestDefinition1 < OpenWFE::ProcessDefinition
def make
@@ -139,11 +191,11 @@
# Test 5
#
class TestDefinition5 < OpenWFE::ProcessDefinition
sequence do
- iterator :on_value => "a, b, c, e, f, g", :to_field => "f0" do
+ iterator :on_value => "a, b, c, d, e, f, g", :to_field => "f0" do
sequence do
_print "${f:__ip__} -- ${f:f0}"
skip 2, :if => "${f:__ip__} == 1"
end
end
@@ -157,12 +209,12 @@
dotest(
TestDefinition5,
"""
0 -- a
1 -- b
-3 -- e
-4 -- f
-5 -- g
+4 -- e
+5 -- f
+6 -- g
done.
""".strip)
end
end