@@ -1965,64 +1965,6 @@ code block content
19651965 (should-not responded)
19661966 (should (equal (map-elt state :last-entry-type) "session/request_permission"))))))
19671967
1968- ; ;; Tests for agent-shell-show-context-usage-indicator
1969-
1970- (ert-deftest agent-shell--context-usage-indicator-bar-test ()
1971- " Test `agent-shell--context-usage-indicator' bar mode."
1972- (let ((agent-shell--state
1973- (list (cons :buffer (current-buffer ))
1974- (cons :usage (list (cons :context-used 50000 )
1975- (cons :context-size 200000 )
1976- (cons :total-tokens 50000 ))))))
1977- (cl-letf (((symbol-function 'agent-shell--state )
1978- (lambda () agent-shell--state)))
1979- (let ((agent-shell-show-context-usage-indicator t ))
1980- (let ((result (agent-shell--context-usage-indicator)))
1981- (should result)
1982- (should (= (length (substring-no-properties result)) 1 ))
1983- (should (eq (get-text-property 0 'face result) 'success )))))))
1984-
1985- (ert-deftest agent-shell--context-usage-indicator-detailed-test ()
1986- " Test `agent-shell--context-usage-indicator' detailed mode."
1987- (let ((agent-shell--state
1988- (list (cons :buffer (current-buffer ))
1989- (cons :usage (list (cons :context-used 30000 )
1990- (cons :context-size 200000 )
1991- (cons :total-tokens 30000 ))))))
1992- (cl-letf (((symbol-function 'agent-shell--state )
1993- (lambda () agent-shell--state)))
1994- (let ((agent-shell-show-context-usage-indicator 'detailed ))
1995- (let ((result (agent-shell--context-usage-indicator)))
1996- (should result)
1997- (should (string-match-p " 30k/200k" (substring-no-properties result)))
1998- (should (string-match-p " 15%%" (substring-no-properties result)))
1999- (should (eq (get-text-property 0 'face result) 'success )))))))
2000-
2001- (ert-deftest agent-shell--context-usage-indicator-detailed-warning-test ()
2002- " Test `agent-shell--context-usage-indicator' detailed mode with warning face."
2003- (let ((agent-shell--state
2004- (list (cons :buffer (current-buffer ))
2005- (cons :usage (list (cons :context-used 140000 )
2006- (cons :context-size 200000 )
2007- (cons :total-tokens 140000 ))))))
2008- (cl-letf (((symbol-function 'agent-shell--state )
2009- (lambda () agent-shell--state)))
2010- (let ((agent-shell-show-context-usage-indicator 'detailed ))
2011- (let ((result (agent-shell--context-usage-indicator)))
2012- (should (eq (get-text-property 0 'face result) 'warning )))))))
2013-
2014- (ert-deftest agent-shell--context-usage-indicator-nil-test ()
2015- " Test `agent-shell--context-usage-indicator' returns nil when disabled."
2016- (let ((agent-shell--state
2017- (list (cons :buffer (current-buffer ))
2018- (cons :usage (list (cons :context-used 50000 )
2019- (cons :context-size 200000 )
2020- (cons :total-tokens 50000 ))))))
2021- (cl-letf (((symbol-function 'agent-shell--state )
2022- (lambda () agent-shell--state)))
2023- (let ((agent-shell-show-context-usage-indicator nil ))
2024- (should-not (agent-shell--context-usage-indicator))))))
2025-
20261968;;; Idle notification tests
20271969
20281970(ert-deftest agent-shell--idle-notification-start-sets-timer-and-hook-test ()
@@ -2119,7 +2061,7 @@ code block content
21192061 (agent-shell--idle-notification-start)
21202062 (should-not (map-elt agent-shell--state :idle-notification-timer))
21212063 (should-not (memq #'agent-shell--idle-notification-cancel
2122- (buffer-local-value 'post-command-hook (current-buffer )))))))
2064+ (buffer-local-value 'post-command-hook (current-buffer))))))))
21232065
21242066(ert-deftest agent-shell-alert--detect-terminal-term-program-test ()
21252067 "Test terminal detection via TERM_PROGRAM."
0 commit comments