refactor: Migrate skill tests to Org files - delete redundant .lisp
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Added inline tests: - org-skill-lisp-utils.org: lisp-validator tests - org-skill-tool-permissions.org: tool-permissions tests Deleted duplicates: - tests/lisp-validator-tests.lisp - tests/tool-permissions-tests.lisp All tests pass: 84/84 (100%)
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
(defpackage :opencortex-lisp-validator-tests
|
||||
(:use :cl :fiveam :opencortex)
|
||||
(:export #:lisp-validator-suite))
|
||||
|
||||
(in-package :opencortex-lisp-validator-tests)
|
||||
|
||||
(def-suite lisp-validator-suite
|
||||
:description "Tests for the Lisp Validator structural, syntactic, and semantic gates.")
|
||||
|
||||
(in-suite lisp-validator-suite)
|
||||
|
||||
(test structural-balanced
|
||||
(let ((result (opencortex::lisp-validator-check-structural "(+ 1 2)")))
|
||||
(is (eq result t))))
|
||||
|
||||
(test structural-unbalanced-open
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-structural "(+ 1 2")
|
||||
(is (null ok))
|
||||
(is (search "Unbalanced" reason))
|
||||
(is (= line 1))))
|
||||
|
||||
(test structural-unbalanced-close
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-structural "+ 1 2)")
|
||||
(is (null ok))
|
||||
(is (search "Unexpected" reason)))
|
||||
|
||||
(test structural-mismatched-bracket
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-structural "(let [x 1) x)")
|
||||
(is (null ok))
|
||||
(is (search "Mismatched" reason))))
|
||||
|
||||
(test syntactic-valid
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-syntactic "(+ 1 2) (* 3 4)")
|
||||
(is ok)))
|
||||
|
||||
(test syntactic-invalid-reader
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-syntactic "(1+ 2 #")")
|
||||
(is (null ok))))
|
||||
|
||||
(test semantic-safe
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-semantic "(+ 1 2)")
|
||||
(is ok)))
|
||||
|
||||
(test semantic-blocked-eval
|
||||
(multiple-value-bind (ok reason line col)
|
||||
(opencortex::lisp-validator-check-semantic "(eval '(+ 1 2))")
|
||||
(is (null ok))))
|
||||
|
||||
(test unified-success
|
||||
(let ((result (opencortex::lisp-validator-validate "(+ 1 2)" :strict t)))
|
||||
(is (eq (getf result :status) :success))
|
||||
(is (getf (getf result :checks) :structural))
|
||||
(is (getf (getf result :checks) :syntactic))
|
||||
(is (getf (getf result :checks) :semantic))))
|
||||
|
||||
(test unified-structural-failure
|
||||
(let ((result (opencortex::lisp-validator-validate "(+ 1 2" :strict nil)))
|
||||
(is (eq (getf result :status) :error))
|
||||
(is (eq (getf result :failed) :structural))))
|
||||
|
||||
(test unified-semantic-failure-strict
|
||||
(let ((result (opencortex::lisp-validator-validate "(delete-file \"x.txt\")" :strict t)))
|
||||
(is (eq (getf result :status) :error))
|
||||
(is (eq (getf result :failed) :semantic))))
|
||||
@@ -1,40 +0,0 @@
|
||||
(defpackage :opencortex-tool-permissions-tests
|
||||
(:use :cl :fiveam :opencortex)
|
||||
(:export #:tool-permissions-suite))
|
||||
|
||||
(in-package :opencortex-tool-permissions-tests)
|
||||
|
||||
(def-suite tool-permissions-suite
|
||||
:description "Tests for Tool Permission Tiers.")
|
||||
|
||||
(in-suite tool-permissions-suite)
|
||||
|
||||
(test default-permission-is-allow
|
||||
"Unknown tools default to :allow."
|
||||
(is (eq (get-tool-permission :unknown-tool-xyz) :allow)))
|
||||
|
||||
(test set-and-get-permission
|
||||
"Verify :allow, :deny, :ask persist correctly."
|
||||
(set-tool-permission :test-tool-abc :deny)
|
||||
(is (eq (get-tool-permission :test-tool-abc) :deny))
|
||||
(set-tool-permission :test-tool-abc :ask)
|
||||
(is (eq (get-tool-permission :test-tool-abc) :ask))
|
||||
(set-tool-permission :test-tool-abc :allow)
|
||||
(is (eq (get-tool-permission :test-tool-abc) :allow)))
|
||||
|
||||
(test permission-gate-allow
|
||||
":allow returns :allow."
|
||||
(set-tool-permission :gate-allow-tool :allow)
|
||||
(is (eq (check-tool-permission-gate :gate-allow-tool nil) :allow)))
|
||||
|
||||
(test permission-gate-deny
|
||||
":deny returns :deny."
|
||||
(set-tool-permission :gate-deny-tool :deny)
|
||||
(is (eq (check-tool-permission-gate :gate-deny-tool nil) :deny)))
|
||||
|
||||
(test permission-gate-ask
|
||||
":ask returns a signal list."
|
||||
(set-tool-permission :gate-ask-tool :ask)
|
||||
(let ((result (check-tool-permission-gate :gate-ask-tool nil)))
|
||||
(is (listp result))
|
||||
(is (eq (car result) :ask))))
|
||||
Reference in New Issue
Block a user