#+TITLE: Tests: Utils Org #+AUTHOR: Agent #+PROPERTY: header-args:lisp :tangle utils-org-tests.lisp * Overview Verification of the structural manipulation for Org-mode files and their AST representation. * Implementation ** Package Context #+begin_src lisp (defpackage :opencortex-utils-org-tests (:use :cl :fiveam :opencortex) (:export #:utils-org-suite)) (in-package :opencortex-utils-org-tests) (def-suite utils-org-suite :description "Tests for Utils Org skill.") (in-suite utils-org-suite) #+end_src ** ID Generation #+begin_src lisp (test id-generation (let ((id1 (utils-org-generate-id)) (id2 (utils-org-generate-id))) (is (plusp (length id1))) (is (not (string= id1 id2))))) ;; Likely unique #+end_src ** ID Format #+begin_src lisp (test id-format (let ((formatted (utils-org-id-format "abc12345"))) (is (search "id:" formatted)))) #+end_src ** Property Setter #+begin_src lisp (test property-setter (let ((ast (list :type :HEADLINE :properties (list :ID "id:test123" :TITLE "Test") :contents nil))) (utils-org-set-property ast "id:test123" :STATUS "ACTIVE") (is (string= (getf (getf ast :properties) :STATUS) "ACTIVE")))) #+end_src ** TODO Setter #+begin_src lisp (test todo-setter (let ((ast (list :type :HEADLINE :properties (list :ID "id:todo001" :TITLE "Task") :contents nil))) (utils-org-set-todo ast "id:todo001" "DONE") (is (string= (getf (getf ast :properties) :TODO) "DONE")))) #+end_src