summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 11:27:26 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 11:27:26 -0400
commitb57aab64873d55df8069cf520a6901bb2ce3d929 (patch)
tree9918a955a048024a07e68cd466c19c0dbf56f867 /tests
parent2570fc6449706fd93641ab23762194dbcd50db09 (diff)
Successfully influenced effectful-ness status of FFI func
Diffstat (limited to 'tests')
-rw-r--r--tests/cffi.ur5
-rw-r--r--tests/cffi.urp1
-rw-r--r--tests/test.c7
-rw-r--r--tests/test.h2
-rw-r--r--tests/test.urs1
5 files changed, 16 insertions, 0 deletions
diff --git a/tests/cffi.ur b/tests/cffi.ur
index 2e20199b..cc93b8f5 100644
--- a/tests/cffi.ur
+++ b/tests/cffi.ur
@@ -1,3 +1,8 @@
+fun effect () =
+ Test.print;
+ return <xml/>
+
fun main () = return <xml><body>
{[Test.out (Test.frob (Test.create "Hello ") "world!")]}
+ <form><submit action={effect}/></form>
</body></xml>
diff --git a/tests/cffi.urp b/tests/cffi.urp
index cb27c744..ed64da3a 100644
--- a/tests/cffi.urp
+++ b/tests/cffi.urp
@@ -2,5 +2,6 @@ debug
ffi test
include test.h
link test.o
+effectful Test.print
cffi
diff --git a/tests/test.c b/tests/test.c
index c40eb966..b4f23670 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
#include "../include/urweb.h"
typedef uw_Basis_string uw_Test_t;
@@ -13,3 +15,8 @@ uw_Basis_string uw_Test_out(uw_context ctx, uw_Test_t 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);
}
+
+uw_Basis_unit uw_Test_print(uw_context ctx) {
+ printf("Hi there!\n");
+ return uw_unit_v;
+}
diff --git a/tests/test.h b/tests/test.h
index 4cd257f8..d94cf02d 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -5,3 +5,5 @@ 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);
+
+uw_Basis_unit uw_Test_print(uw_context);
diff --git a/tests/test.urs b/tests/test.urs
index e354572c..b3c8505c 100644
--- a/tests/test.urs
+++ b/tests/test.urs
@@ -3,3 +3,4 @@ type t
val create : string -> t
val out : t -> string
val frob : t -> string -> t
+val print : transaction unit