From bd1f226f31147801a7d1bf2d28ee045b8eca6483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Thu, 7 May 2026 20:27:34 +0200 Subject: [PATCH] tests: mop: add a unit tests for FUNCALLABLE-STANDARD-OBJECT Test whether it is correctly recognized as the subtype of the function. --- .../normal-tests/metaobject-protocol.lsp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/normal-tests/metaobject-protocol.lsp b/src/tests/normal-tests/metaobject-protocol.lsp index b499fe8ff..ce4099d94 100644 --- a/src/tests/normal-tests/metaobject-protocol.lsp +++ b/src/tests/normal-tests/metaobject-protocol.lsp @@ -760,3 +760,26 @@ the metaclass") ;;; STANDARD-METHOD is removed. (test mop.0029.standard-method-metastability (finishes (clos:finalize-inheritance (find-class 'standard-method)))) + +;;; Date 2026-05-07 +;;; Description +;;; +;;; Funcallable instances are normal instances recognized as funcallables +;;; with a header flag .isgf; before MOP:SET-FUNCALLABLE-INSTANCE-FUNCTION +;;; was called, or if it was called with NIL, object->instance.isgf was +;;; assigned NULL value, thus (functionp object) returned incorrectly nil. +(deftest mop.0030 () + (let* ((funclass (find-class 'mop:funcallable-standard-object)) + (instance (allocate-instance funclass))) + (is (typep instance 'function)) + (is (functionp instance)) + (mop:set-funcallable-instance-function instance (lambda ())) + (is (typep instance 'function)) + (is (functionp instance)) + (mop:set-funcallable-instance-function instance nil) + (is (typep instance 'function)) + (is (functionp instance)))) + +;;; Ensure that funcallable object is subclass of function. +(deftest mop.0031 () + (subtypep 'mop:funcallable-standard-object 'function))