forked from ahyatt/ekg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathekg-llm-test.el
49 lines (39 loc) · 1.72 KB
/
ekg-llm-test.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;;; ekg-llm-test.el --- Tests for ekg-llm -*- lexical-binding: t; -*-
;; Copyright (c) 2023 Andrew Hyatt <[email protected]>
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; These tests should be run and pass before every commit to ekg-llm.
;;; Code:
(require 'ekg)
(require 'ekg-llm)
(defun ekg-llm-test-replace-text (markers text)
"Replace text between MARKERS."
(let ((beg (car markers))
(end (cdr markers)))
(goto-char beg)
(delete-region beg end)
(insert text)))
(ert-deftest ekg-llm-test-create-output-holder ()
(with-temp-buffer
(let ((markers (ekg-llm-create-output-holder "BEGIN" "END")))
(should (equal "BEGIN\n\nEND\n"
(substring-no-properties (buffer-string))))
(ekg-llm-test-replace-text markers "text 1")
(should (equal "BEGIN\ntext 1\nEND\n"
(substring-no-properties (buffer-string))))
(ekg-llm-test-replace-text markers "very different text")
(should (equal "BEGIN\nvery different text\nEND\n"
(substring-no-properties (buffer-string)))))))
(provide 'ekg-llm-test)
;;; ekg-llm-test.el ends here