diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cffi.ur | 5 | ||||
-rw-r--r-- | tests/cffi.urp | 1 | ||||
-rw-r--r-- | tests/test.c | 7 | ||||
-rw-r--r-- | tests/test.h | 2 | ||||
-rw-r--r-- | tests/test.urs | 1 |
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 |