summaryrefslogtreecommitdiff
path: root/tests/case.ur
diff options
context:
space:
mode:
authorGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2018-12-22 14:15:51 +0200
committerGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2018-12-22 14:15:51 +0200
commit1a39672b01dc236068475e2d1a8a6f21814cba7e (patch)
tree2c6bf98ad4b8129f8c130d24fe8f6bc78cda24fe /tests/case.ur
parent91c0e37b0ddc8495e31bd653b8bc363fd14f4375 (diff)
More tests.
Diffstat (limited to 'tests/case.ur')
-rw-r--r--tests/case.ur22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/case.ur b/tests/case.ur
index b131b27b..a6f4c700 100644
--- a/tests/case.ur
+++ b/tests/case.ur
@@ -11,6 +11,22 @@ datatype nat = O | S of nat
val is_two = fn x : nat =>
case x of S (S O) => A | _ => B
-val zero_is_two = is_two O
-val one_is_two = is_two (S O)
-val two_is_two = is_two (S (S O))
+val shw = fn x : t =>
+ case x of A => "A" | B => "B"
+
+fun main (): transaction page = return <xml><body>
+ <div>
+ <p>zero is two: {[shw (is_two O)]}</p>
+ <p>one is two: {[shw (is_two (S O))]}</p>
+ <p>two is two: {[shw (is_two (S (S O)))]}</p>
+ </div>
+
+ <button onclick={fn _ => let
+ val m =
+ "zero is two: " ^ shw (is_two O) ^ "\n" ^
+ "one is two: " ^ shw (is_two (S O)) ^ "\n" ^
+ "two is two: " ^ shw (is_two (S (S O)))
+ in
+ alert m
+ end}>click me</button>
+</body></xml>