diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-08-02 16:33:25 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-08-02 16:33:25 -0400 |
commit | 342c17de79e7624affa866ee9eab9027453ae99e (patch) | |
tree | 201d14d77f7f944545809bff02ae45fc826bb7e7 /tests | |
parent | 6a1cc9086991449cf027277849cfe69450be5876 (diff) |
Basis.getenv
Diffstat (limited to 'tests')
-rw-r--r-- | tests/env.ur | 21 | ||||
-rw-r--r-- | tests/env.urp | 6 | ||||
-rw-r--r-- | tests/env.urs | 1 |
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 |