aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-09-13 09:11:19 -0700
committerGlenn Morris2013-09-13 09:11:19 -0700
commit6ad9cb087a85c5bb0d7010db98dab006f23c4f1d (patch)
tree92500bb4397a151b50ce386c321e58b47f9f2af3
parentaad3612f9eb7280bd4db8ee697186e75b1e82765 (diff)
downloademacs-6ad9cb087a85c5bb0d7010db98dab006f23c4f1d.tar.gz
emacs-6ad9cb087a85c5bb0d7010db98dab006f23c4f1d.zip
* test/automated/eshell.el (eshell-test-command-result): New,
again using a temp directory. Replace eshell-command-result with this throughout.
-rw-r--r--test/ChangeLog2
-rw-r--r--test/automated/eshell.el38
2 files changed, 24 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..d5ebc567281 100644
--- a/test/automated/eshell.el
+++ b/test/automated/eshell.el
@@ -56,77 +56,83 @@
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 (eshell-command-result command)))
64
59;;; Tests: 65;;; Tests:
60 66
61(ert-deftest eshell-test/simple-command-result () 67(ert-deftest eshell-test/simple-command-result ()
62 "Test `eshell-command-result' with a simple command." 68 "Test `eshell-command-result' with a simple command."
63 (should (equal (eshell-command-result "+ 1 2") 3))) 69 (should (equal (eshell-test-command-result "+ 1 2") 3)))
64 70
65(ert-deftest eshell-test/lisp-command () 71(ert-deftest eshell-test/lisp-command ()
66 "Test `eshell-command-result' with an elisp command." 72 "Test `eshell-command-result' with an elisp command."
67 (should (equal (eshell-command-result "(+ 1 2)") 3))) 73 (should (equal (eshell-test-command-result "(+ 1 2)") 3)))
68 74
69(ert-deftest eshell-test/for-loop () 75(ert-deftest eshell-test/for-loop ()
70 "Test `eshell-command-result' with an elisp command." 76 "Test `eshell-command-result' with an elisp command."
71 (should (equal (eshell-command-result "for foo in 5 { echo $foo }") 5))) 77 (should (equal (eshell-test-command-result "for foo in 5 { echo $foo }") 5)))
72 78
73(ert-deftest eshell-test/for-name-loop () ;Bug#15231 79(ert-deftest eshell-test/for-name-loop () ;Bug#15231
74 "Test `eshell-command-result' with an elisp command." 80 "Test `eshell-command-result' with an elisp command."
75 (should (equal (eshell-command-result "for name in 3 { echo $name }") 3))) 81 (should (equal (eshell-test-command-result "for name in 3 { echo $name }") 3)))
76 82
77(ert-deftest eshell-test/lisp-command-args () 83(ert-deftest eshell-test/lisp-command-args ()
78 "Test `eshell-command-result' with elisp and trailing args. 84 "Test `eshell-command-result' with elisp and trailing args.
79Test that trailing arguments outside the S-expression are 85Test that trailing arguments outside the S-expression are
80ignored. e.g. \"(+ 1 2) 3\" => 3" 86ignored. e.g. \"(+ 1 2) 3\" => 3"
81 (should (equal (eshell-command-result "(+ 1 2) 3") 3))) 87 (should (equal (eshell-test-command-result "(+ 1 2) 3") 3)))
82 88
83(ert-deftest eshell-test/subcommand () 89(ert-deftest eshell-test/subcommand ()
84 "Test `eshell-command-result' with a simple subcommand." 90 "Test `eshell-command-result' with a simple subcommand."
85 (should (equal (eshell-command-result "{+ 1 2}") 3))) 91 (should (equal (eshell-test-command-result "{+ 1 2}") 3)))
86 92
87(ert-deftest eshell-test/subcommand-args () 93(ert-deftest eshell-test/subcommand-args ()
88 "Test `eshell-command-result' with a subcommand and trailing args. 94 "Test `eshell-command-result' with a subcommand and trailing args.
89Test that trailing arguments outside the subcommand are ignored. 95Test that trailing arguments outside the subcommand are ignored.
90e.g. \"{+ 1 2} 3\" => 3" 96e.g. \"{+ 1 2} 3\" => 3"
91 (should (equal (eshell-command-result "{+ 1 2} 3") 3))) 97 (should (equal (eshell-test-command-result "{+ 1 2} 3") 3)))
92 98
93(ert-deftest eshell-test/subcommand-lisp () 99(ert-deftest eshell-test/subcommand-lisp ()
94 "Test `eshell-command-result' with an elisp subcommand and trailing args. 100 "Test `eshell-command-result' with an elisp subcommand and trailing args.
95Test that trailing arguments outside the subcommand are ignored. 101Test that trailing arguments outside the subcommand are ignored.
96e.g. \"{(+ 1 2)} 3\" => 3" 102e.g. \"{(+ 1 2)} 3\" => 3"
97 (should (equal (eshell-command-result "{(+ 1 2)} 3") 3))) 103 (should (equal (eshell-test-command-result "{(+ 1 2)} 3") 3)))
98 104
99(ert-deftest eshell-test/interp-cmd () 105(ert-deftest eshell-test/interp-cmd ()
100 "Interpolate command result" 106 "Interpolate command result"
101 (should (equal (eshell-command-result "+ ${+ 1 2} 3") 6))) 107 (should (equal (eshell-test-command-result "+ ${+ 1 2} 3") 6)))
102 108
103(ert-deftest eshell-test/interp-lisp () 109(ert-deftest eshell-test/interp-lisp ()
104 "Interpolate Lisp form evaluation" 110 "Interpolate Lisp form evaluation"
105 (should (equal (eshell-command-result "+ $(+ 1 2) 3") 6))) 111 (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6)))
106 112
107(ert-deftest eshell-test/interp-concat () 113(ert-deftest eshell-test/interp-concat ()
108 "Interpolate and concat command" 114 "Interpolate and concat command"
109 (should (equal (eshell-command-result "+ ${+ 1 2}3 3") 36))) 115 (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36)))
110 116
111(ert-deftest eshell-test/interp-concat-lisp () 117(ert-deftest eshell-test/interp-concat-lisp ()
112 "Interpolate and concat Lisp form" 118 "Interpolate and concat Lisp form"
113 (should (equal (eshell-command-result "+ $(+ 1 2)3 3") 36))) 119 (should (equal (eshell-test-command-result "+ $(+ 1 2)3 3") 36)))
114 120
115(ert-deftest eshell-test/interp-concat2 () 121(ert-deftest eshell-test/interp-concat2 ()
116 "Interpolate and concat two commands" 122 "Interpolate and concat two commands"
117 (should (equal (eshell-command-result "+ ${+ 1 2}${+ 1 2} 3") 36))) 123 (should (equal (eshell-test-command-result "+ ${+ 1 2}${+ 1 2} 3") 36)))
118 124
119(ert-deftest eshell-test/interp-concat-lisp2 () 125(ert-deftest eshell-test/interp-concat-lisp2 ()
120 "Interpolate and concat two Lisp forms" 126 "Interpolate and concat two Lisp forms"
121 (should (equal (eshell-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36))) 127 (should (equal (eshell-test-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36)))
122 128
123(ert-deftest eshell-test/window-height () 129(ert-deftest eshell-test/window-height ()
124 "$LINES should equal (window-height)" 130 "$LINES should equal (window-height)"
125 (should (eshell-command-result "= $LINES (window-height)"))) 131 (should (eshell-test-command-result "= $LINES (window-height)")))
126 132
127(ert-deftest eshell-test/window-width () 133(ert-deftest eshell-test/window-width ()
128 "$COLUMNS should equal (window-width)" 134 "$COLUMNS should equal (window-width)"
129 (should (eshell-command-result "= $COLUMNS (window-width)"))) 135 (should (eshell-test-command-result "= $COLUMNS (window-width)")))
130 136
131(ert-deftest eshell-test/last-result-var () 137(ert-deftest eshell-test/last-result-var ()
132 "Test using the \"last result\" ($$) variable" 138 "Test using the \"last result\" ($$) variable"