summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fromString.ur24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/fromString.ur b/tests/fromString.ur
index d9a087e4..673503ae 100644
--- a/tests/fromString.ur
+++ b/tests/fromString.ur
@@ -1,10 +1,26 @@
-fun i2s s =
+fun s2i s =
case stringToInt s of
None => 0
| Some n => n
+fun s2f s =
+ case stringToFloat s of
+ None => 0.0
+ | Some n => n
+
+fun s2b s =
+ case stringToBool s of
+ None => False
+ | Some b => b
+
fun main () : transaction page = return <html><body>
- Error = {cdata (show _ (i2s "Error"))}<br/>
- 3 = {cdata (show _ (i2s "+3"))}<br/>
+ Error = {cdata (show _ (s2i "Error"))}<br/>
+ 3 = {cdata (show _ (s2i "+3"))}<br/>
+ <br/>
+ Error = {cdata (show _ (s2f "Error"))}<br/>
+ 98.76 = {cdata (show _ (s2f "98.76"))}<br/>
+ <br/>
+ Error = {cdata (show _ (s2b "Error"))}<br/>
+ False = {cdata (show _ (s2b "false"))}<br/>
+ True = {cdata (show _ (s2b "trUE"))}<br/>
</body></html>
-