From: Glenn Morris Date: Fri, 13 Sep 2013 16:11:19 +0000 (-0700) Subject: * test/automated/eshell.el (eshell-test-command-result): New, X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1637 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6ad9cb087a85c5bb0d7010db98dab006f23c4f1d;p=emacs.git * test/automated/eshell.el (eshell-test-command-result): New, again using a temp directory. Replace eshell-command-result with this throughout. --- diff --git a/test/ChangeLog b/test/ChangeLog index de1676341e5..4330b77e21e 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -2,6 +2,8 @@ * automated/eshell.el (with-temp-eshell): Use a temp directory for eshell-directory-name. + (eshell-test-command-result): New, again using a temp directory. + Replace eshell-command-result with this throughout. 2013-09-12 Glenn Morris diff --git a/test/automated/eshell.el b/test/automated/eshell.el index 310e9b6dfde..d5ebc567281 100644 --- a/test/automated/eshell.el +++ b/test/automated/eshell.el @@ -56,77 +56,83 @@ (eshell-insert-command text func) (eshell-match-result regexp)) +(defun eshell-test-command-result (command) + "Like `eshell-command-result', but not using HOME." + (let ((eshell-directory-name (make-temp-file "eshell" t)) + (eshell-history-file-name nil)) + (eshell-command-result command))) + ;;; Tests: (ert-deftest eshell-test/simple-command-result () "Test `eshell-command-result' with a simple command." - (should (equal (eshell-command-result "+ 1 2") 3))) + (should (equal (eshell-test-command-result "+ 1 2") 3))) (ert-deftest eshell-test/lisp-command () "Test `eshell-command-result' with an elisp command." - (should (equal (eshell-command-result "(+ 1 2)") 3))) + (should (equal (eshell-test-command-result "(+ 1 2)") 3))) (ert-deftest eshell-test/for-loop () "Test `eshell-command-result' with an elisp command." - (should (equal (eshell-command-result "for foo in 5 { echo $foo }") 5))) + (should (equal (eshell-test-command-result "for foo in 5 { echo $foo }") 5))) (ert-deftest eshell-test/for-name-loop () ;Bug#15231 "Test `eshell-command-result' with an elisp command." - (should (equal (eshell-command-result "for name in 3 { echo $name }") 3))) + (should (equal (eshell-test-command-result "for name in 3 { echo $name }") 3))) (ert-deftest eshell-test/lisp-command-args () "Test `eshell-command-result' with elisp and trailing args. Test that trailing arguments outside the S-expression are ignored. e.g. \"(+ 1 2) 3\" => 3" - (should (equal (eshell-command-result "(+ 1 2) 3") 3))) + (should (equal (eshell-test-command-result "(+ 1 2) 3") 3))) (ert-deftest eshell-test/subcommand () "Test `eshell-command-result' with a simple subcommand." - (should (equal (eshell-command-result "{+ 1 2}") 3))) + (should (equal (eshell-test-command-result "{+ 1 2}") 3))) (ert-deftest eshell-test/subcommand-args () "Test `eshell-command-result' with a subcommand and trailing args. Test that trailing arguments outside the subcommand are ignored. e.g. \"{+ 1 2} 3\" => 3" - (should (equal (eshell-command-result "{+ 1 2} 3") 3))) + (should (equal (eshell-test-command-result "{+ 1 2} 3") 3))) (ert-deftest eshell-test/subcommand-lisp () "Test `eshell-command-result' with an elisp subcommand and trailing args. Test that trailing arguments outside the subcommand are ignored. e.g. \"{(+ 1 2)} 3\" => 3" - (should (equal (eshell-command-result "{(+ 1 2)} 3") 3))) + (should (equal (eshell-test-command-result "{(+ 1 2)} 3") 3))) (ert-deftest eshell-test/interp-cmd () "Interpolate command result" - (should (equal (eshell-command-result "+ ${+ 1 2} 3") 6))) + (should (equal (eshell-test-command-result "+ ${+ 1 2} 3") 6))) (ert-deftest eshell-test/interp-lisp () "Interpolate Lisp form evaluation" - (should (equal (eshell-command-result "+ $(+ 1 2) 3") 6))) + (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6))) (ert-deftest eshell-test/interp-concat () "Interpolate and concat command" - (should (equal (eshell-command-result "+ ${+ 1 2}3 3") 36))) + (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36))) (ert-deftest eshell-test/interp-concat-lisp () "Interpolate and concat Lisp form" - (should (equal (eshell-command-result "+ $(+ 1 2)3 3") 36))) + (should (equal (eshell-test-command-result "+ $(+ 1 2)3 3") 36))) (ert-deftest eshell-test/interp-concat2 () "Interpolate and concat two commands" - (should (equal (eshell-command-result "+ ${+ 1 2}${+ 1 2} 3") 36))) + (should (equal (eshell-test-command-result "+ ${+ 1 2}${+ 1 2} 3") 36))) (ert-deftest eshell-test/interp-concat-lisp2 () "Interpolate and concat two Lisp forms" - (should (equal (eshell-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36))) + (should (equal (eshell-test-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36))) (ert-deftest eshell-test/window-height () "$LINES should equal (window-height)" - (should (eshell-command-result "= $LINES (window-height)"))) + (should (eshell-test-command-result "= $LINES (window-height)"))) (ert-deftest eshell-test/window-width () "$COLUMNS should equal (window-width)" - (should (eshell-command-result "= $COLUMNS (window-width)"))) + (should (eshell-test-command-result "= $COLUMNS (window-width)"))) (ert-deftest eshell-test/last-result-var () "Test using the \"last result\" ($$) variable"