emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103530: Move eshell's self-tests to


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103530: Move eshell's self-tests to the test/ directory.
Date: Sat, 05 Mar 2011 12:07:27 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103530
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2011-03-05 12:07:27 -0800
message:
  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.
renamed:
  lisp/eshell/esh-test.el => test/eshell.el
modified:
  lisp/ChangeLog
  lisp/eshell/em-banner.el
  lisp/eshell/esh-cmd.el
  lisp/eshell/esh-mode.el
  lisp/eshell/esh-util.el
  lisp/eshell/esh-var.el
  lisp/eshell/eshell.el
  test/ChangeLog
  test/eshell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-05 19:37:46 +0000
+++ b/lisp/ChangeLog    2011-03-05 20:07:27 +0000
@@ -1,3 +1,10 @@
+2011-03-05  Glenn Morris  <address@hidden>
+
+       * eshell/esh-var.el: Don't require esh-test when compiling.
+       * eshell/em-banner.el, eshell/esh-cmd.el, eshell/esh-mode.el:
+       * eshell/esh-var.el, eshell/eshell.el: Move tests to esh-test.
+       * eshell/esh-test.el: Move to ../../test/eshell.el
+
 2011-03-05  David Engster  <address@hidden>
 
        * files.el (save-some-buffers): Report the names of buffers saved

=== modified file 'lisp/eshell/em-banner.el'
--- a/lisp/eshell/em-banner.el  2011-03-05 04:11:05 +0000
+++ b/lisp/eshell/em-banner.el  2011-03-05 20:07:27 +0000
@@ -82,14 +82,6 @@
       (assert msg)
       (eshell-interactive-print msg))))
 
