; * test/lisp/shell-tests.el: Add tests for shell-dirtrack-mode (bug#64311)

This commit is contained in:
Vladimir Sedach 2023-06-26 22:30:25 -06:00 committed by Eli Zaretskii
parent 8ffe8422c5
commit 44c9293ddd

View file

@ -64,4 +64,35 @@
(should (equal (split-string-shell-command "ls /tmp/foo\\ bar")
'("ls" "/tmp/foo bar")))))
(ert-deftest shell-dirtrack-on-by-default ()
(with-temp-buffer
(shell-mode)
(should shell-dirtrack-mode)))
(ert-deftest shell-dirtrack-should-not-be-on-in-unrelated-modes ()
(with-temp-buffer
(should (not shell-dirtrack-mode))))
(ert-deftest shell-dirtrack-sets-list-buffers-directory ()
(let ((start-dir default-directory))
(with-temp-buffer
(should-not list-buffers-directory)
(shell-mode)
(shell-cd "..")
(should list-buffers-directory)
(should (not (equal start-dir list-buffers-directory)))
(should (string-prefix-p list-buffers-directory start-dir)))))
(ert-deftest shell-directory-tracker-cd ()
(let ((start-dir default-directory))
(with-temp-buffer
(should-not list-buffers-directory)
(shell-mode)
(cl-letf (((symbol-function 'shell-unquote-argument)
(lambda (x) x)))
(shell-directory-tracker "cd .."))
(should list-buffers-directory)
(should (not (equal start-dir list-buffers-directory)))
(should (string-prefix-p list-buffers-directory start-dir)))))
;;; shell-tests.el ends here