emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114310: * test/automated/eshell.el (eshell-match-re


From: Glenn Morris
Subject: [Emacs-diffs] trunk r114310: * test/automated/eshell.el (eshell-match-result):
Date: Mon, 16 Sep 2013 20:58:41 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114310
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2013-09-16 16:58:28 -0400
message:
  * test/automated/eshell.el (eshell-match-result):
  Return a more informative failure than simply "false".  Update callers.
modified:
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
  test/automated/eshell.el       eshtest.el-20091113204419-o5vbwnq5f7feedwu-1875
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-09-16 18:42:41 +0000
+++ b/test/ChangeLog    2013-09-16 20:58:28 +0000
@@ -1,5 +1,8 @@
 2013-09-16  Glenn Morris  <address@hidden>
 
+       * automated/eshell.el (eshell-match-result):
+       Return a more informative failure than simply "false".  Update callers.
+
        * automated/eshell.el (eshell-test/for-name-shadow-loop):
        Test value before and after loop as well as during.
 

=== modified file 'test/automated/eshell.el'
--- a/test/automated/eshell.el  2013-09-16 19:21:45 +0000
+++ b/test/automated/eshell.el  2013-09-16 20:58:28 +0000
@@ -47,13 +47,11 @@
   (funcall (or func 'eshell-send-input)))
 
 (defun eshell-match-result (regexp)
-  "Insert a command at the end of the buffer."
+  "Check that text after `eshell-last-input-end' matches REGEXP."
   (goto-char eshell-last-input-end)
-  (looking-at regexp))
+  (should (string-match-p regexp (buffer-substring-no-properties
+                                  (point) (point-max)))))
 
-;; FIXME this does not return informative failure messages, just t or nil.
-;; It should return the expected buffer contents and the actual one,
-;; so that we can see what form any failure took.
 (defun eshell-command-result-p (text regexp &optional func)
   "Insert a command at the end of the buffer."
   (eshell-insert-command text func)
@@ -93,9 +91,8 @@
   "Test `eshell-command-result' with a for loop using an env-var."
   (let ((process-environment (cons "name=env-value" process-environment)))
     (with-temp-eshell
-     (should
-      (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo 
$name"
-                               "env-value\n3\nenv-value\n")))))
+     (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo 
$name"
+                              "env-value\n3\nenv-value\n"))))
 
 (ert-deftest eshell-test/lisp-command-args ()
   "Test `eshell-command-result' with elisp and trailing args.
@@ -154,23 +151,20 @@
 (ert-deftest eshell-test/last-result-var ()
   "Test using the \"last result\" ($$) variable"
   (with-temp-eshell
-   (should
-    (eshell-command-result-p "+ 1 2; + $$ 2"
-                             "3\n5\n"))))
+   (eshell-command-result-p "+ 1 2; + $$ 2"
+                            "3\n5\n")))
 
 (ert-deftest eshell-test/last-result-var2 ()
   "Test using the \"last result\" ($$) variable twice"
   (with-temp-eshell
-   (should
-    (eshell-command-result-p "+ 1 2; + $$ $$"
-                             "3\n6\n"))))
+   (eshell-command-result-p "+ 1 2; + $$ $$"
+                             "3\n6\n")))
 
 (ert-deftest eshell-test/last-arg-var ()
   "Test using the \"last arg\" ($_) variable"
   (with-temp-eshell
-   (should
-    (eshell-command-result-p "+ 1 2; + $_ 4"
-                             "3\n6\n"))))
+   (eshell-command-result-p "+ 1 2; + $_ 4"
+                             "3\n6\n")))
 
 (ert-deftest eshell-test/command-running-p ()
   "Modeline should show no command running"
@@ -204,14 +198,14 @@
                  (> count 0))
        (sit-for 1)
        (setq count (1- count))))
-   (should (eshell-match-result "alpha\n"))))
+   (eshell-match-result "alpha\n")))
 
 (ert-deftest eshell-test/flush-output ()
   "Test flushing of previous output"
   (with-temp-eshell
    (eshell-insert-command "echo alpha")
    (eshell-kill-output)
-   (should (eshell-match-result (regexp-quote "*** output flushed ***\n")))
+   (eshell-match-result (regexp-quote "*** output flushed ***\n"))
    (should (forward-line))
    (should (= (point) eshell-last-output-start))))
 


reply via email to

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