summaryrefslogtreecommitdiff
path: root/test-suite/tests/foreign.test
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-02-09 00:08:14 +0100
committerLudovic Courtès <ludo@gnu.org>2011-02-09 00:08:14 +0100
commit9970cf67080b48ec35680c70146500428b47bf3e (patch)
treef8e6b3ebb87626783d46bd6d3a6387772796a027 /test-suite/tests/foreign.test
parent6090483143d53a136e46186887edb3961b825682 (diff)
downloadguile-9970cf67080b48ec35680c70146500428b47bf3e.tar.gz
Improve type checking when invoking foreign functions.
* libguile/foreign.c (unpack): Make sure X is a pointer before using `SCM_POINTER_VALUE'. * test-suite/tests/foreign.test ("pointer->procedure"): New test prefix.
Diffstat (limited to 'test-suite/tests/foreign.test')
-rw-r--r--test-suite/tests/foreign.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/test-suite/tests/foreign.test b/test-suite/tests/foreign.test
index ba53a0d06..3569c8a52 100644
--- a/test-suite/tests/foreign.test
+++ b/test-suite/tests/foreign.test
@@ -137,6 +137,14 @@
(string=? s (pointer->string (string->pointer s)))))))
+(with-test-prefix "pointer->procedure"
+
+ (pass-if-exception "object instead of pointer"
+ exception:wrong-type-arg
+ (let ((p (pointer->procedure '* %null-pointer '(*))))
+ (p #t))))
+
+
(with-test-prefix "procedure->pointer"
(define qsort