]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve output of occur-tests in case of failure
authorGlenn Morris <rgm@gnu.org>
Mon, 17 Nov 2014 18:39:56 +0000 (13:39 -0500)
committerGlenn Morris <rgm@gnu.org>
Mon, 17 Nov 2014 18:39:56 +0000 (13:39 -0500)
* test/automated/occur-tests.el (occur-test-case, occur-test-create):
In case of failure, show the actual string, rather than just nil.

test/ChangeLog
test/automated/occur-tests.el

index 47bbfb36a1020b2f51e77295df315bc83db80e4a..42fcd8e934ac0a54dc864a99cfe71b8f6b2d1d44 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-17  Glenn Morris  <rgm@gnu.org>
+
+       * automated/occur-tests.el (occur-test-case, occur-test-create):
+       In case of failure, show the actual string, rather than just nil.
+
 2014-11-17  Ulf Jasper  <ulf.jasper@web.de>
 
        * automated/icalendar-tests.el (icalendar-tests--test-import):
index b15e3dc9933f073c73f1ed0c6f7055194d7c19de..c00b71dd05fe49f3aac64a4cc6ac7d206f0d24ad 100644 (file)
@@ -321,7 +321,6 @@ Each element has the format:
   (let ((regexp (nth 0 test))
         (nlines (nth 1 test))
         (input-buffer-string (nth 2 test))
-        (output-buffer-string (nth 3 test))
         (temp-buffer (get-buffer-create " *test-occur*")))
     (unwind-protect
         (save-window-excursion
@@ -329,9 +328,8 @@ Each element has the format:
             (erase-buffer)
             (insert input-buffer-string)
             (occur regexp nlines)
-            (equal output-buffer-string
-                   (with-current-buffer "*Occur*"
-                     (buffer-string)))))
+            (with-current-buffer "*Occur*"
+              (buffer-substring-no-properties (point-min) (point-max)))))
       (and (buffer-name temp-buffer)
            (kill-buffer temp-buffer)))))
 
@@ -343,7 +341,8 @@ Each element has the format:
      `(ert-deftest ,testname ()
         ,testdoc
         (let (occur-hook)
-          (should (occur-test-case (nth ,n occur-tests))))))))
+          (should (equal (occur-test-case (nth ,n occur-tests))
+                         (nth 3 (nth ,n occur-tests)))))))))
 
 (dotimes (i (length occur-tests))
   (occur-test-create i))