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-ai-config-current-model-selection.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-ai-config-current-model-selection.el')
| -rw-r--r-- | archive/gptel/tests/test-ai-config-current-model-selection.el | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/archive/gptel/tests/test-ai-config-current-model-selection.el b/archive/gptel/tests/test-ai-config-current-model-selection.el new file mode 100644 index 00000000..14f9391c --- /dev/null +++ b/archive/gptel/tests/test-ai-config-current-model-selection.el @@ -0,0 +1,74 @@ +;;; test-ai-config-current-model-selection.el --- Tests for cj/gptel--current-model-selection -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for cj/gptel--current-model-selection from ai-config.el. +;; +;; Pure function that formats the active backend and model into a display +;; string like "Anthropic - Claude: claude-opus-4-6". Used as the default +;; selection in the model-switching completing-read prompt. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "tests" user-emacs-directory)) +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'testutil-ai-config) +(require 'ai-config) + +;;; Normal Cases + +(ert-deftest test-ai-config-current-model-selection-normal-matching-backend () + "When current backend is in the backends alist, use its display name." + (let* ((backend-obj 'my-backend) + (backends `(("Anthropic - Claude" . ,backend-obj)))) + (should (equal (cj/gptel--current-model-selection backends backend-obj "opus") + "Anthropic - Claude: opus")))) + +(ert-deftest test-ai-config-current-model-selection-normal-symbol-model () + "Symbol model should be converted to string in the output." + (let* ((backend-obj 'my-backend) + (backends `(("Claude" . ,backend-obj)))) + (should (equal (cj/gptel--current-model-selection backends backend-obj 'opus) + "Claude: opus")))) + +(ert-deftest test-ai-config-current-model-selection-normal-multiple-backends () + "Should find the correct backend name among multiple backends." + (let* ((backend-a 'backend-a) + (backend-b 'backend-b) + (backends `(("Claude" . ,backend-a) ("OpenAI" . ,backend-b)))) + (should (equal (cj/gptel--current-model-selection backends backend-b "gpt-4o") + "OpenAI: gpt-4o")))) + +;;; Boundary Cases + +(ert-deftest test-ai-config-current-model-selection-boundary-nil-backend-shows-ai () + "Nil backend (not in alist) should fall back to \"AI\"." + (should (equal (cj/gptel--current-model-selection '(("Claude" . x)) nil "opus") + "AI: opus"))) + +(ert-deftest test-ai-config-current-model-selection-boundary-unknown-backend-shows-ai () + "Backend not found in alist should fall back to \"AI\"." + (should (equal (cj/gptel--current-model-selection + '(("Claude" . backend-a)) 'unknown-backend "opus") + "AI: opus"))) + +(ert-deftest test-ai-config-current-model-selection-boundary-nil-model () + "Nil model should produce \"nil\" in the model position (symbolp nil)." + (let* ((backend 'my-backend) + (backends `(("Claude" . ,backend)))) + (should (equal (cj/gptel--current-model-selection backends backend nil) + "Claude: nil")))) + +(ert-deftest test-ai-config-current-model-selection-boundary-empty-backends () + "Empty backends alist should fall back to \"AI\" for backend name." + (should (equal (cj/gptel--current-model-selection nil 'anything "model") + "AI: model"))) + +(ert-deftest test-ai-config-current-model-selection-boundary-both-nil () + "Nil backend and nil model should produce \"AI: nil\"." + (should (equal (cj/gptel--current-model-selection nil nil nil) + "AI: nil"))) + +(provide 'test-ai-config-current-model-selection) +;;; test-ai-config-current-model-selection.el ends here |
