aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-09-13 18:25:42 +0200
committerJoakim Verona2013-09-13 18:25:42 +0200
commit042cbea14ec32d91ccb99115f81814f508b8603b (patch)
tree0522f2c7cfd7c38e8899d9254be1a7ee8328f747
parentfda7ba7c422a8d5a5827e33bb1c800778790955f (diff)
parentbc2c0769db73f5acd7545b4c3f74cae29e4e4315 (diff)
downloademacs-042cbea14ec32d91ccb99115f81814f508b8603b.tar.gz
emacs-042cbea14ec32d91ccb99115f81814f508b8603b.zip
merge from trunk
-rw-r--r--test/ChangeLog2
-rw-r--r--test/automated/eshell.el40
2 files changed, 26 insertions, 16 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index de1676341e5..4330b77e21e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * automated/eshell.el (with-temp-eshell): 3 * automated/eshell.el (with-temp-eshell):
4 Use a temp directory for eshell-directory-name. 4 Use a temp directory for eshell-directory-name.
5 (eshell-test-command-result): New, again using a temp directory.
6 Replace eshell-command-result with this throughout.
5 7
62013-09-12 Glenn Morris <rgm@gnu.org> 82013-09-12 Glenn Morris <rgm@gnu.org>
7 9
diff --git a/test/automated/eshell.el b/test/automated/eshell.el
index 310e9b6dfde..f9061ceb57c 100644
--- a/test/automated/eshell.el
+++ b/test/automated/eshell.el
@@ -56,77 +56,85 @@
56 (eshell-insert-command text func) 56 (eshell-insert-command text func)
57 (eshell-match-result regexp)) 57 (eshell-match-result regexp))
58 58
59(defun eshell-test-command-result (command)
60 "Like `eshell-command-result', but not using HOME."
61 (let ((eshell-directory-name (make-temp-file "eshell" t))
62 (eshell-history-file-name nil))
63 (unwind-protect
64 (eshell-command-result command)
65 (delete-directory eshell-directory-name t))))
66
59;;; Tests: 67;;; Tests:
60 68
61(ert-deftest eshell-test/simple-command-result () 69(ert-deftest eshell-test/simple-command-result ()
62 "Test `eshell-command-result' with a simple command." 70 "Test `eshell-command-result' with a simple command."
63 (should (equal (eshell-command-result "+ 1 2") 3))) 71 (should (equal (eshell-test-command-result "+ 1 2") 3)))
64 72
65(ert-deftest eshell-test/lisp-command () 73(ert-deftest eshell-test/lisp-command ()
66 "Test `eshell-command-result' with an elisp command." 74 "Test `eshell-command-result' with an elisp command."
67 (should (equal (eshell-command-result "(+ 1 2)") 3))) 75 (should (equal (eshell-test-command-result "(+ 1 2)") 3)))
68 76
69(ert-deftest eshell-test/for-loop () 77(ert-deftest eshell-test/for-loop ()
70 "Test `eshell-command-result' with an elisp command." 78 "Test `eshell-command-result' with an elisp command."
71 (should (equal (eshell-command-result "for foo in 5 { echo $foo }") 5))) 79 (should (equal (eshell-test-command-result "for foo in 5 { echo $foo }") 5)))
72 80
73(ert-deftest eshell-test/for-name-loop () ;Bug#15231 81(ert-deftest eshell-test/for-name-loop () ;Bug#15231
74 "Test `eshell-command-result' with an elisp command." 82 "Test `eshell-command-result' with an elisp command."
75 (should (equal (eshell-command-result "for name in 3 { echo $name }") 3))) 83 (should (equal (eshell-test-command-result "for name in 3 { echo $name }") 3)))
76 84
77(ert-deftest eshell-test/lisp-command-args () 85(ert-deftest eshell-test/lisp-command-args ()
78 "Test `eshell-command-result' with elisp and trailing args. 86 "Test `eshell-command-result' with elisp and trailing args.
79Test that trailing arguments outside the S-expression are 87Test that trailing arguments outside the S-expression are
80ignored. e.g. \"(+ 1 2) 3\" => 3" 88ignored. e.g. \"(+ 1 2) 3\" => 3"
81 (should (equal (eshell-command-result "(+ 1 2) 3") 3))) 89 (should (equal (eshell-test-command-result "(+ 1 2) 3") 3)))
82 90
83(ert-deftest eshell-test/subcommand () 91(ert-deftest eshell-test/subcommand ()
84 "Test `eshell-command-result' with a simple subcommand." 92 "Test `eshell-command-result' with a simple subcommand."
85 (should (equal (eshell-command-result "{+ 1 2}") 3))) 93 (should (equal (eshell-test-command-result "{+ 1 2}") 3)))
86 94
87(ert-deftest eshell-test/subcommand-args () 95(ert-deftest eshell-test/subcommand-args ()
88 "Test `eshell-command-result' with a subcommand and trailing args. 96 "Test `eshell-command-result' with a subcommand and trailing args.
89Test that trailing arguments outside the subcommand are ignored. 97Test that trailing arguments outside the subcommand are ignored.
90e.g. \"{+ 1 2} 3\" => 3" 98e.g. \"{+ 1 2} 3\" => 3"
91 (should (equal (eshell-command-result "{+ 1 2} 3") 3))) 99 (should (equal (eshell-test-command-result "{+ 1 2} 3") 3)))
92 100
93(ert-deftest eshell-test/subcommand-lisp () 101(ert-deftest eshell-test/subcommand-lisp ()
94 "Test `eshell-command-result' with an elisp subcommand and trailing args. 102 "Test `eshell-command-result' with an elisp subcommand and trailing args.
95Test that trailing arguments outside the subcommand are ignored. 103Test that trailing arguments outside the subcommand are ignored.
96e.g. \"{(+ 1 2)} 3\" => 3" 104e.g. \"{(+ 1 2)} 3\" => 3"
97 (should (equal (eshell-command-result "{(+ 1 2)} 3") 3))) 105 (should (equal (eshell-test-command-result "{(+ 1 2)} 3") 3)))
98 106
99(ert-deftest eshell-test/interp-cmd () 107(ert-deftest eshell-test/interp-cmd ()
100 "Interpolate command result" 108 "Interpolate command result"
101 (should (equal (eshell-command-result "+ ${+ 1 2} 3") 6))) 109 (should (equal (eshell-test-command-result "+ ${+ 1 2} 3") 6)))
102 110
103(ert-deftest eshell-test/interp-lisp () 111(ert-deftest eshell-test/interp-lisp ()
104 "Interpolate Lisp form evaluation" 112 "Interpolate Lisp form evaluation"
105 (should (equal (eshell-command-result "+ $(+ 1 2) 3") 6))) 113 (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6)))
106 114
107(ert-deftest eshell-test/interp-concat () 115(ert-deftest eshell-test/interp-concat ()
108 "Interpolate and concat command" 116 "Interpolate and concat command"
109 (should (equal (eshell-command-result "+ ${+ 1 2}3 3") 36))) 117 (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36)))
110 118
111(ert-deftest eshell-test/interp-concat-lisp () 119(ert-deftest eshell-test/interp-concat-lisp ()
112 "Interpolate and concat Lisp form" 120 "Interpolate and concat Lisp form"
113 (should (equal (eshell-command-result "+ $(+ 1 2)3 3") 36))) 121 (should (equal (eshell-test-command-result "+ $(+ 1 2)3 3") 36)))
114 122
115(ert-deftest eshell-test/interp-concat2 () 123(ert-deftest eshell-test/interp-concat2 ()
116 "Interpolate and concat two commands" 124 "Interpolate and concat two commands"
117 (should (equal (eshell-command-result "+ ${+ 1 2}${+ 1 2} 3") 36))) 125 (should (equal (eshell-test-command-result "+ ${+ 1 2}${+ 1 2} 3") 36)))
118 126
119(ert-deftest eshell-test/interp-concat-lisp2 () 127(ert-deftest eshell-test/interp-concat-lisp2 ()
120 "Interpolate and concat two Lisp forms" 128 "Interpolate and concat two Lisp forms"
121 (should (equal (eshell-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36))) 129 (should (equal (eshell-test-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36)))
122 130
123(ert-deftest eshell-test/window-height () 131(ert-deftest eshell-test/window-height ()
124 "$LINES should equal (window-height)" 132 "$LINES should equal (window-height)"
125 (should (eshell-command-result "= $LINES (window-height)"))) 133 (should (eshell-test-command-result "= $LINES (window-height)")))
126 134
127(ert-deftest eshell-test/window-width () 135(ert-deftest eshell-test/window-width ()
128 "$COLUMNS should equal (window-width)" 136 "$COLUMNS should equal (window-width)"
129 (should (eshell-command-result "= $COLUMNS (window-width)"))) 137 (should (eshell-test-command-result "= $COLUMNS (window-width)")))
130 138
131(ert-deftest eshell-test/last-result-var () 139(ert-deftest eshell-test/last-result-var ()
132 "Test using the \"last result\" ($$) variable" 140 "Test using the \"last result\" ($$) variable"