branch: externals/ellama
commit 5a6b088dad3585bf54f420f54251dc3bce52ea5f
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Add test for context prompt clearing ephemerals
Introduce a new ERT test
`test-ellama-context-prompt-with-context-clears-ephemeral` that verifies
`ellama-context-prompt-with-context` returns the combined prompt string and
clears the `ellama-context-ephemeral` list. The test also ensures that
`ellama-context-global` remains intact after the prompt is generated,
confirming
that ephemerals are not persisted across prompts.
---
tests/test-ellama.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/test-ellama.el b/tests/test-ellama.el
index a18888228f..e583264f8e 100644
--- a/tests/test-ellama.el
+++ b/tests/test-ellama.el
@@ -773,6 +773,18 @@ detailed comparison to help you decide:
(let ((element (ellama-context-element-buffer-quote :name (buffer-name)
:content "123")))
(should (equal (buffer-name) (ellama-context-element-display
element))))))
+(ert-deftest test-ellama-context-prompt-with-context-clears-ephemeral ()
+ (let ((ellama-context-global
+ (list (ellama-context-element-text :content "global")))
+ (ellama-context-ephemeral
+ (list (ellama-context-element-text :content "ephemeral"))))
+ (should (equal (ellama-context-prompt-with-context "Prompt")
+ "Context:\nglobal\nephemeral\n\nPrompt"))
+ (should (null ellama-context-ephemeral))
+ (should (equal (mapcar #'ellama-context-element-extract
+ ellama-context-global)
+ '("global")))))
+
(ert-deftest test-ellama-md-to-org-code-simple ()
(let ((result (ellama--translate-markdown-to-org-filter "Here is your TikZ
code for a blue rectangle:
```tex