diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-12-18 14:17:45 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-12-18 14:17:45 -0500 |
commit | 4d07c227812b49e71de49b3e64ec6da1fbc30aed (patch) | |
tree | a234fad234187fc2eb74166ebdcd4e810bf60d30 /tests | |
parent | c71de1db0cf31466bfc5fe7e96021e5d3cba6979 (diff) |
Change tasks to support parametric code; add clientLeaves
Diffstat (limited to 'tests')
-rw-r--r-- | tests/init.ur | 2 | ||||
-rw-r--r-- | tests/initSimple.ur | 3 | ||||
-rw-r--r-- | tests/initSimple.urp | 1 | ||||
-rw-r--r-- | tests/initSimple.urs | 1 | ||||
-rw-r--r-- | tests/roundTrip.ur | 12 |
5 files changed, 16 insertions, 3 deletions
diff --git a/tests/init.ur b/tests/init.ur index aafbb55f..8040612d 100644 --- a/tests/init.ur +++ b/tests/init.ur @@ -1,6 +1,6 @@ sequence seq table fred : {A : int, B : int} -task initialize = +task initialize = fn () => setval seq 1; dml (INSERT INTO fred (A, B) VALUES (0, 1)) diff --git a/tests/initSimple.ur b/tests/initSimple.ur new file mode 100644 index 00000000..e1c94280 --- /dev/null +++ b/tests/initSimple.ur @@ -0,0 +1,3 @@ +task initialize = fn () => debug "I ran!" + +fun main () = return <xml>Hi!</xml> diff --git a/tests/initSimple.urp b/tests/initSimple.urp new file mode 100644 index 00000000..c2374400 --- /dev/null +++ b/tests/initSimple.urp @@ -0,0 +1 @@ +initSimple diff --git a/tests/initSimple.urs b/tests/initSimple.urs new file mode 100644 index 00000000..901d6bf2 --- /dev/null +++ b/tests/initSimple.urs @@ -0,0 +1 @@ +val main : {} -> transaction page diff --git a/tests/roundTrip.ur b/tests/roundTrip.ur index d22b2d41..0ee3f8f7 100644 --- a/tests/roundTrip.ur +++ b/tests/roundTrip.ur @@ -1,12 +1,18 @@ table channels : { Client : client, Channel : channel (string * int * float) } PRIMARY KEY Client +table dearlyDeparted : { Client : option client, When : time } + +task clientLeaves = fn cli : client => + dml (INSERT INTO dearlyDeparted (Client, When) VALUES ({[Some cli]}, CURRENT_TIMESTAMP)); + debug "Our favorite client has LEFT!" + fun writeBack v = me <- self; r <- oneRow (SELECT channels.Channel FROM channels WHERE channels.Client = {[me]}); send r.Channels.Channel v -fun main () = +fun main' () = me <- self; ch <- channel; dml (INSERT INTO channels (Client, Channel) VALUES ({[me]}, {[ch]})); @@ -27,7 +33,7 @@ fun main () = fun sender s n f = sleep 2000; - writeBack (s, n, f); + rpc (writeBack (s, n, f)); sender (s ^ "!") (n + 1) (f + 1.23) in return <xml><body onload={onDisconnect (alert "Server booted me"); @@ -37,3 +43,5 @@ fun main () = <dyn signal={Buffer.render buf}/> </body></xml> end + +fun main () = return <xml><body><form><submit action={main'}/></form></body></xml> |