summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/em-dirs-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/eshell/em-dirs-tests.el')
-rw-r--r--test/lisp/eshell/em-dirs-tests.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el
index d30b3d7d73f..9864b72ba78 100644
--- a/test/lisp/eshell/em-dirs-tests.el
+++ b/test/lisp/eshell/em-dirs-tests.el
@@ -99,4 +99,27 @@
(eshell-match-command-output "echo $-[1][/ 1 3]"
"(\"some\" \"here\")\n"))))
+(ert-deftest em-dirs-test/cd ()
+ "Test that changing directories with `cd' works."
+ (ert-with-temp-directory tmpdir
+ (write-region "text" nil (expand-file-name "file.txt" tmpdir))
+ (with-temp-eshell
+ (eshell-match-command-output (format "cd '%s'" tmpdir)
+ "\\`\\'")
+ (should (equal default-directory tmpdir)))))
+
+(ert-deftest em-dirs-test/cd/list-files-after-cd ()
+ "Test that listing files after `cd' works."
+ (let ((eshell-list-files-after-cd t))
+ (ert-with-temp-directory tmpdir
+ (write-region "text" nil (expand-file-name "file.txt" tmpdir))
+ (with-temp-eshell
+ (eshell-match-command-output (format "cd '%s'" tmpdir)
+ "file.txt\n")
+ (should (equal default-directory tmpdir))
+ ;; Make sure we didn't update the last-command information when
+ ;; running "ls".
+ (should (equal eshell-last-command-name "#<function eshell/cd>"))
+ (should (equal eshell-last-arguments (list tmpdir)))))))
+
;; em-dirs-tests.el ends here