@@ -1155,6 +1155,30 @@ cell, so the visual line width must equal the terminal column count."
11551155 (kill-local-variable 'global-hl-line-mode ))
11561156 (kill-buffer buf)))))
11571157
1158+ ; ; -----------------------------------------------------------------------
1159+ ; ; Test: ghostel-project buffer naming
1160+ ; ; -----------------------------------------------------------------------
1161+
1162+ (ert-deftest ghostel-test-project-buffer-name ()
1163+ " Test that `ghostel-project' derives the buffer name correctly."
1164+ (require 'project )
1165+ (let ((ghostel-buffer-name " *ghostel*" )
1166+ result)
1167+ ; ; Stub project-current, project-root, and ghostel to capture args
1168+ (cl-letf (((symbol-function 'project-current )
1169+ (lambda (_maybe-prompt ) '(transient . " /tmp/myproj/" )))
1170+ ((symbol-function 'project-root )
1171+ (lambda (proj ) (cdr proj)))
1172+ ((symbol-function 'ghostel )
1173+ (lambda ()
1174+ (setq result (cons default-directory ghostel-buffer-name)))))
1175+ (ghostel-project)
1176+ ; ; default-directory should be the project root
1177+ (should (equal " /tmp/myproj/" (car result)))
1178+ ; ; Buffer name should be project-prefixed (no raw asterisks passed)
1179+ (should (string-match-p " ghostel" (cdr result)))
1180+ (should-not (string-match-p " \\ *\\ *" (cdr result))))))
1181+
11581182; ; -----------------------------------------------------------------------
11591183; ; Runner
11601184; ; -----------------------------------------------------------------------
@@ -1420,6 +1444,7 @@ cell, so the visual line width must equal the terminal column count."
14201444 ghostel-test-osc51-eval-unknown
14211445 ghostel-test-copy-mode-cursor
14221446 ghostel-test-copy-mode-hl-line
1447+ ghostel-test-project-buffer-name
14231448 ghostel-test-package-version
14241449 ghostel-test-module-version-match
14251450 ghostel-test-module-version-mismatch
0 commit comments