summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-17 09:55:12 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-17 09:55:12 -0500
commit9d4b65c06d1277c74e0c6f782f0e2b93d7919da2 (patch)
treee4057b7c7dbc64a13caf1e72424c751a8cff756a /tests
parent6ee23b4ea530ff85a780cc8401cdcd078bed4ada (diff)
dlist2 working swimmingly
Diffstat (limited to 'tests')
-rw-r--r--tests/dlist2.ur25
-rw-r--r--tests/dlist2.urp3
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/dlist2.ur b/tests/dlist2.ur
new file mode 100644
index 00000000..3d2c7105
--- /dev/null
+++ b/tests/dlist2.ur
@@ -0,0 +1,25 @@
+datatype dlist = Nil | Cons of string * source dlist
+
+fun delist dl =
+ case dl of
+ Nil => <xml>[]</xml>
+ | Cons (x, s) => <xml>{[x]} <ctextbox/> :: {delistSource s}</xml>
+
+and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml>
+
+fun main () : transaction page =
+ tail0 <- source Nil;
+ tail <- source tail0;
+ tb <- source "";
+ return <xml><body>
+ {delist (Cons ("ROOT", tail0))}
+ <br/>
+ <ctextbox source={tb}/>
+ <button value="Add" onclick={hd <- get tb;
+ tl <- source Nil;
+ old <- get tail;
+
+ set old (Cons (hd, tl));
+ set tail tl}/>
+ <button value="Reset" onclick={set tail0 Nil; set tail tail0}/>
+ </body></xml>
diff --git a/tests/dlist2.urp b/tests/dlist2.urp
new file mode 100644
index 00000000..dc43ef1f
--- /dev/null
+++ b/tests/dlist2.urp
@@ -0,0 +1,3 @@
+debug
+
+dlist2