diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2020-05-30 19:49:56 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2020-05-30 19:49:56 -0400 |
commit | c2f1e1096f602b1cbd4531352f3e1ea6d656a186 (patch) | |
tree | ae102982878bb0c31bdfe07209e60bfc14030490 /tests/endpoints.ur | |
parent | 095c2640aa2070ed4e2765875238d5e6e6673856 (diff) | |
parent | 5a0b639dfbd7db9d16c6995f72ba17152a1f362d (diff) |
Merge branch 'upstream' into dfsg_clean20200209+dfsgdfsg_clean
Diffstat (limited to 'tests/endpoints.ur')
-rw-r--r-- | tests/endpoints.ur | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/endpoints.ur b/tests/endpoints.ur new file mode 100644 index 00000000..ddb91faa --- /dev/null +++ b/tests/endpoints.ur @@ -0,0 +1,40 @@ +fun formbased (): transaction page = + return <xml> + <body> + <form> + <label>Your name: <textbox{#Nam}/></label> + <label>Your message: <textarea{#Msg}/></label> + <label>Delivered on the same day <checkbox{#Sameday}/></label> + <submit value="Send" action={formbased_handler}/> + </form> + </body> + </xml> + +and formbased_handler (r : {Nam : string, Msg : string, Sameday : bool}) : transaction page = + return <xml> + <body> + <p>Oh hello {[r.Nam]}! Great to see you here again!</p> + <p>Your message was:</p> + <p>{[r.Msg]}</p> + <p>Sameday delivery was:</p> + <p>{[if r.Sameday then "set" else "unset"]}</p> + </body> + </xml> + +fun say_hi_to (s : string) : transaction page = +return <xml> + <body> + <p>It's {[s]} birthday!</p> + </body> +</xml> + +fun optimized_out (): transaction page = + return <xml>this one is optimized away since it's not referenced in the declarations</xml> + +fun main (): transaction page = + return <xml> + <body> + <p>hello</p> + <p>Say hi to <a link={say_hi_to "JC"}>JC</a></p> + </body> +</xml> |