about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_each_simple.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_each_simple.txt')
-rw-r--r--js/scripting-lang/scratch_tests/test_each_simple.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_each_simple.txt b/js/scripting-lang/scratch_tests/test_each_simple.txt
new file mode 100644
index 0000000..45c941a
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/test_each_simple.txt
@@ -0,0 +1,22 @@
+/* Simple each test */
+
+numbers : {1, 2, 3, 4, 5};
+
+/* each with table and scalar */
+each_add : each @add numbers 10;
+each_1 : each_add[1];
+each_2 : each_add[2];
+each_3 : each_add[3];
+..assert each_1 = 11;
+..assert each_2 = 12;
+..assert each_3 = 13;
+
+/* each with two tables */
+table1 : {a: 1, b: 2, c: 3};
+table2 : {a: 10, b: 20, c: 30};
+each_sum : each @add table1 table2;
+..assert each_sum.a = 11;
+..assert each_sum.b = 22;
+..assert each_sum.c = 33;
+
+..out "Simple each test completed"; 
\ No newline at end of file
' href='#n130'>130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193