summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 13:47:20 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 13:47:20 -0400
commitc4ddce15e08c0b2f26f7ff773b87654fc5f92938 (patch)
treed0d08dc15edc8e7dc1f916a592160f8c9e561bd2 /tests
parentb6fef1cc8832978bd9673df1a968d06d42bc2eb0 (diff)
Some client-side error handling
Diffstat (limited to 'tests')
-rw-r--r--tests/roundTrip.ur7
-rw-r--r--tests/updateErr.ur17
-rw-r--r--tests/updateErr.urp4
3 files changed, 26 insertions, 2 deletions
diff --git a/tests/roundTrip.ur b/tests/roundTrip.ur
index 26a0113e..d22b2d41 100644
--- a/tests/roundTrip.ur
+++ b/tests/roundTrip.ur
@@ -26,11 +26,14 @@ fun main () =
receiverB ()
fun sender s n f =
- sleep 9;
+ sleep 2000;
writeBack (s, n, f);
sender (s ^ "!") (n + 1) (f + 1.23)
in
- return <xml><body onload={spawn (receiverA ()); spawn (receiverB ()); sender "" 0 0.0}>
+ return <xml><body onload={onDisconnect (alert "Server booted me");
+ onConnectFail (alert "Connection failed");
+ onServerError (fn s => alert ("Server error: " ^ s));
+ spawn (receiverA ()); spawn (receiverB ()); sender "" 0 0.0}>
<dyn signal={Buffer.render buf}/>
</body></xml>
end
diff --git a/tests/updateErr.ur b/tests/updateErr.ur
new file mode 100644
index 00000000..345e3aa8
--- /dev/null
+++ b/tests/updateErr.ur
@@ -0,0 +1,17 @@
+fun main () : transaction page =
+ s <- source "";
+ b <- Buffer.create;
+ txt <- source "";
+
+ return <xml><body onload={onError (fn xml => Buffer.write b (show xml));
+ onFail (fn s => alert ("FAIL! " ^ s))}>
+ <dyn signal={s <- signal s; return <xml>{[s]}</xml>}/><br/>
+ <dyn signal={s <- signal s; if s = "" then return <xml>Init</xml> else error <xml>Crapky</xml>}/><br/>
+ <dyn signal={s <- signal s; return <xml>"{[s]}"</xml>}/><br/>
+
+ <ctextbox source={txt}/> <button onclick={s' <- get txt; set s s'; set txt ""}/>
+
+ <hr/>
+
+ <dyn signal={Buffer.render b}/>
+ </body></xml>
diff --git a/tests/updateErr.urp b/tests/updateErr.urp
new file mode 100644
index 00000000..80d8200b
--- /dev/null
+++ b/tests/updateErr.urp
@@ -0,0 +1,4 @@
+debug
+
+buffer
+updateErr