diff options
author | Ziv Scully <ziv@mit.edu> | 2014-05-27 21:38:01 -0400 |
---|---|---|
committer | Ziv Scully <ziv@mit.edu> | 2014-05-27 21:38:01 -0400 |
commit | dc336268adfbf2b05b34ab006de5990f8ce9086c (patch) | |
tree | 22fb72ef5ad32f47571fa250515108188d7e22f9 /tests | |
parent | d941d873c0203009ccf44aa4aed97671703ca375 (diff) | |
parent | 4cee29f03879d25963e3d8a8dda879e0a007033c (diff) |
Merge.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/activeEmpty.ur | 5 | ||||
-rw-r--r-- | tests/bindpat.ur | 6 | ||||
-rw-r--r-- | tests/data_attr.ur | 26 | ||||
-rw-r--r-- | tests/data_attr.urs | 1 | ||||
-rw-r--r-- | tests/dynClass.ur | 2 | ||||
-rw-r--r-- | tests/dynList.ur | 22 | ||||
-rw-r--r-- | tests/dynList.urp | 4 | ||||
-rw-r--r-- | tests/dynList.urs | 1 | ||||
-rw-r--r-- | tests/lessSafeFfi.ur | 19 | ||||
-rw-r--r-- | tests/lessSafeFfi.urp | 5 | ||||
-rw-r--r-- | tests/lessSafeFfi.urs | 1 | ||||
-rw-r--r-- | tests/thead.ur | 16 |
12 files changed, 107 insertions, 1 deletions
diff --git a/tests/activeEmpty.ur b/tests/activeEmpty.ur new file mode 100644 index 00000000..4c089899 --- /dev/null +++ b/tests/activeEmpty.ur @@ -0,0 +1,5 @@ +fun main () : transaction page = return <xml><body> + <active code={alert "Howdy, neighbor!"; return <xml/>}/> + <hr/> + <active code={return <xml>This one <b>ain't</b> empty.</xml>}/> +</body></xml> diff --git a/tests/bindpat.ur b/tests/bindpat.ur new file mode 100644 index 00000000..bca4bd41 --- /dev/null +++ b/tests/bindpat.ur @@ -0,0 +1,6 @@ +fun main () : transaction page = + (a, b) <- return (1, 2); + {C = c, ...} <- return {C = "hi", D = False}; + d <- return 2.34; + {1 = e, 2 = f} <- return (8, 9); + return <xml>{[a]}, {[b]}, {[c]}, {[d]}, {[e]}, {[f]}</xml> diff --git a/tests/data_attr.ur b/tests/data_attr.ur new file mode 100644 index 00000000..80dda857 --- /dev/null +++ b/tests/data_attr.ur @@ -0,0 +1,26 @@ +fun dynd r = return <xml><body> + <div data={data_attr r.Attr r.Value}>How about that?</div> +</body></xml> + +fun main () : transaction page = + s <- source <xml/>; + a <- source ""; + v <- source ""; + return <xml><body> + <div data-foo="hi" data-bar="bye" data-baz="why">Whoa there, cowboy!</div> + + <hr/> + + <form> + <textbox{#Attr}/> = <textbox{#Value}/> + <submit action={dynd}/> + </form> + + <hr/> + + <ctextbox source={a}/> = <ctextbox source={v}/> + <button onclick={fn _ => + a <- get a; v <- get v; set s <xml><div data={data_attr a v}>OHO!</div></xml>}/> + <hr/> + <dyn signal={signal s}/> + </body></xml> diff --git a/tests/data_attr.urs b/tests/data_attr.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/data_attr.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/tests/dynClass.ur b/tests/dynClass.ur index 37f931a2..7cb94d28 100644 --- a/tests/dynClass.ur +++ b/tests/dynClass.ur @@ -15,7 +15,7 @@ fun main () : transaction page = STYLE "width: 500px" else STYLE "width: 200px")} - onclick={b <- get toggle; set toggle (not b)}/> + onclick={fn _ => b <- get toggle; set toggle (not b)}/> <button dynStyle={b <- signal toggle; return (if b then diff --git a/tests/dynList.ur b/tests/dynList.ur new file mode 100644 index 00000000..09b3ee4c --- /dev/null +++ b/tests/dynList.ur @@ -0,0 +1,22 @@ +fun main () = + b <- source True; + let + fun textboxList xs = <xml> + <table> + {List.mapX (fn src => <xml><tr> + <td dynClass={return null} dynStyle={b <- signal b; + if b then + return (STYLE "width: 500px") + else + return (STYLE "width: 100px")}> + <ctextbox source={src}/> + </td></tr></xml>) xs} + </table> + </xml> + in + s <- source "foo"; + return <xml><body> + <ccheckbox source={b}/> + {textboxList (s :: s :: [])} + </body></xml> + end diff --git a/tests/dynList.urp b/tests/dynList.urp new file mode 100644 index 00000000..dc33cb28 --- /dev/null +++ b/tests/dynList.urp @@ -0,0 +1,4 @@ +rewrite all DynList/* + +$/list +dynList diff --git a/tests/dynList.urs b/tests/dynList.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/dynList.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/tests/lessSafeFfi.ur b/tests/lessSafeFfi.ur new file mode 100644 index 00000000..da79bfdc --- /dev/null +++ b/tests/lessSafeFfi.ur @@ -0,0 +1,19 @@ +ffi foo : int -> int +ffi bar serverOnly benignEffectful : int -> transaction unit +ffi baz : transaction int + +ffi bup jsFunc "jsbup" : int -> transaction unit + +fun other () : transaction page = + (*bar 17; + q <- baz;*) + return <xml><body> + (*{[foo 42]}, {[q]}*) + <button onclick={fn _ => bup 32}/> + </body></xml> + +fun main () = return <xml><body> + <form> + <submit action={other}/> + </form> +</body></xml> diff --git a/tests/lessSafeFfi.urp b/tests/lessSafeFfi.urp new file mode 100644 index 00000000..729c5272 --- /dev/null +++ b/tests/lessSafeFfi.urp @@ -0,0 +1,5 @@ +rewrite all LessSafeFfi/* +debug +lessSafeFfi + +lessSafeFfi diff --git a/tests/lessSafeFfi.urs b/tests/lessSafeFfi.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/lessSafeFfi.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/tests/thead.ur b/tests/thead.ur new file mode 100644 index 00000000..a9774348 --- /dev/null +++ b/tests/thead.ur @@ -0,0 +1,16 @@ +fun main () : transaction page = return <xml><body> + <table> + <thead> + <tr> <th>A</th> <th>B</th> </tr> + </thead> + + <tbody> + <tr> <td>1</td> <td>2</td> </tr> + <tr> <td>3</td> <td>4</td> </tr> + </tbody> + + <tfoot> + <tr> <th>C</th> <th>D</th> </tr> + </tfoot> + </table> +</body></xml> |