summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-15 12:26:00 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-15 12:26:00 -0500
commit3e3d1d1234b6f29a33e7ca480b4b90fe4116f139 (patch)
tree9c9ff6eb180d602ec313b66f991c025c10e1a7a2 /tests
parentab13bbf764595fe6c01fcb5fe61bdf464d77f7fe (diff)
Initial generalization of Especialize, with security bug known
Diffstat (limited to 'tests')
-rw-r--r--tests/espec.ur56
-rw-r--r--tests/espec.urp3
-rw-r--r--tests/espec.urs1
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/espec.ur b/tests/espec.ur
new file mode 100644
index 00000000..37b22a36
--- /dev/null
+++ b/tests/espec.ur
@@ -0,0 +1,56 @@
+fun foo (wrap : xbody -> transaction page) = wrap <xml>
+ <a link={foo wrap}>Foo</a>
+</xml>
+
+fun bar (wrap : xbody -> transaction page) (n : int) = wrap <xml>
+ <a link={bar wrap n}>Bar</a>; {[n]}
+</xml>
+
+fun baz (n : int) (wrap : xbody -> transaction page) = wrap <xml>
+ <a link={baz n wrap}>Baz</a>; {[n]}
+</xml>
+
+fun middle (n : int) (wrap : xbody -> transaction page) (m : int) = wrap <xml>
+ <a link={middle n wrap m}>Middle</a>; {[n]}; {[m]}
+</xml>
+
+fun crazy (f : int -> int) (b : bool) (wrap : xbody -> transaction page) (m : int) = wrap <xml>
+ <a link={crazy f b wrap m}>Crazy</a>; {[b]}; {[f m]}
+</xml>
+
+fun wild (q : bool) (f : int -> int) (n : float) (wrap : xbody -> transaction page) (m : int) = wrap <xml>
+ <a link={wild q f n wrap m}>Wild</a>; {[n]}; {[f m]}; {[q]}
+</xml>
+
+fun wrap x = return <xml><body>{x}</body></xml>
+
+fun wrapN n x = return <xml><body>{[n]}; {x}</body></xml>
+
+fun foo2 (wrap : xbody -> transaction page) = wrap <xml>
+ <a link={foo2 wrap}>Foo</a>
+</xml>
+
+fun foo3 (n : int) = wrap <xml>
+ <a link={foo2 (wrapN n)}>Foo</a>
+</xml>
+
+fun bar2 (n : int) (wrap : xbody -> transaction page) = wrap <xml>
+ <a link={bar2 n wrap}>Bar</a>; n={[n]}
+</xml>
+
+fun bar3 (n : int) = wrap <xml>
+ <a link={bar2 88 (wrapN n)}>Bar</a>
+</xml>
+
+
+fun main () = return <xml><body>
+ <a link={foo wrap}>Foo</a>
+ <a link={bar wrap 32}>Bar</a>
+ <a link={baz 18 wrap}>Baz</a>
+ <a link={middle 1 wrap 2}>Middle</a>
+ <a link={crazy (fn n => 2 * n) False wrap 2}>Crazy</a>
+ <a link={wild True (fn n => 2 * n) 1.23 wrap 2}>Wild</a>
+ <hr/>
+ <a link={foo3 15}>Foo3</a>
+ <a link={bar3 44}>Bar3</a>
+</body></xml>
diff --git a/tests/espec.urp b/tests/espec.urp
new file mode 100644
index 00000000..045fb1e0
--- /dev/null
+++ b/tests/espec.urp
@@ -0,0 +1,3 @@
+debug
+
+espec
diff --git a/tests/espec.urs b/tests/espec.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/espec.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page