summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile4
-rw-r--r--tests/cffi.ur3
-rw-r--r--tests/cffi.urp6
-rw-r--r--tests/cffi.urs1
-rw-r--r--tests/test.c15
-rw-r--r--tests/test.h7
-rw-r--r--tests/test.urs5
7 files changed, 41 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 00000000..5313d12d
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,4 @@
+all: test.o
+
+test.o: test.c
+ gcc -c test.c -o test.o
diff --git a/tests/cffi.ur b/tests/cffi.ur
new file mode 100644
index 00000000..2e20199b
--- /dev/null
+++ b/tests/cffi.ur
@@ -0,0 +1,3 @@
+fun main () = return <xml><body>
+ {[Test.out (Test.frob (Test.create "Hello ") "world!")]}
+</body></xml>
diff --git a/tests/cffi.urp b/tests/cffi.urp
new file mode 100644
index 00000000..cb27c744
--- /dev/null
+++ b/tests/cffi.urp
@@ -0,0 +1,6 @@
+debug
+ffi test
+include test.h
+link test.o
+
+cffi
diff --git a/tests/cffi.urs b/tests/cffi.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/cffi.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page
diff --git a/tests/test.c b/tests/test.c
new file mode 100644
index 00000000..c40eb966
--- /dev/null
+++ b/tests/test.c
@@ -0,0 +1,15 @@
+#include "../include/urweb.h"
+
+typedef uw_Basis_string uw_Test_t;
+
+uw_Test_t uw_Test_create(uw_context ctx, uw_Basis_string s) {
+ return s;
+}
+
+uw_Basis_string uw_Test_out(uw_context ctx, uw_Test_t s) {
+ return s;
+}
+
+uw_Test_t uw_Test_frob(uw_context ctx, uw_Test_t s1, uw_Basis_string s2) {
+ return uw_Basis_strcat(ctx, s1, s2);
+}
diff --git a/tests/test.h b/tests/test.h
new file mode 100644
index 00000000..4cd257f8
--- /dev/null
+++ b/tests/test.h
@@ -0,0 +1,7 @@
+#include "../include/urweb.h"
+
+typedef uw_Basis_string uw_Test_t;
+
+uw_Test_t uw_Test_create(uw_context, uw_Basis_string);
+uw_Basis_string uw_Test_out(uw_context, uw_Test_t);
+uw_Test_t uw_Test_frob(uw_context, uw_Test_t, uw_Basis_string);
diff --git a/tests/test.urs b/tests/test.urs
new file mode 100644
index 00000000..e354572c
--- /dev/null
+++ b/tests/test.urs
@@ -0,0 +1,5 @@
+type t
+
+val create : string -> t
+val out : t -> string
+val frob : t -> string -> t