tier3: contracts + tests for 12 remaining modules (all 39 files now have Contracts)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
This commit is contained in:
@@ -25,11 +25,15 @@ The REPL skill fills this gap by:
|
||||
- Can load code into image
|
||||
- Optional: connect to external SLIME/Swank session
|
||||
|
||||
* Phase B: Protocol (Spec)
|
||||
- `repl-eval` returns: (values result output error)
|
||||
- `repl-inspect` returns: structured description
|
||||
- `repl-list-vars` returns: list of bound symbols
|
||||
- `repl-load-file` returns: t on success, error on failure
|
||||
* Phase B: Contract
|
||||
|
||||
1. (repl-eval code-string &key package): evaluates Lisp code in a
|
||||
sandboxed environment (~*read-eval* nil~). Returns (values result
|
||||
output error) as three strings. Adds to ~*repl-history*~.
|
||||
2. (repl-inspect symbol-name &key package): returns a formatted string
|
||||
describing the symbol's value, type, or function documentation.
|
||||
3. (repl-list-vars &key package): returns a list of bound variable
|
||||
names in the given package.
|
||||
|
||||
* Phase C: Implementation
|
||||
|
||||
@@ -264,3 +268,43 @@ The REPL skill loads at priority 200 (after diagnostics at 100, before utils-lis
|
||||
:deterministic (lambda (action ctx) (declare (ignore action ctx)) nil)
|
||||
:system-prompt-augment #'repl-mandate)
|
||||
#+end_src
|
||||
|
||||
* Test Suite
|
||||
|
||||
#+begin_src lisp
|
||||
(eval-when (:compile-toplevel :load-toplevel :execute)
|
||||
(ql:quickload :fiveam :silent t))
|
||||
|
||||
(defpackage :passepartout-programming-repl-tests
|
||||
(:use :cl :fiveam :passepartout)
|
||||
(:export #:repl-suite))
|
||||
|
||||
(in-package :passepartout-programming-repl-tests)
|
||||
|
||||
(def-suite repl-suite :description "Verification of the REPL skill")
|
||||
(in-suite repl-suite)
|
||||
|
||||
(test test-repl-eval-success
|
||||
"Contract 1: repl-eval returns result and no error for valid code."
|
||||
(multiple-value-bind (result output error) (repl-eval "(+ 1 2)")
|
||||
(is (equal "3" result))
|
||||
(is (null error))))
|
||||
|
||||
(test test-repl-eval-error
|
||||
"Contract 1: repl-eval returns error message for invalid code."
|
||||
(multiple-value-bind (result output error) (repl-eval "(+ 1 ")
|
||||
(is (null result))
|
||||
(is (stringp error))))
|
||||
|
||||
(test test-repl-inspect-found
|
||||
"Contract 2: repl-inspect returns description for a bound symbol."
|
||||
(let ((desc (repl-inspect "+" :package :cl)))
|
||||
(is (search "+" desc))
|
||||
(is (search "function" desc :test #'char-equal))))
|
||||
|
||||
(test test-repl-list-vars
|
||||
"Contract 3: repl-list-vars returns a list of symbols."
|
||||
(let ((vars (repl-list-vars :package :keyword)))
|
||||
(is (listp vars))
|
||||
(is (member ':repl-sensor vars))))
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user