summaryrefslogtreecommitdiff
path: root/tests/jsinj.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-02 13:03:22 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-02 13:03:22 -0500
commitc3b07501b5b2eeac8a88b7ded6a081e95b99d406 (patch)
treefe408da7de890226e6247a4446ecf1f155e2ed82 /tests/jsinj.ur
parent93cd18e71b9c57650914ec11bb9a19e9befe7eda (diff)
Injected an option
Diffstat (limited to 'tests/jsinj.ur')
-rw-r--r--tests/jsinj.ur10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/jsinj.ur b/tests/jsinj.ur
index d9e09fb5..632a2839 100644
--- a/tests/jsinj.ur
+++ b/tests/jsinj.ur
@@ -8,6 +8,7 @@ cookie float : float
cookie string : string
cookie bool : bool
cookie pair : int * float
+cookie option : option int
fun main () : transaction page =
n <- getCookie int;
@@ -30,6 +31,10 @@ fun main () : transaction page =
p <- return (getOpt p (1, 2.3));
sp <- source (4, 5.6);
+ o <- getCookie option;
+ o <- return (getOpt o (Some 1));
+ op <- source None;
+
return <xml><body>
<dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
<a onclick={set sn n}>CHANGE</a><br/>
@@ -45,4 +50,9 @@ fun main () : transaction page =
<dyn signal={p <- signal sp; return <xml>{[p.1]}, {[p.2]}</xml>}/>
<a onclick={set sp p}>CHANGE</a><br/>
+
+ <dyn signal={o <- signal op; case o of
+ None => return <xml>None</xml>
+ | Some x => return <xml>{[x]}</xml>}/>
+ <a onclick={set op o}>CHANGE</a><br/>
</body></xml>