diff options
| author | Vineet Kumar <git@vineetk.net> | 2026-05-24 19:10:13 -0400 |
|---|---|---|
| committer | Vineet Kumar <git@vineetk.net> | 2026-05-24 19:10:13 -0400 |
| commit | 45b881a7f0b02a00e3f54beb329c8f938830f6ba (patch) | |
| tree | f06618a1505c556eeef93941a2ad684845e3ffbb | |
| parent | 204136e66ccc5a9675178987a5d34e9fd95ba174 (diff) | |
add unit test for hl-file-read
| -rw-r--r-- | llm-tools-hl-test.el | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llm-tools-hl-test.el b/llm-tools-hl-test.el new file mode 100644 index 0000000..4bc0fa0 --- /dev/null +++ b/llm-tools-hl-test.el | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | (require 'ert) | ||
| 2 | (require 'llm-tools-hl) | ||
| 3 | |||
| 4 | (ert-deftest llm-tools--hl-file-read-test () | ||
| 5 | "Test that 'llm-tools--hl-file-read' produces correct hashline format." | ||
| 6 | (let* ((content "\ | ||
| 7 | const TITLE = \"Mr\"; | ||
| 8 | export function greet(name) { | ||
| 9 | return [ | ||
| 10 | TITLE, | ||
| 11 | name?.trim() || \"guest\", | ||
| 12 | ].join(\" \"); | ||
| 13 | }") | ||
| 14 | (file (make-temp-file nil nil nil content)) | ||
| 15 | (actual (llm-tools--hl-file-read file)) | ||
| 16 | (expected "1vx|const TITLE = \"Mr\"; | ||
| 17 | 2in|export function greet(name) { | ||
| 18 | 3gv| return [ | ||
| 19 | 4ei| TITLE, | ||
| 20 | 5ff| name?.trim() || \"guest\", | ||
| 21 | 6cc| ].join(" "); | ||
| 22 | 7gv|}")) | ||
| 23 | (unwind-protect | ||
| 24 | (should (equal actual expected)) | ||
| 25 | (delete-file file)))) | ||
