From 83087df9492f4a16c835664aa39d0b8a7756d4bb Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 17 Nov 2014 13:39:56 -0500 Subject: [PATCH] Improve output of occur-tests in case of failure * 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 | 5 +++++ test/automated/occur-tests.el | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 47bbfb36a10..42fcd8e934a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2014-11-17 Glenn Morris + + * 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 * automated/icalendar-tests.el (icalendar-tests--test-import): diff --git a/test/automated/occur-tests.el b/test/automated/occur-tests.el index b15e3dc9933..c00b71dd05f 100644 --- a/test/automated/occur-tests.el +++ b/test/automated/occur-tests.el @@ -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)) -- 2.11.4.GIT