Permalink
Browse files

New FOREIGN-SYMBOL-POINTER tests

- Added tests: FOREIGN-GLOBALS.UNDEFINED.1 and FOREIGN-GLOBALS.ERROR.1.
- Check that FOREIGN-SYMBOL-POINTER's 'name' arg is a string.
  • Loading branch information...
1 parent 1a11343 commit 8bda717cea2c1f39934529be9cdfda5e5d0f0403 @luismbo luismbo committed Jan 7, 2011
Showing with 15 additions and 1 deletion.
  1. +1 −0 src/foreign-vars.lisp
  2. +14 −1 tests/foreign-globals.lisp
View
@@ -41,6 +41,7 @@
;;; Note: this will lookup not only variables but also functions.
(defun foreign-symbol-pointer (name &key (library :default))
+ (check-type name string)
(%foreign-symbol-pointer
name (if (eq library :default)
:default
View
@@ -293,4 +293,17 @@
(deftest defcvar.docstring
(documentation '*var-char-ro* 'variable)
- "docstring")
+ "docstring")
+
+;;;# Other tests
+
+;;; RT: FOREIGN-SYMBOL-POINTER shouldn't signal an error when passed
+;;; an undefined variable.
+(deftest foreign-globals.undefined.1
+ (foreign-symbol-pointer "surely-undefined?")
+ nil)
+
+(deftest foreign-globals.error.1
+ (handler-case (foreign-symbol-pointer 'not-a-string)
+ (type-error () t))
+ t)

0 comments on commit 8bda717

Please sign in to comment.