commit b4464b16c87f3b4a39584aa5faf66f2f9fee8be2
parent c7b4b40b9793a7cd6ea51a7e10cb28c7c9e7fa93
Author: Vineet Kumar <git@vineetk.net>
Date: Mon, 25 May 2026 23:34:52 -0400
very important update to tests
get that typescript out of my sight. was used temporarily because it
was present in oh-my-pi's hashline.md file
Diffstat:
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/llm-tools-hl-test.el b/llm-tools-hl-test.el
@@ -4,20 +4,20 @@
(ert-deftest llm-tools--hl-file-read-test ()
"Test that 'llm-tools--hl-file-read' produces correct hashline format."
(let* ((content "\
-const TITLE = \"Mr\";
-export function greet(name) {
-\treturn [
- \t TITLE,
-\t name?.trim() || \"guest\",
-\t].join(\" \");
-}")
+;; greeting.el
+(defconst greeting-title \"Mr\")
+(defun greet (name)
+ (concat
+ greeting-title
+ (or (string-trim name) \"guest\"))
+)")
(file (make-temp-file nil nil nil content))
(actual (llm-tools--hl-file-read file)))
(unwind-protect
(progn
(should (= (length (string-lines actual)) 7))
- (should (string-match-p "\\`1vx|const TITLE" actual))
- (should (string-match-p "7gv|}\\'" actual)))
+ (should (string-match-p "\\`1gi|;; greeting" actual))
+ (should (string-match-p "7ce|)\\'" actual)))
(delete-file file))))
(ert-deftest llm-tools--hl-anchor-to-line-num-test ()
@@ -26,15 +26,15 @@ export function greet(name) {
(should (= (llm-tools--hl-anchor-to-line-num "1vx") 1)))
(ert-deftest llm-tools--hl-parse-section-single-replace ()
- (let ((section "= 1vx..1vx\n~const TITLE = \"Mrs\";"))
+ (let ((section "= 1vx..1vx\n~(defconst greeting-title \"Mrs\")"))
(should (= (length (llm-tools--hl-parse-section section)) 1))
(let ((op (car (llm-tools--hl-parse-section section))))
(should (eq (hl-op-type op) 'replace))
(should (equal (hl-op-range op) '("1vx" "1vx")))
- (should (equal (hl-op-payload op) '("const TITLE = \"Mrs\";"))))))
+ (should (equal (hl-op-payload op) '("(defconst greeting-title \"Mrs\")"))))))
(ert-deftest llm-tools--hl-parse-section-multi-line-payload ()
- (let ((section "= 3gv..6be\n~\treturn [\n~\t\t\"Mrs\",\n~\t\tname?.trim() || \"guest\",\n~\t].join(\" \");"))
+ (let ((section "= 3gv..6be\n~ (concat\n~ greeting-title\n~ (or (string-trim name) \"guest\"))\n~ )"))
(let ((op (car (llm-tools--hl-parse-section section))))
(should (= (length (hl-op-payload op)) 4)))))
@@ -46,14 +46,14 @@ export function greet(name) {
(should (null (hl-op-payload op))))))
(ert-deftest llm-tools--hl-parse-section-insert-after ()
- (let ((section "+ 4ei\n~\t\t\"Dr\","))
+ (let ((section "+ 4ei\n~ greeting-title"))
(let ((op (car (llm-tools--hl-parse-section section))))
(should (eq (hl-op-type op) 'insert-after))
(should (string= (hl-op-anchor op) "4ei"))
- (should (equal (hl-op-payload op) '("\t\t\"Dr\","))))))
+ (should (equal (hl-op-payload op) '(" greeting-title"))))))
(ert-deftest llm-tools--hl-parse-section-insert-before ()
- (let ((section "< 5ff\n~\t\t\"Dr\","))
+ (let ((section "< 5ff\n~ greeting-title"))
(let ((op (car (llm-tools--hl-parse-section section))))
(should (eq (hl-op-type op) 'insert-before))
(should (string= (hl-op-anchor op) "5ff")))))