aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-03-05 12:07:27 -0800
committerGlenn Morris2011-03-05 12:07:27 -0800
commit81fb60b2aa8bbd8699660588f56e15142aa91227 (patch)
treead11239e7633c540541f94f145478f83c89b64ad
parentc5f09daf79627a37d3eba0ec8c4cc0841007624d (diff)
downloademacs-81fb60b2aa8bbd8699660588f56e15142aa91227.tar.gz
emacs-81fb60b2aa8bbd8699660588f56e15142aa91227.zip
Move eshell's self-tests to the test/ directory.
* lisp/eshell/esh-var.el: Don't require esh-test when compiling. * lisp/eshell/em-banner.el, lisp/eshell/esh-cmd.el, lisp/eshell/esh-mode.el: * lisp/eshell/esh-var.el, lisp/eshell/eshell.el: Move tests to esh-test. * lisp/eshell/esh-test.el: Move to ../../test/eshell.el * test/eshell.el: Move here from lisp/eshell/esh-test.el.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/eshell/em-banner.el8
-rw-r--r--lisp/eshell/esh-cmd.el36
-rw-r--r--lisp/eshell/esh-mode.el73
-rw-r--r--lisp/eshell/esh-util.el12
-rw-r--r--lisp/eshell/esh-var.el25
-rw-r--r--lisp/eshell/eshell.el18
-rw-r--r--test/ChangeLog4
-rw-r--r--test/eshell.el (renamed from lisp/eshell/esh-test.el)188
9 files changed, 199 insertions, 172 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0cdeae84af..33aa29ea41b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12011-03-05 Glenn Morris <rgm@gnu.org>
2
3 * eshell/esh-var.el: Don't require esh-test when compiling.
4 * eshell/em-banner.el, eshell/esh-cmd.el, eshell/esh-mode.el:
5 * eshell/esh-var.el, eshell/eshell.el: Move tests to esh-test.
6 * eshell/esh-test.el: Move to ../../test/eshell.el
7
12011-03-05 David Engster <deng@randomsample.de> 82011-03-05 David Engster <deng@randomsample.de>
2 9
3 * files.el (save-some-buffers): Report the names of buffers saved 10 * files.el (save-some-buffers): Report the names of buffers saved
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el
index c3e5a8b3d55..ce987f132e3 100644
--- a/lisp/eshell/em-banner.el
+++ b/lisp/eshell/em-banner.el
@@ -82,14 +82,6 @@ This can be any sexp, and should end with at least two newlines."
82 (assert msg) 82 (assert msg)
83 (eshell-interactive-print msg)))) 83 (eshell-interactive-print msg))))
84 84
85(eshell-deftest banner banner-displayed
86 "Startup banner is displayed at point-min"
87 (assert eshell-banner-message)
88 (let ((msg (eval eshell-banner-message)))
89 (assert msg)
90 (goto-char (point-min))
91 (looking-at msg)))
92
93(provide 'em-banner) 85(provide 'em-banner)
94 86
95;; Local Variables: 87;; Local Variables:
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 62c14f38025..bdcdc453272 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -320,18 +320,6 @@ otherwise t.")
320 (add-hook 'pcomplete-try-first-hook 320 (add-hook 'pcomplete-try-first-hook
321 'eshell-complete-lisp-symbols nil t))) 321 'eshell-complete-lisp-symbols nil t)))
322 322
323(eshell-deftest var last-result-var
324 "\"last result\" variable"
325 (eshell-command-result-p "+ 1 2; + $$ 2" "3\n5\n"))
326
327(eshell-deftest var last-result-var2
328 "\"last result\" variable"
329 (eshell-command-result-p "+ 1 2; + $$ $$" "3\n6\n"))
330
331(eshell-deftest var last-arg-var
332 "\"last arg\" variable"
333 (eshell-command-result-p "+ 1 2; + $_ 4" "3\n6\n"))
334
335(defun eshell-complete-lisp-symbols () 323(defun eshell-complete-lisp-symbols ()
336 "If there is a user reference, complete it." 324 "If there is a user reference, complete it."
337 (let ((arg (pcomplete-actual-arg))) 325 (let ((arg (pcomplete-actual-arg)))
@@ -441,32 +429,12 @@ hooks should be run before and after the command."
441 (eq (caar terms) 'eshell-command-to-value)) 429 (eq (caar terms) 'eshell-command-to-value))
442 (car (cdar terms)))) 430 (car (cdar terms))))
443 431
444(eshell-deftest cmd lisp-command
445 "Evaluate Lisp command"
446 (eshell-command-result-p "(+ 1 2)" "3"))
447
448(eshell-deftest cmd lisp-command-args
449 "Evaluate Lisp command (ignore args)"
450 (eshell-command-result-p "(+ 1 2) 3" "3"))
451
452(defun eshell-rewrite-initial-subcommand (terms) 432(defun eshell-rewrite-initial-subcommand (terms)
453 "Rewrite a subcommand in initial position, such as '{+ 1 2}'." 433 "Rewrite a subcommand in initial position, such as '{+ 1 2}'."
454 (if (and (listp (car terms)) 434 (if (and (listp (car terms))
455 (eq (caar terms) 'eshell-as-subcommand)) 435 (eq (caar terms) 'eshell-as-subcommand))
456 (car terms))) 436 (car terms)))
457 437
458(eshell-deftest cmd subcommand
459 "Run subcommand"
460 (eshell-command-result-p "{+ 1 2}" "3\n"))
461
462(eshell-deftest cmd subcommand-args
463 "Run subcommand (ignore args)"
464 (eshell-command-result-p "{+ 1 2} 3" "3\n"))
465
466(eshell-deftest cmd subcommand-lisp
467 "Run subcommand + Lisp form"
468 (eshell-command-result-p "{(+ 1 2)}" "3\n"))
469
470(defun eshell-rewrite-named-command (terms) 438(defun eshell-rewrite-named-command (terms)
471 "If no other rewriting rule transforms TERMS, assume a named command." 439 "If no other rewriting rule transforms TERMS, assume a named command."
472 (let ((sym (if eshell-in-pipeline-p 440 (let ((sym (if eshell-in-pipeline-p
@@ -478,10 +446,6 @@ hooks should be run before and after the command."
478 (list sym cmd (append (list 'list) (cdr terms))) 446 (list sym cmd (append (list 'list) (cdr terms)))
479 (list sym cmd)))) 447 (list sym cmd))))
480 448
481(eshell-deftest cmd named-command
482 "Execute named command"
483 (eshell-command-result-p "+ 1 2" "3\n"))
484
485(defvar eshell-command-body) 449(defvar eshell-command-body)
486(defvar eshell-test-body) 450(defvar eshell-test-body)
487 451
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index f7c727aa36f..10623dba8e3 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -447,19 +447,6 @@ and the hook `eshell-exit-hook'."
447 447
448(put 'eshell-mode 'mode-class 'special) 448(put 'eshell-mode 'mode-class 'special)
449 449
450(eshell-deftest mode major-mode
451 "Major mode is correct"
452 (eq major-mode 'eshell-mode))
453
454(eshell-deftest mode eshell-mode-variable
455 "`eshell-mode' is true"
456 (eq eshell-mode t))
457
458(eshell-deftest var window-height
459 "LINES equals window height"
460 (let ((eshell-stringify-t t))
461 (eshell-command-result-p "= $LINES (window-height)" "t\n")))
462
463(defun eshell-command-started () 450(defun eshell-command-started ()
464 "Indicate in the modeline that a command has started." 451 "Indicate in the modeline that a command has started."
465 (setq eshell-command-running-string "**") 452 (setq eshell-command-running-string "**")
@@ -470,13 +457,6 @@ and the hook `eshell-exit-hook'."
470 (setq eshell-command-running-string "--") 457 (setq eshell-command-running-string "--")
471 (force-mode-line-update)) 458 (force-mode-line-update))
472 459
473(eshell-deftest mode command-running-p
474 "Modeline shows no command running"
475 (or (featurep 'xemacs)
476 (not eshell-status-in-modeline)
477 (and (memq 'eshell-command-running-string mode-line-format)
478 (equal eshell-command-running-string "--"))))
479
480;;; Internal Functions: 460;;; Internal Functions:
481 461
482(defun eshell-toggle-direct-send () 462(defun eshell-toggle-direct-send ()
@@ -546,20 +526,6 @@ and the hook `eshell-exit-hook'."
546 (= (1+ pos) limit)) 526 (= (1+ pos) limit))
547 (forward-char 1)))) 527 (forward-char 1))))
548 528
549(eshell-deftest arg forward-arg
550 "Move across command arguments"
551 (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
552 (let ((here (point)) begin valid)
553 (eshell-bol)
554 (setq begin (point))
555 (eshell-forward-argument 4)
556 (setq valid (= here (point)))
557 (eshell-backward-argument 4)
558 (prog1
559 (and valid (= begin (point)))
560 (eshell-bol)
561 (delete-region (point) (point-max)))))
562
563(defun eshell-forward-argument (&optional arg) 529(defun eshell-forward-argument (&optional arg)
564 "Move forward ARG arguments." 530 "Move forward ARG arguments."
565 (interactive "p") 531 (interactive "p")
@@ -659,17 +625,6 @@ waiting for input."
659 (interactive "P") 625 (interactive "P")
660 (eshell-send-input use-region t)) 626 (eshell-send-input use-region t))
661 627
662(eshell-deftest mode queue-input
663 "Queue command input"
664 (eshell-insert-command "sleep 2")
665 (eshell-insert-command "echo alpha" 'eshell-queue-input)
666 (let ((count 10))
667 (while (and eshell-current-command
668 (> count 0))
669 (sit-for 1 0)
670 (setq count (1- count))))
671 (eshell-match-result "alpha\n"))
672
673(defun eshell-send-input (&optional use-region queue-p no-newline) 628(defun eshell-send-input (&optional use-region queue-p no-newline)
674 "Send the input received to Eshell for parsing and processing. 629 "Send the input received to Eshell for parsing and processing.
675After `eshell-last-output-end', sends all text from that marker to 630After `eshell-last-output-end', sends all text from that marker to
@@ -748,20 +703,6 @@ newline."
748 (run-hooks 'eshell-post-command-hook) 703 (run-hooks 'eshell-post-command-hook)
749 (insert-and-inherit input))))))))) 704 (insert-and-inherit input)))))))))
750 705
751; (eshell-deftest proc send-to-subprocess
752; "Send input to a subprocess"
753; ;; jww (1999-12-06): what about when bc is unavailable?
754; (if (not (eshell-search-path "bc"))
755; t
756; (eshell-insert-command "bc")
757; (eshell-insert-command "1 + 2")
758; (sit-for 1 0)
759; (forward-line -1)
760; (prog1
761; (looking-at "3\n")
762; (eshell-insert-command "quit")
763; (sit-for 1 0))))
764
765(defsubst eshell-kill-new () 706(defsubst eshell-kill-new ()
766 "Add the last input text to the kill ring." 707 "Add the last input text to the kill ring."
767 (kill-ring-save eshell-last-input-start eshell-last-input-end)) 708 (kill-ring-save eshell-last-input-start eshell-last-input-end))
@@ -907,14 +848,6 @@ Does not delete the prompt."
907 (insert "*** output flushed ***\n") 848 (insert "*** output flushed ***\n")
908 (delete-region (point) (eshell-end-of-output)))) 849 (delete-region (point) (eshell-end-of-output))))
909 850
910(eshell-deftest io flush-output
911 "Flush previous output"
912 (eshell-insert-command "echo alpha")
913 (eshell-kill-output)
914 (and (eshell-match-result (regexp-quote "*** output flushed ***\n"))
915 (forward-line)
916 (= (point) eshell-last-output-start)))
917
918(defun eshell-show-output (&optional arg) 851(defun eshell-show-output (&optional arg)
919 "Display start of this batch of interpreter output at top of window. 852 "Display start of this batch of interpreter output at top of window.
920Sets mark to the value of point when this command is run. 853Sets mark to the value of point when this command is run.
@@ -975,12 +908,6 @@ When run interactively, widen the buffer first."
975 (goto-char eshell-last-output-end) 908 (goto-char eshell-last-output-end)
976 (insert-and-inherit input))) 909 (insert-and-inherit input)))
977 910
978(eshell-deftest mode run-old-command
979 "Re-run an old command"
980 (eshell-insert-command "echo alpha")
981 (goto-char eshell-last-input-start)
982 (string= (eshell-get-old-input) "echo alpha"))
983
984(defun eshell/exit () 911(defun eshell/exit ()
985 "Leave or kill the Eshell buffer, depending on `eshell-kill-on-exit'." 912 "Leave or kill the Eshell buffer, depending on `eshell-kill-on-exit'."
986 (throw 'eshell-terminal t)) 913 (throw 'eshell-terminal t))
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 8b62b04a8ea..dbe4f824deb 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -147,18 +147,6 @@ function `string-to-number'."
147 147
148(put 'eshell-condition-case 'lisp-indent-function 2) 148(put 'eshell-condition-case 'lisp-indent-function 2)
149 149
150(defmacro eshell-deftest (module name label &rest forms)
151 (if (and (fboundp 'cl-compiling-file) (cl-compiling-file))
152 nil
153 (let ((fsym (intern (concat "eshell-test--" (symbol-name name)))))
154 `(eval-when-compile
155 (ignore
156 (defun ,fsym () ,label
157 (eshell-run-test (quote ,module) (quote ,fsym) ,label
158 (quote (progn ,@forms)))))))))
159
160(put 'eshell-deftest 'lisp-indent-function 2)
161
162(defun eshell-find-delimiter 150(defun eshell-find-delimiter
163 (open close &optional bound reverse-p backslash-p) 151 (open close &optional bound reverse-p backslash-p)
164 "From point, find the CLOSE delimiter corresponding to OPEN. 152 "From point, find the CLOSE delimiter corresponding to OPEN.
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index ae87215a767..69004a841f1 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -109,7 +109,6 @@
109 109
110(eval-when-compile 110(eval-when-compile
111 (require 'pcomplete) 111 (require 'pcomplete)
112 (require 'esh-test)
113 (require 'esh-util) 112 (require 'esh-util)
114 (require 'esh-opt) 113 (require 'esh-opt)
115 (require 'esh-mode)) 114 (require 'esh-mode))
@@ -477,30 +476,6 @@ Possible options are:
477 (t 476 (t
478 (error "Invalid variable reference"))))) 477 (error "Invalid variable reference")))))
479 478
480(eshell-deftest var interp-cmd
481 "Interpolate command result"
482 (eshell-command-result-p "+ ${+ 1 2} 3" "6\n"))
483
484(eshell-deftest var interp-lisp
485 "Interpolate Lisp form evalution"
486 (eshell-command-result-p "+ $(+ 1 2) 3" "6\n"))
487
488(eshell-deftest var interp-concat
489 "Interpolate and concat command"
490 (eshell-command-result-p "+ ${+ 1 2}3 3" "36\n"))
491
492(eshell-deftest var interp-concat-lisp
493 "Interpolate and concat Lisp form"
494 (eshell-command-result-p "+ $(+ 1 2)3 3" "36\n"))
495
496(eshell-deftest var interp-concat2
497 "Interpolate and concat two commands"
498 (eshell-command-result-p "+ ${+ 1 2}${+ 1 2} 3" "36\n"))
499
500(eshell-deftest var interp-concat-lisp2
501 "Interpolate and concat two Lisp forms"
502 (eshell-command-result-p "+ $(+ 1 2)$(+ 1 2) 3" "36\n"))
503
504(defun eshell-parse-indices () 479(defun eshell-parse-indices ()
505 "Parse and return a list of list of indices." 480 "Parse and return a list of list of indices."
506 (let (indices) 481 (let (indices)
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index cda1eea2c55..1a9d7c97b83 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -280,26 +280,12 @@ shells such as bash, zsh, rc, 4dos."
280 :type 'string 280 :type 'string
281 :group 'eshell) 281 :group 'eshell)
282 282
283(eshell-deftest mode same-window-buffer-names
284 "`eshell-buffer-name' is a member of `same-window-buffer-names'"
285 (member eshell-buffer-name same-window-buffer-names))
286
287(defcustom eshell-directory-name 283(defcustom eshell-directory-name
288 (locate-user-emacs-file "eshell/" ".eshell/") 284 (locate-user-emacs-file "eshell/" ".eshell/")
289 "The directory where Eshell control files should be kept." 285 "The directory where Eshell control files should be kept."
290 :type 'directory 286 :type 'directory
291 :group 'eshell) 287 :group 'eshell)
292 288
293(eshell-deftest mode eshell-directory-exists
294 "`eshell-directory-name' exists and is writable"
295 (file-writable-p eshell-directory-name))
296
297(eshell-deftest mode eshell-directory-modes
298 "`eshell-directory-name' has correct access protections"
299 (or (eshell-under-windows-p)
300 (= (file-modes eshell-directory-name)
301 eshell-private-directory-modes)))
302
303;;;_* Running Eshell 289;;;_* Running Eshell
304;; 290;;
305;; There are only three commands used to invoke Eshell. The first two 291;; There are only three commands used to invoke Eshell. The first two
@@ -450,10 +436,6 @@ corresponding to a successful execution."
450 (set status-var eshell-last-command-status)) 436 (set status-var eshell-last-command-status))
451 (cadr result)))))) 437 (cadr result))))))
452 438
453(eshell-deftest mode simple-command-result
454 "`eshell-command-result' works with a simple command."
455 (= (eshell-command-result "+ 1 2") 3))
456
457;;;_* Reporting bugs 439;;;_* Reporting bugs
458;; 440;;
459;; If you do encounter a bug, on any system, please report 441;; If you do encounter a bug, on any system, please report
diff --git a/test/ChangeLog b/test/ChangeLog
index 8b7feaddf62..b247b88bc94 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
12011-03-05 Glenn Morris <rgm@gnu.org>
2
3 * eshell.el: Move here from lisp/eshell/esh-test.el.
4
12011-03-03 Christian Ohler <ohler@gnu.org> 52011-03-03 Christian Ohler <ohler@gnu.org>
2 6
3 * automated/ert-tests.el (ert-test-explain-not-equal-keymaps): 7 * automated/ert-tests.el (ert-test-explain-not-equal-keymaps):
diff --git a/lisp/eshell/esh-test.el b/test/eshell.el
index 73ba16116c0..3b392e84c24 100644
--- a/lisp/eshell/esh-test.el
+++ b/test/eshell.el
@@ -28,6 +28,7 @@
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile 30(eval-when-compile
31 (require 'cl) ; assert
31 (require 'eshell) 32 (require 'eshell)
32 (require 'esh-util)) 33 (require 'esh-util))
33(require 'esh-mode) 34(require 'esh-mode)
@@ -228,6 +229,193 @@
228 "\n")))) 229 "\n"))))
229 nil t)) 230 nil t))
230 231
232
233;;; The tests.
234
235(defmacro eshell-deftest (module name label &rest forms)
236 (declare (indent 2))
237 (if (and (fboundp 'cl-compiling-file) (cl-compiling-file))
238 nil
239 (let ((fsym (intern (concat "eshell-test--" (symbol-name name)))))
240 `(eval-when-compile
241 (ignore
242 (defun ,fsym () ,label
243 (eshell-run-test (quote ,module) (quote ,fsym) ,label
244 (quote (progn ,@forms)))))))))
245
246
247(eshell-deftest mode same-window-buffer-names
248 "`eshell-buffer-name' is a member of `same-window-buffer-names'"
249 (member eshell-buffer-name same-window-buffer-names))
250
251(eshell-deftest mode eshell-directory-exists
252 "`eshell-directory-name' exists and is writable"
253 (file-writable-p eshell-directory-name))
254
255(eshell-deftest mode eshell-directory-modes
256 "`eshell-directory-name' has correct access protections"
257 (or (eshell-under-windows-p)
258 (= (file-modes eshell-directory-name)
259 eshell-private-directory-modes)))
260
261(eshell-deftest mode simple-command-result
262 "`eshell-command-result' works with a simple command."
263 (= (eshell-command-result "+ 1 2") 3))
264
265
266(require 'em-banner)
267
268(eshell-deftest banner banner-displayed
269 "Startup banner is displayed at point-min"
270 (assert eshell-banner-message)
271 (let ((msg (eval eshell-banner-message)))
272 (assert msg)
273 (goto-char (point-min))
274 (looking-at msg)))
275
276
277(require 'esh-cmd)
278
279(eshell-deftest var last-result-var
280 "\"last result\" variable"
281 (eshell-command-result-p "+ 1 2; + $$ 2" "3\n5\n"))
282
283(eshell-deftest var last-result-var2
284 "\"last result\" variable"
285 (eshell-command-result-p "+ 1 2; + $$ $$" "3\n6\n"))
286
287(eshell-deftest var last-arg-var
288 "\"last arg\" variable"
289 (eshell-command-result-p "+ 1 2; + $_ 4" "3\n6\n"))
290
291(eshell-deftest cmd lisp-command
292 "Evaluate Lisp command"
293 (eshell-command-result-p "(+ 1 2)" "3"))
294
295(eshell-deftest cmd lisp-command-args
296 "Evaluate Lisp command (ignore args)"
297 (eshell-command-result-p "(+ 1 2) 3" "3"))
298
299(eshell-deftest cmd subcommand
300 "Run subcommand"
301 (eshell-command-result-p "{+ 1 2}" "3\n"))
302
303(eshell-deftest cmd subcommand-args
304 "Run subcommand (ignore args)"
305 (eshell-command-result-p "{+ 1 2} 3" "3\n"))
306
307(eshell-deftest cmd subcommand-lisp
308 "Run subcommand + Lisp form"
309 (eshell-command-result-p "{(+ 1 2)}" "3\n"))
310
311(eshell-deftest cmd named-command
312 "Execute named command"
313 (eshell-command-result-p "+ 1 2" "3\n"))
314
315
316(require 'esh-mode)
317
318(eshell-deftest mode major-mode
319 "Major mode is correct"
320 (eq major-mode 'eshell-mode))
321
322(eshell-deftest mode eshell-mode-variable
323 "`eshell-mode' is true"
324 (eq eshell-mode t))
325
326(eshell-deftest var window-height
327 "LINES equals window height"
328 (let ((eshell-stringify-t t))
329 (eshell-command-result-p "= $LINES (window-height)" "t\n")))
330
331(eshell-deftest mode command-running-p
332 "Modeline shows no command running"
333 (or (featurep 'xemacs)
334 (not eshell-status-in-modeline)
335 (and (memq 'eshell-command-running-string mode-line-format)
336 (equal eshell-command-running-string "--"))))
337
338(eshell-deftest arg forward-arg
339 "Move across command arguments"
340 (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
341 (let ((here (point)) begin valid)
342 (eshell-bol)
343 (setq begin (point))
344 (eshell-forward-argument 4)
345 (setq valid (= here (point)))
346 (eshell-backward-argument 4)
347 (prog1
348 (and valid (= begin (point)))
349 (eshell-bol)
350 (delete-region (point) (point-max)))))
351
352(eshell-deftest mode queue-input
353 "Queue command input"
354 (eshell-insert-command "sleep 2")
355 (eshell-insert-command "echo alpha" 'eshell-queue-input)
356 (let ((count 10))
357 (while (and eshell-current-command
358 (> count 0))
359 (sit-for 1 0)
360 (setq count (1- count))))
361 (eshell-match-result "alpha\n"))
362
363; (eshell-deftest proc send-to-subprocess
364; "Send input to a subprocess"
365; ;; jww (1999-12-06): what about when bc is unavailable?
366; (if (not (eshell-search-path "bc"))
367; t
368; (eshell-insert-command "bc")
369; (eshell-insert-command "1 + 2")
370; (sit-for 1 0)
371; (forward-line -1)
372; (prog1
373; (looking-at "3\n")
374; (eshell-insert-command "quit")
375; (sit-for 1 0))))
376
377(eshell-deftest io flush-output
378 "Flush previous output"
379 (eshell-insert-command "echo alpha")
380 (eshell-kill-output)
381 (and (eshell-match-result (regexp-quote "*** output flushed ***\n"))
382 (forward-line)
383 (= (point) eshell-last-output-start)))
384
385(eshell-deftest mode run-old-command
386 "Re-run an old command"
387 (eshell-insert-command "echo alpha")
388 (goto-char eshell-last-input-start)
389 (string= (eshell-get-old-input) "echo alpha"))
390
391
392(require 'esh-var)
393
394(eshell-deftest var interp-cmd
395 "Interpolate command result"
396 (eshell-command-result-p "+ ${+ 1 2} 3" "6\n"))
397
398(eshell-deftest var interp-lisp
399 "Interpolate Lisp form evalution"
400 (eshell-command-result-p "+ $(+ 1 2) 3" "6\n"))
401
402(eshell-deftest var interp-concat
403 "Interpolate and concat command"
404 (eshell-command-result-p "+ ${+ 1 2}3 3" "36\n"))
405
406(eshell-deftest var interp-concat-lisp
407 "Interpolate and concat Lisp form"
408 (eshell-command-result-p "+ $(+ 1 2)3 3" "36\n"))
409
410(eshell-deftest var interp-concat2
411 "Interpolate and concat two commands"
412 (eshell-command-result-p "+ ${+ 1 2}${+ 1 2} 3" "36\n"))
413
414(eshell-deftest var interp-concat-lisp2
415 "Interpolate and concat two Lisp forms"
416 (eshell-command-result-p "+ $(+ 1 2)$(+ 1 2) 3" "36\n"))
417
418
231(provide 'esh-test) 419(provide 'esh-test)
232 420
233;;; esh-test.el ends here 421;;; esh-test.el ends here