summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 12:10:43 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 12:10:43 -0400
commit065cd9359366197fd8ea66cc584f4e857dfa6ab6 (patch)
treeb2b7e5a618878c8ac7026aa98312d6f9697bc9f6 /tests
parentb57aab64873d55df8069cf520a6901bb2ce3d929 (diff)
More FFI compiler options
Diffstat (limited to 'tests')
-rw-r--r--tests/cffi.ur8
-rw-r--r--tests/cffi.urp5
-rw-r--r--tests/test.c5
-rw-r--r--tests/test.h1
-rw-r--r--tests/test.js7
-rw-r--r--tests/test.urs3
6 files changed, 28 insertions, 1 deletions
diff --git a/tests/cffi.ur b/tests/cffi.ur
index cc93b8f5..039eac55 100644
--- a/tests/cffi.ur
+++ b/tests/cffi.ur
@@ -1,6 +1,12 @@
+fun printer () = Test.foo
+
fun effect () =
Test.print;
- return <xml/>
+ return <xml><body>
+ <button value="Remote" onclick={printer ()}/>
+ <button value="Local" onclick={Test.bar "Hoho"}/>
+ <button value="Either" onclick={Test.print}/>
+ </body></xml>
fun main () = return <xml><body>
{[Test.out (Test.frob (Test.create "Hello ") "world!")]}
diff --git a/tests/cffi.urp b/tests/cffi.urp
index ed64da3a..f2755cb6 100644
--- a/tests/cffi.urp
+++ b/tests/cffi.urp
@@ -1,7 +1,12 @@
debug
ffi test
include test.h
+script http://localhost/test/test.js
link test.o
effectful Test.print
+serverOnly Test.foo
+clientOnly Test.bar
+jsFunc Test.print=print
+jsFunc Test.bar=bar
cffi
diff --git a/tests/test.c b/tests/test.c
index b4f23670..1249721e 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -20,3 +20,8 @@ uw_Basis_unit uw_Test_print(uw_context ctx) {
printf("Hi there!\n");
return uw_unit_v;
}
+
+uw_Basis_unit uw_Test_foo(uw_context ctx) {
+ printf("FOO!\n");
+ return uw_unit_v;
+}
diff --git a/tests/test.h b/tests/test.h
index d94cf02d..d1574e1b 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -7,3 +7,4 @@ 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);
+uw_Basis_unit uw_Test_foo(uw_context);
diff --git a/tests/test.js b/tests/test.js
new file mode 100644
index 00000000..4f29ca81
--- /dev/null
+++ b/tests/test.js
@@ -0,0 +1,7 @@
+function print() {
+ alert("Hi there!");
+}
+
+function bar(s) {
+ alert("<<" + s + ">>");
+}
diff --git a/tests/test.urs b/tests/test.urs
index b3c8505c..05efcb5b 100644
--- a/tests/test.urs
+++ b/tests/test.urs
@@ -4,3 +4,6 @@ val create : string -> t
val out : t -> string
val frob : t -> string -> t
val print : transaction unit
+
+val foo : transaction unit
+val bar : string -> transaction unit