diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-23 20:12:58 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-23 20:12:58 -0400 |
| commit | 10fa6f4e2e7150ad99827721ada1ae4badcc5e90 (patch) | |
| tree | 960065c8e69f1e7a4150ecf522e2f813c239b5ee /archive/gptel/tests/test-gptel-tools-read-buffer.el | |
| parent | f4cc70c69e7707dd4a686637e14885f5443fcca6 (diff) | |
| download | dotemacs-10fa6f4e2e7150ad99827721ada1ae4badcc5e90.tar.gz dotemacs-10fa6f4e2e7150ad99827721ada1ae4badcc5e90.zip | |
chore(ai): archive gptel and remove it from the live config
I archived gptel to archive/gptel/ since I rarely use it. Moved there: the six gptel modules (ai-config, ai-conversations, ai-conversations-browser, ai-mcp, ai-quick-ask, ai-rewrite), the gptel-tools/ directory, custom/gptel-prompts.el, their test files and utilities, and the four gptel-only specs.
Scrubbed from the live config: the ai-config require in init.el, which also drops the whole C-; a keymap; the gptel-mode emojify hook in font-config.el; the gptel-tools entries in the Makefile clean target and the coverage runner; and the gptel feature notes in README. Cancelled the open gptel tasks in todo.org (the AI Open Work issues, the feature-extension brainstorm, the velox gptel-magit bug).
ai-term stays. It is the ghostel Claude launcher, independent of gptel.
Verified: every module loads, a batch init launch reaches completion clean, and the full test suite shows only pre-existing coverage failures unrelated to this change.
Diffstat (limited to 'archive/gptel/tests/test-gptel-tools-read-buffer.el')
| -rw-r--r-- | archive/gptel/tests/test-gptel-tools-read-buffer.el | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/archive/gptel/tests/test-gptel-tools-read-buffer.el b/archive/gptel/tests/test-gptel-tools-read-buffer.el new file mode 100644 index 00000000..0a854835 --- /dev/null +++ b/archive/gptel/tests/test-gptel-tools-read-buffer.el @@ -0,0 +1,74 @@ +;;; test-gptel-tools-read-buffer.el --- Tests for read_buffer gptel tool -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for `cj/read-buffer--get-content', the testable helper that +;; backs the read_buffer gptel tool. + +;;; Code: + +(require 'ert) + +(eval-and-compile + (add-to-list 'load-path (expand-file-name "tests" user-emacs-directory)) + (add-to-list 'load-path (expand-file-name "gptel-tools" user-emacs-directory)) + (setq load-prefer-newer t) + (unless (featurep 'gptel) + (defvar gptel-tools nil) + (defun gptel-make-tool (&rest _args) nil) + (defun gptel-get-tool (&rest _args) nil) + (provide 'gptel))) + +(require 'read_buffer) + +(ert-deftest test-gptel-tools-read-buffer-normal () + "Normal: returns the contents of an existing buffer." + (with-temp-buffer + (rename-buffer "test-gptel-tools-read-buffer-normal" t) + (insert "hello world") + (should (equal (cj/read-buffer--get-content (buffer-name)) "hello world")))) + +(ert-deftest test-gptel-tools-read-buffer-boundary-empty-buffer () + "Boundary: empty buffer returns the empty string." + (with-temp-buffer + (rename-buffer "test-gptel-tools-read-buffer-empty" t) + (should (equal (cj/read-buffer--get-content (buffer-name)) "")))) + +(ert-deftest test-gptel-tools-read-buffer-boundary-buffer-object () + "Boundary: accepts a buffer object as well as a name string." + (with-temp-buffer + (insert "from buffer object") + (should (equal (cj/read-buffer--get-content (current-buffer)) + "from buffer object")))) + +(ert-deftest test-gptel-tools-read-buffer-boundary-widened-content () + "Boundary: returns the whole buffer even when the buffer is narrowed." + (with-temp-buffer + (insert "visible\nhidden\n") + (narrow-to-region (point-min) (line-end-position)) + (should (equal (cj/read-buffer--get-content (current-buffer)) + "visible\nhidden\n")))) + +(ert-deftest test-gptel-tools-read-buffer-boundary-strips-text-properties () + "Boundary: the returned string has no text properties." + (with-temp-buffer + (rename-buffer "test-gptel-tools-read-buffer-props" t) + (insert (propertize "fontified" 'face 'bold)) + (let ((content (cj/read-buffer--get-content (buffer-name)))) + (should (equal content "fontified")) + (should-not (text-properties-at 0 content))))) + +(ert-deftest test-gptel-tools-read-buffer-error-missing-buffer () + "Error: nonexistent buffer name signals." + (when (get-buffer "test-gptel-tools-read-buffer-absent") + (kill-buffer "test-gptel-tools-read-buffer-absent")) + (should-error (cj/read-buffer--get-content + "test-gptel-tools-read-buffer-absent"))) + +(ert-deftest test-gptel-tools-read-buffer-error-killed-buffer-object () + "Error: a killed buffer object signals clearly." + (let ((buffer (generate-new-buffer "test-gptel-tools-read-buffer-killed"))) + (kill-buffer buffer) + (should-error (cj/read-buffer--get-content buffer)))) + +(provide 'test-gptel-tools-read-buffer) +;;; test-gptel-tools-read-buffer.el ends here |
