diff options
author | Adam Chlipala <adam@chlipala.net> | 2014-08-24 11:43:49 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2014-08-24 11:43:49 -0400 |
commit | 0f24f4667d4571834c552d9a6ca3dbe180296bb0 (patch) | |
tree | cfd3d52195dfbd2eaf4530ca33e72d7adaa4b77d /tests | |
parent | cbe0e1aeceefc7db712230a070ddcf757cfe1981 (diff) |
Extend ScriptCheck to take RPCs into account
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DynChannel.ur | 29 | ||||
-rw-r--r-- | tests/DynChannel.urp | 6 | ||||
-rw-r--r-- | tests/rpchan.ur | 18 | ||||
-rw-r--r-- | tests/rpchan.urs | 1 |
4 files changed, 54 insertions, 0 deletions
diff --git a/tests/DynChannel.ur b/tests/DynChannel.ur new file mode 100644 index 00000000..d3688781 --- /dev/null +++ b/tests/DynChannel.ur @@ -0,0 +1,29 @@ +table channels : {Id : int, Channel:channel xbody} + +fun dosend (s:string) : transaction unit = + c <- oneRow1 (SELECT * FROM channels); + debug ("Sending " ^ s ^ " through the channel..."); + send c.Channel <xml>{[s]}</xml> + +fun mkchannel {} : transaction xbody = + c <- channel; + s <- source <xml/>; + dml( DELETE FROM channels WHERE Id >= 0); + dml( INSERT INTO channels(Id, Channel) VALUES(0, {[c]}) ); + return <xml> + <button value="Send" onclick={fn _ => rpc(dosend "blabla")}/> + <active code={spawn(x <- recv c; alert ("Got something from the channel"); set s x); return <xml/>}/> + <dyn signal={signal s}/> + </xml> + +fun main {} : transaction page = + s <- source <xml/>; + return <xml> + <head/> + <body> + <button value="Register" onclick={fn _ => + x <- rpc(mkchannel {}); set s x + }/> + <dyn signal={signal s}/> + </body> + </xml> diff --git a/tests/DynChannel.urp b/tests/DynChannel.urp new file mode 100644 index 00000000..08d6d1a5 --- /dev/null +++ b/tests/DynChannel.urp @@ -0,0 +1,6 @@ +database dbname=DynChannel.db +sql DynChannel.sql +debug + +$/list +DynChannel diff --git a/tests/rpchan.ur b/tests/rpchan.ur new file mode 100644 index 00000000..08308d90 --- /dev/null +++ b/tests/rpchan.ur @@ -0,0 +1,18 @@ +fun remote () = + ch <- channel; + send ch "Hello World!"; + return ch + +fun remoter () = + ch <- channel; + send ch "Hello World!"; + return <xml><active code={spawn (s <- recv ch; alert s); return <xml/>}/></xml> + +fun main () = + x <- source <xml/>; + return <xml><body> + <button onclick={fn _ => ch <- rpc (remote ()); s <- recv ch; alert s}>TEST</button> + <button onclick={fn _ => y <- rpc (remoter ()); set x y}>TESTER</button> + <hr/> + <dyn signal={signal x}/> + </body></xml> diff --git a/tests/rpchan.urs b/tests/rpchan.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/rpchan.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |