summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/each.ur16
-rw-r--r--tests/each.urp3
-rw-r--r--tests/each.urs1
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/each.ur b/tests/each.ur
new file mode 100644
index 00000000..b3b0b1a2
--- /dev/null
+++ b/tests/each.ur
@@ -0,0 +1,16 @@
+sequence s
+table t : { Id : int, S1 : string, S2:string, S3:string, S4:string }
+
+fun each (n : int, (f : unit -> transaction unit)) = if n > 0 then f (); each ((n-1),f) else return ()
+
+fun fill () =
+ dml (DELETE FROM t WHERE 1=1);
+ each (1,( fn () =>
+ (nv <- nextval s;
+ (dml (INSERT INTO t (Id, S1, S2, S3, S4) VALUES ({[nv]}, {["S1"]}, {["S2"]}, {["S3"]}, {["S4"]}))))
+ ));
+ return <xml>done</xml>
+
+fun main () = return <xml><body>
+ <form><submit action={fill} value="fill"/></form>
+</body></xml>
diff --git a/tests/each.urp b/tests/each.urp
new file mode 100644
index 00000000..c25b7175
--- /dev/null
+++ b/tests/each.urp
@@ -0,0 +1,3 @@
+database dbname=each
+
+each
diff --git a/tests/each.urs b/tests/each.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/each.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page