source: trunk/abcl/contrib/abcl-introspect/t/environments.lisp

Last change on this file was 15557, checked in by Mark Evenson, 2 years ago

abcl-introspect: fix and move test into contrib

Failing test was actually returning additional information that was
causing the test to fail, namely a block marker from Primitives.java:

((:LEXICAL-VARIABLE A 10) (:LEXICAL-VARIABLE B 20)

(:BLOCK BAR #<org.armedbear.lisp.Primitives$BlockMarker?@ca46a46>))

The "extra" stuff which ABCL-INTROSPECT adds to the SYSTEM package may
not always be available if say JSS fails to load. Make this explicit
by moving the test.

File size: 1.0 KB
Line 
1(in-package :cl-user)
2
3(defmacro env-parts (&environment env)
4  `(sys::environment-parts ,env))
5
6(prove:plan 1)
7(prove:is
8   (eval 
9    '(let ((a 10))
10      (env-parts)))
11   '((:lexical-variable a 10))
12   "Lexical let binding captures local")
13
14(prove:plan 1)
15(prove:ok
16 (let ((env-parts-information
17         (eval '(let ((b 20))
18                 (defun bar ()
19                   (let ((a 10)) (env-parts)))
20                 (bar))))
21       (expected-clauses
22         #| Testing envionment actually contains:
23           ((:LEXICAL-VARIABLE A 10) (:LEXICAL-VARIABLE B 20)
24             (:BLOCK BAR #<org.armedbear.lisp.Primitives$BlockMarker@ca46a46>))
25|#
26         '((:LEXICAL-VARIABLE A 10) (:LEXICAL-VARIABLE B 20))))
27   ;;; FIXME find a more idiomatic way to do this that also reports
28   ;;; what fails.  Use CL:INTERSECTION
29   (reduce
30    (lambda (a b) (and a b))
31    (mapcar
32     (lambda (item)
33       (member item env-parts-information :test #'equalp))
34     expected-clauses)))
35   "Nested lexical bindings captures locals")
36
37(prove:finalize)
38
39
40
Note: See TracBrowser for help on using the repository browser.