Files
passepartout/tests/self-edit-tests.lisp
Amr Gharbeia 249d537ca2
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
Add org-skill-self-edit: self-repair with paren balancing
- New skill hooks into :syntax-error and :repair-request events
- Deterministic paren balancing (fast fix)
- Surgical file edits with memory rollback on failure
- :self-edit and :balance-parens cognitive tools
- 9 new tests, all 93 tests passing
2026-04-23 22:18:31 -04:00

35 lines
1.1 KiB
Common Lisp

(defpackage :opencortex-self-edit-tests
(:use :cl :fiveam :opencortex)
(:export #:self-edit-suite))
(in-package :opencortex-self-edit-tests)
(def-suite self-edit-suite
:description "Tests for Self-Edit skill.")
(in-suite self-edit-suite)
(test balance-parens-balanced
(let ((result (opencortex:self-edit-balance-parens "(+ 1 2)")))
(is (string= result "(+ 1 2)"))
(is (not (null (read-from-string result))))))
(test balance-parens-missing-open
(let ((result (opencortex:self-edit-balance-parens "+ 1 2)")))
(is (string= result "(+ 1 2)"))
(is (not (null (read-from-string result))))))
(test balance-parens-missing-close
(let ((result (opencortex:self-edit-balance-parens "(+ 1 2")))
(is (string= result "(+ 1 2)"))
(is (not (null (read-from-string result))))))
(test balance-parens-deep
(let ((result (opencortex:self-edit-balance-parens "((lambda (x) (if x (+ 1 2) 3))")))
(is (string= result "((lambda (x) (if x (+ 1 2) 3)))"))
(is (not (null (read-from-string result))))))
(test balance-parens-empty
(let ((result (opencortex:self-edit-balance-parens "")))
(is (string= result ""))))