summaryrefslogtreecommitdiff
path: root/tests
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
parent6a1cc9086991449cf027277849cfe69450be5876 (diff)
Basis.getenv
Diffstat (limited to 'tests')
-rw-r--r--tests/env.ur21
-rw-r--r--tests/env.urp6
-rw-r--r--tests/env.urs1
3 files changed, 28 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>
diff --git a/tests/env.urp b/tests/env.urp
new file mode 100644
index 00000000..0860c8d7
--- /dev/null
+++ b/tests/env.urp
@@ -0,0 +1,6 @@
+rewrite url Env/*
+allow env TERM
+allow env DESKTOP_*
+allow env SCRIPT_NAME
+
+env
diff --git a/tests/env.urs b/tests/env.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/env.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page