diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cookieJsec.ur | 27 | ||||
-rw-r--r-- | tests/cookieJsec.urp | 5 | ||||
-rw-r--r-- | tests/cookieJsec.urs | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/cookieJsec.ur b/tests/cookieJsec.ur new file mode 100644 index 00000000..46668cf8 --- /dev/null +++ b/tests/cookieJsec.ur @@ -0,0 +1,27 @@ +table t : {Id : int} + +cookie c : int + +fun setter r = + setCookie c (readError r.Id); + return <xml>Done</xml> + +fun writer () = + ido <- getCookie c; + case ido of + None => error <xml>No cookie</xml> + | Some id => dml (INSERT INTO t (Id) VALUES ({[id]})) + +fun preWriter () = return <xml><body onload={onConnectFail (alert "RPC error")}> + <button onclick={writer ()} value="Write to database"/> + + <a link={main ()}>Back</a> +</body></xml> + +and main () = return <xml><body> + <form> + <textbox{#Id}/> <submit value="Get cookie" action={setter}/> + </form> + + <form><submit action={preWriter} value="Prepare to write to database"/></form> +</body></xml> diff --git a/tests/cookieJsec.urp b/tests/cookieJsec.urp new file mode 100644 index 00000000..fc5044e5 --- /dev/null +++ b/tests/cookieJsec.urp @@ -0,0 +1,5 @@ +debug +database dbname=cookiejsec +sql cookieJsec.sql + +cookieJsec diff --git a/tests/cookieJsec.urs b/tests/cookieJsec.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/cookieJsec.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |