summaryrefslogtreecommitdiffstats
path: root/test/w3c/lua/test155.scxml
blob: 2064a37f49ae22a91d50224e3058c84580f91852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" standalone="no"?>
<!-- test that foreach executes the executable content once for each item in the list '(1,2,3)'. The executable
content sums the items into var1 so it should be 6 at the end -->
<scxml xmlns="http://www.w3.org/2005/07/scxml" initial="s0" version="1.0" datamodel="lua">
  <datamodel>
    <data expr="0" id="testvar1"/>
    <data id="testvar2"/>
    <data id="testvar3">{1,2,3}</data>
  </datamodel>
  <state id="s0">
    <onentry>
      <foreach array="testvar3" item="testvar2">
        <assign location="testvar1" expr="testvar1+testvar2"/>
      </foreach>
    </onentry>
    <transition cond="testvar1 == 6" target="pass"/>
    <transition target="fail"/>
  </state>
  <final id="pass"/>
  <final id="fail"/>
</scxml>