summaryrefslogtreecommitdiff
path: root/tests/env.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-08-02 16:33:25 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-08-02 16:33:25 -0400
commit342c17de79e7624affa866ee9eab9027453ae99e (patch)
tree201d14d77f7f944545809bff02ae45fc826bb7e7 /tests/env.ur
parent6a1cc9086991449cf027277849cfe69450be5876 (diff)
Basis.getenv
Diffstat (limited to 'tests/env.ur')
-rw-r--r--tests/env.ur21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/env.ur b/tests/env.ur
new file mode 100644
index 00000000..637ea6b8
--- /dev/null
+++ b/tests/env.ur
@@ -0,0 +1,21 @@
+fun handler r =
+ vo <- getenv (blessEnvVar r.Nam);
+ return <xml><body>
+ {case vo of
+ None => <xml>Not set</xml>
+ | Some v => <xml>Set to: {[v]}</xml>}
+</body></xml>
+
+fun main () : transaction page =
+ term <- getenv (blessEnvVar "TERM");
+ return <xml><body>
+ TERM = {case term of
+ None => <xml>Nada</xml>
+ | Some v => txt v}
+
+ <form>
+ What would you like to know?
+ <textbox{#Nam}/>
+ <submit action={handler}/>
+ </form>
+ </body></xml>