summaryrefslogtreecommitdiff
path: root/tests/jsinj.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-01 15:59:02 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-01 15:59:02 -0500
commit17ffca0b16e45aa093a9c1d55b0e629a4cf26798 (patch)
treef1ee7e2c237ab69902362a6bf97acdd8cfdea87d /tests/jsinj.ur
parent8bb915433716ecfdcf2c2209d1a62796ebde4714 (diff)
Injecting a float
Diffstat (limited to 'tests/jsinj.ur')
-rw-r--r--tests/jsinj.ur18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/jsinj.ur b/tests/jsinj.ur
index 194d26be..d5bd7dbb 100644
--- a/tests/jsinj.ur
+++ b/tests/jsinj.ur
@@ -1,14 +1,24 @@
-cookie int : int
-
fun getOpt (t ::: Type) (o : option t) (v : t) : t =
case o of
None => v
| Some x => x
+cookie int : int
+cookie float : float
+
fun main () : transaction page =
n <- getCookie int;
- sn <- source (getOpt n 7);
+ n <- return (getOpt n 7);
+ sn <- source 6;
+
+ f <- getCookie float;
+ f <- return (getOpt f 1.23);
+ sf <- source 4.56;
+
return <xml><body>
<dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
- <a onclick={set sn 6}>CHANGE</a>
+ <a onclick={set sn n}>CHANGE</a><br/>
+
+ <dyn signal={f <- signal sf; return <xml>{[f]}</xml>}/>
+ <a onclick={set sf f}>CHANGE</a><br/>
</body></xml>