-(eshell-deftest banner banner-displayed
-  "Startup banner is displayed at point-min"
-  (assert eshell-banner-message)
-  (let ((msg (eval eshell-banner-message)))
-    (assert msg)
-    (goto-char (point-min))
-    (looking-at msg)))
-
 (provide 'em-banner)
 
 ;; Local Variables:

=== modified file 'lisp/eshell/esh-cmd.el'
--- a/lisp/eshell/esh-cmd.el    2011-03-05 04:11:05 +0000
+++ b/lisp/eshell/esh-cmd.el    2011-03-05 20:07:27 +0000
@@ -320,18 +320,6 @@
     (add-hook 'pcomplete-try-first-hook
              'eshell-complete-lisp-symbols nil t)))
 
-(eshell-deftest var last-result-var
-  "\"last result\" variable"
-  (eshell-command-result-p "+ 1 2; + $$ 2" "3\n5\n"))
-
-(eshell-deftest var last-result-var2
-  "\"last result\" variable"
-  (eshell-command-result-p "+ 1 2; + $$ $$" "3\n6\n"))
-
-(eshell-deftest var last-arg-var
-  "\"last arg\" variable"
-  (eshell-command-result-p "+ 1 2; + $_ 4" "3\n6\n"))
-
 (defun eshell-complete-lisp-symbols ()
   "If there is a user reference, complete it."
   (let ((arg (pcomplete-actual-arg)))
@@ -441,32 +429,12 @@
           (eq (caar terms) 'eshell-command-to-value))
       (car (cdar terms))))
 
-(eshell-deftest cmd lisp-command
-  "Evaluate Lisp command"
-  (eshell-command-result-p "(+ 1 2)" "3"))
-
-(eshell-deftest cmd lisp-command-args
-  "Evaluate Lisp command (ignore args)"
-  (eshell-command-result-p "(+ 1 2) 3" "3"))
-
 (defun eshell-rewrite-initial-subcommand (terms)
   "Rewrite a subcommand in initial position, such as '{+ 1 2}'."
   (if (and (listp (car terms))
           (eq (caar terms) 'eshell-as-subcommand))
       (car terms)))
 
-(eshell-deftest cmd subcommand
-  "Run subcommand"
-  (eshell-command-result-p "{+ 1 2}" "3\n"))
-
-(eshell-deftest cmd subcommand-args
-  "Run subcommand (ignore args)"
-  (eshell-command-result-p "{+ 1 2} 3" "3\n"))
-
-(eshell-deftest cmd subcommand-lisp
-  "Run subcommand + Lisp form"
-  (eshell-command-result-p "{(+ 1 2)}" "3\n"))
-
 (defun eshell-rewrite-named-command (terms)
   "If no other rewriting rule transforms TERMS, assume a named command."
   (let ((sym (if eshell-in-pipeline-p
@@ -478,10 +446,6 @@
        (list sym cmd (append (list 'list) (cdr terms)))
       (list sym cmd))))
 
-(eshell-deftest cmd named-command
-  "Execute named command"
-  (eshell-command-result-p "+ 1 2" "3\n"))
-
 (defvar eshell-command-body)
 (defvar eshell-test-body)
 

=== modified file 'lisp/eshell/esh-mode.el'
--- a/lisp/eshell/esh-mode.el   2011-03-05 04:11:05 +0000
+++ b/lisp/eshell/esh-mode.el   2011-03-05 20:07:27 +0000
@@ -447,19 +447,6 @@
 
 (put 'eshell-mode 'mode-class 'special)
 
-(eshell-deftest mode major-mode
-  "Major mode is correct"
-  (eq major-mode 'eshell-mode))
-
-(eshell-deftest mode eshell-mode-variable
-  "`eshell-mode' is true"
-  (eq eshell-mode t))
-
-(eshell-deftest var window-height
-  "LINES equals window height"
-  (let ((eshell-stringify-t t))
-    (eshell-command-result-p "= $LINES (window-height)" "t\n")))
-
 (defun eshell-command-started ()
   "Indicate in the modeline that a command has started."
   (setq eshell-command-running-string "**")
@@ -470,13 +457,6 @@
   (setq eshell-command-running-string "--")
   (force-mode-line-update))
 
-(eshell-deftest mode command-running-p
-  "Modeline shows no command running"
-  (or (featurep 'xemacs)
-      (not eshell-status-in-modeline)
-      (and (memq 'eshell-command-running-string mode-line-format)
-          (equal eshell-command-running-string "--"))))
-
 ;;; Internal Functions:
 
 (defun eshell-toggle-direct-send ()
@@ -546,20 +526,6 @@
             (= (1+ pos) limit))
        (forward-char 1))))
 
-(eshell-deftest arg forward-arg
-  "Move across command arguments"
-  (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
-  (let ((here (point)) begin valid)
-    (eshell-bol)
-    (setq begin (point))
-    (eshell-forward-argument 4)
-    (setq valid (= here (point)))
-    (eshell-backward-argument 4)
-    (prog1
-       (and valid (= begin (point)))
-      (eshell-bol)
-      (delete-region (point) (point-max)))))
-
 (defun eshell-forward-argument (&optional arg)
   "Move forward ARG arguments."
   (interactive "p")
@@ -659,17 +625,6 @@
   (interactive "P")
   (eshell-send-input use-region t))
 
-(eshell-deftest mode queue-input
-  "Queue command input"
-  (eshell-insert-command "sleep 2")
-  (eshell-insert-command "echo alpha" 'eshell-queue-input)
-  (let ((count 10))
-    (while (and eshell-current-command
-               (> count 0))
-      (sit-for 1 0)
-      (setq count (1- count))))
-  (eshell-match-result "alpha\n"))
-
 (defun eshell-send-input (&optional use-region queue-p no-newline)
   "Send the input received to Eshell for parsing and processing.
 After `eshell-last-output-end', sends all text from that marker to
@@ -748,20 +703,6 @@
               (run-hooks 'eshell-post-command-hook)
               (insert-and-inherit input)))))))))
 
-; (eshell-deftest proc send-to-subprocess
-;   "Send input to a subprocess"
-;   ;; jww (1999-12-06): what about when bc is unavailable?
-;   (if (not (eshell-search-path "bc"))
-;       t
-;     (eshell-insert-command "bc")
-;     (eshell-insert-command "1 + 2")
-;     (sit-for 1 0)
-;     (forward-line -1)
-;     (prog1
-;      (looking-at "3\n")
-;       (eshell-insert-command "quit")
-;       (sit-for 1 0))))
-
 (defsubst eshell-kill-new ()
   "Add the last input text to the kill ring."
   (kill-ring-save eshell-last-input-start eshell-last-input-end))
@@ -907,14 +848,6 @@
     (insert "*** output flushed ***\n")
     (delete-region (point) (eshell-end-of-output))))
 
-(eshell-deftest io flush-output
-  "Flush previous output"
-  (eshell-insert-command "echo alpha")
-  (eshell-kill-output)
-  (and (eshell-match-result (regexp-quote "*** output flushed ***\n"))
-       (forward-line)
-       (= (point) eshell-last-output-start)))
-
 (defun eshell-show-output (&optional arg)
   "Display start of this batch of interpreter output at top of window.
 Sets mark to the value of point when this command is run.
@@ -975,12 +908,6 @@
     (goto-char eshell-last-output-end)
     (insert-and-inherit input)))
 
-(eshell-deftest mode run-old-command
-  "Re-run an old command"
-  (eshell-insert-command "echo alpha")
-  (goto-char eshell-last-input-start)
-  (string= (eshell-get-old-input) "echo alpha"))
-
 (defun eshell/exit ()
   "Leave or kill the Eshell buffer, depending on `eshell-kill-on-exit'."
   (throw 'eshell-terminal t))

=== modified file 'lisp/eshell/esh-util.el'
--- a/lisp/eshell/esh-util.el   2011-03-05 04:24:44 +0000
+++ b/lisp/eshell/esh-util.el   2011-03-05 20:07:27 +0000
@@ -147,18 +147,6 @@
 
 (put 'eshell-condition-case 'lisp-indent-function 2)
 
-(defmacro eshell-deftest (module name label &rest forms)
-  (if (and (fboundp 'cl-compiling-file) (cl-compiling-file))
-      nil
-    (let ((fsym (intern (concat "eshell-test--" (symbol-name name)))))
-      `(eval-when-compile
-        (ignore
-         (defun ,fsym () ,label
-           (eshell-run-test (quote ,module) (quote ,fsym) ,label
-                            (quote (progn ,@forms)))))))))
-
-(put 'eshell-deftest 'lisp-indent-function 2)
-
 (defun eshell-find-delimiter
   (open close &optional bound reverse-p backslash-p)
   "From point, find the CLOSE delimiter corresponding to OPEN.

=== modified file 'lisp/eshell/esh-var.el'
--- a/lisp/eshell/esh-var.el    2011-03-05 04:11:05 +0000
+++ b/lisp/eshell/esh-var.el    2011-03-05 20:07:27 +0000
@@ -109,7 +109,6 @@
 
 (eval-when-compile
   (require 'pcomplete)
-  (require 'esh-test)
   (require 'esh-util)
   (require 'esh-opt)
   (require 'esh-mode))
@@ -477,30 +476,6 @@
      (t
       (error "Invalid variable reference")))))
 
-(eshell-deftest var interp-cmd
-  "Interpolate command result"
-  (eshell-command-result-p "+ ${+ 1 2} 3" "6\n"))
-
-(eshell-deftest var interp-lisp
-  "Interpolate Lisp form evalution"
-  (eshell-command-result-p "+ $(+ 1 2) 3" "6\n"))
-
-(eshell-deftest var interp-concat
-  "Interpolate and concat command"
-  (eshell-command-result-p "+ ${+ 1 2}3 3" "36\n"))
-
-(eshell-deftest var interp-concat-lisp
-  "Interpolate and concat Lisp form"
-  (eshell-command-result-p "+ $(+ 1 2)3 3" "36\n"))
-
-(eshell-deftest var interp-concat2
-  "Interpolate and concat two commands"
-  (eshell-command-result-p "+ ${+ 1 2}${+ 1 2} 3" "36\n"))
-
-(eshell-deftest var interp-concat-lisp2
-  "Interpolate and concat two Lisp forms"
-  (eshell-command-result-p "+ $(+ 1 2)$(+ 1 2) 3" "36\n"))
-
 (defun eshell-parse-indices ()
   "Parse and return a list of list of indices."
   (let (indices)

=== modified file 'lisp/eshell/eshell.el'
--- a/lisp/eshell/eshell.el     2011-03-05 03:53:41 +0000
+++ b/lisp/eshell/eshell.el     2011-03-05 20:07:27 +0000
@@ -280,26 +280,12 @@
   :type 'string
   :group 'eshell)
 
-(eshell-deftest mode same-window-buffer-names
-  "`eshell-buffer-name' is a member of `same-window-buffer-names'"
-  (member eshell-buffer-name same-window-buffer-names))
-
 (defcustom eshell-directory-name
   (locate-user-emacs-file "eshell/" ".eshell/")
   "The directory where Eshell control files should be kept."
   :type 'directory
   :group 'eshell)
 
-(eshell-deftest mode eshell-directory-exists
-  "`eshell-directory-name' exists and is writable"
-  (file-writable-p eshell-directory-name))
-
-(eshell-deftest mode eshell-directory-modes
-  "`eshell-directory-name' has correct access protections"
-  (or (eshell-under-windows-p)
-      (= (file-modes eshell-directory-name)
-        eshell-private-directory-modes)))
-
 ;;;_* Running Eshell
 ;;
 ;; There are only three commands used to invoke Eshell.  The first two
@@ -450,10 +436,6 @@
              (set status-var eshell-last-command-status))
          (cadr result))))))
 
-(eshell-deftest mode simple-command-result
-  "`eshell-command-result' works with a simple command."
-  (= (eshell-command-result "+ 1 2") 3))
-
 ;;;_* Reporting bugs
 ;;
 ;; If you do encounter a bug, on any system, please report

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2011-03-03 09:01:51 +0000
+++ b/test/ChangeLog    2011-03-05 20:07:27 +0000
@@ -1,3 +1,7 @@
+2011-03-05  Glenn Morris  <address@hidden>
+
+       * eshell.el: Move here from lisp/eshell/esh-test.el.
+
 2011-03-03  Christian Ohler  <address@hidden>
 
        * automated/ert-tests.el (ert-test-explain-not-equal-keymaps):

=== renamed file 'lisp/eshell/esh-test.el' => 'test/eshell.el'
--- a/lisp/eshell/esh-test.el   2011-03-05 03:53:41 +0000
+++ b/test/eshell.el    2011-03-05 20:07:27 +0000
@@ -28,6 +28,7 @@
 ;;; Code:
 
 (eval-when-compile
+  (require 'cl)                                ; assert
   (require 'eshell)
   (require 'esh-util))
 (require 'esh-mode)
@@ -228,6 +229,193 @@
                 "\n"))))
            nil t))
 
+
+;;; The tests.
+
+(defmacro eshell-deftest (module name label &rest forms)
+  (declare (indent 2))
+  (if (and (fboundp 'cl-compiling-file) (cl-compiling-file))
+      nil
+    (let ((fsym (intern (concat "eshell-test--" (symbol-name name)))))
+      `(eval-when-compile
+        (ignore
+         (defun ,fsym () ,label
+           (eshell-run-test (quote ,module) (quote ,fsym) ,label
+                            (quote (progn ,@forms)))))))))
+
+
+(eshell-deftest mode same-window-buffer-names
+  "`eshell-buffer-name' is a member of `same-window-buffer-names'"
+  (member eshell-buffer-name same-window-buffer-names))
+
+(eshell-deftest mode eshell-directory-exists
+  "`eshell-directory-name' exists and is writable"
+  (file-writable-p eshell-directory-name))
+
+(eshell-deftest mode eshell-directory-modes
+  "`eshell-directory-name' has correct access protections"
+  (or (eshell-under-windows-p)
+      (= (file-modes eshell-directory-name)
+        eshell-private-directory-modes)))
+
+(eshell-deftest mode simple-command-result
+  "`eshell-command-result' works with a simple command."
+  (= (eshell-command-result "+ 1 2") 3))
+
+
+(require 'em-banner)
+
+(eshell-deftest banner banner-displayed
+  "Startup banner is displayed at point-min"
+  (assert eshell-banner-message)
+  (let ((msg (eval eshell-banner-message)))
+    (assert msg)
+    (goto-char (point-min))
+    (looking-at msg)))
+
+
+(require 'esh-cmd)
+
+(eshell-deftest var last-result-var
+  "\"last result\" variable"
+  (eshell-command-result-p "+ 1 2; + $$ 2" "3\n5\n"))
+
+(eshell-deftest var last-result-var2
+  "\"last result\" variable"
+  (eshell-command-result-p "+ 1 2; + $$ $$" "3\n6\n"))
+
+(eshell-deftest var last-arg-var
+  "\"last arg\" variable"
+  (eshell-command-result-p "+ 1 2; + $_ 4" "3\n6\n"))
+
+(eshell-deftest cmd lisp-command
+  "Evaluate Lisp command"
+  (eshell-command-result-p "(+ 1 2)" "3"))
+
+(eshell-deftest cmd lisp-command-args
+  "Evaluate Lisp command (ignore args)"
+  (eshell-command-result-p "(+ 1 2) 3" "3"))
+
+(eshell-deftest cmd subcommand
+  "Run subcommand"
+  (eshell-command-result-p "{+ 1 2}" "3\n"))
+
+(eshell-deftest cmd subcommand-args
+  "Run subcommand (ignore args)"
+  (eshell-command-result-p "{+ 1 2} 3" "3\n"))
+
+(eshell-deftest cmd subcommand-lisp
+  "Run subcommand + Lisp form"
+  (eshell-command-result-p "{(+ 1 2)}" "3\n"))
+
+(eshell-deftest cmd named-command
+  "Execute named command"
+  (eshell-command-result-p "+ 1 2" "3\n"))
+
+
+(require 'esh-mode)
+
+(eshell-deftest mode major-mode
+  "Major mode is correct"
+  (eq major-mode 'eshell-mode))
+
+(eshell-deftest mode eshell-mode-variable
+  "`eshell-mode' is true"
+  (eq eshell-mode t))
+
+(eshell-deftest var window-height
+  "LINES equals window height"
+  (let ((eshell-stringify-t t))
+    (eshell-command-result-p "= $LINES (window-height)" "t\n")))
+
+(eshell-deftest mode command-running-p
+  "Modeline shows no command running"
+  (or (featurep 'xemacs)
+      (not eshell-status-in-modeline)
+      (and (memq 'eshell-command-running-string mode-line-format)
+          (equal eshell-command-running-string "--"))))
+
+(eshell-deftest arg forward-arg
+  "Move across command arguments"
+  (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
+  (let ((here (point)) begin valid)
+    (eshell-bol)
+    (setq begin (point))
+    (eshell-forward-argument 4)
+    (setq valid (= here (point)))
+    (eshell-backward-argument 4)
+    (prog1
+       (and valid (= begin (point)))
+      (eshell-bol)
+      (delete-region (point) (point-max)))))
+
+(eshell-deftest mode queue-input
+  "Queue command input"
+  (eshell-insert-command "sleep 2")
+  (eshell-insert-command "echo alpha" 'eshell-queue-input)
+  (let ((count 10))
+    (while (and eshell-current-command
+               (> count 0))
+      (sit-for 1 0)
+      (setq count (1- count))))
+  (eshell-match-result "alpha\n"))
+
+; (eshell-deftest proc send-to-subprocess
+;   "Send input to a subprocess"
+;   ;; jww (1999-12-06): what about when bc is unavailable?
+;   (if (not (eshell-search-path "bc"))
+;       t
+;     (eshell-insert-command "bc")
+;     (eshell-insert-command "1 + 2")
+;     (sit-for 1 0)
+;     (forward-line -1)
+;     (prog1
+;      (looking-at "3\n")
+;       (eshell-insert-command "quit")
+;       (sit-for 1 0))))
+
+(eshell-deftest io flush-output
+  "Flush previous output"
+  (eshell-insert-command "echo alpha")
+  (eshell-kill-output)
+  (and (eshell-match-result (regexp-quote "*** output flushed ***\n"))
+       (forward-line)
+       (= (point) eshell-last-output-start)))
+
+(eshell-deftest mode run-old-command
+  "Re-run an old command"
+  (eshell-insert-command "echo alpha")
+  (goto-char eshell-last-input-start)
+  (string= (eshell-get-old-input) "echo alpha"))
+
+
+(require 'esh-var)
+
+(eshell-deftest var interp-cmd
+  "Interpolate command result"
+  (eshell-command-result-p "+ ${+ 1 2} 3" "6\n"))
+
+(eshell-deftest var interp-lisp
+  "Interpolate Lisp form evalution"
+  (eshell-command-result-p "+ $(+ 1 2) 3" "6\n"))
+
+(eshell-deftest var interp-concat
+  "Interpolate and concat command"
+  (eshell-command-result-p "+ ${+ 1 2}3 3" "36\n"))
+
+(eshell-deftest var interp-concat-lisp
+  "Interpolate and concat Lisp form"
+  (eshell-command-result-p "+ $(+ 1 2)3 3" "36\n"))
+
+(eshell-deftest var interp-concat2
+  "Interpolate and concat two commands"
+  (eshell-command-result-p "+ ${+ 1 2}${+ 1 2} 3" "36\n"))
+
+(eshell-deftest var interp-concat-lisp2
+  "Interpolate and concat two Lisp forms"
+  (eshell-command-result-p "+ $(+ 1 2)$(+ 1 2) 3" "36\n"))
+
+
 (provide 'esh-test)
 
 ;;; esh-test.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]