From: Juri Linkov Date: Sun, 29 Jul 2012 00:12:13 +0000 (+0300) Subject: * test/automated/occur-tests.el (occur-test-case): Use predefined X-Git-Tag: emacs-24.2.90~1035 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d8efda90aa36b6bea5cca9bd6765cbb76571d933;p=emacs.git * test/automated/occur-tests.el (occur-test-case): Use predefined buffer name " *test-occur*" instead of a random buffer name. --- diff --git a/test/ChangeLog b/test/ChangeLog index db8380cfb27..54030e210ed 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Juri Linkov + + * automated/occur-tests.el (occur-test-case): Use predefined + buffer name " *test-occur*" instead of a random buffer name. + 2012-07-20 Dmitry Gutov * automated/ruby-mode-tests.el: New file with one test. diff --git a/test/automated/occur-tests.el b/test/automated/occur-tests.el index eb62688d788..5fe9722d4e7 100644 --- a/test/automated/occur-tests.el +++ b/test/automated/occur-tests.el @@ -35,7 +35,7 @@ xd xex fx " "\ -5 matches for \"x\" in buffer: *temp*<2> +5 matches for \"x\" in buffer: *test-occur* 1:xa 3:cx 4:xd @@ -52,7 +52,7 @@ a a a " "\ -2 matches for \"a^Ja\" in buffer: *temp*<2> +2 matches for \"a^Ja\" in buffer: *test-occur* 1:a :a 3:a @@ -68,7 +68,7 @@ c a b " "\ -2 matches for \"a^Jb\" in buffer: *temp*<2> +2 matches for \"a^Jb\" in buffer: *test-occur* 1:a :b 4:a @@ -82,7 +82,7 @@ c a " "\ -2 matches for \"a^J\" in buffer: *temp*<2> +2 matches for \"a^J\" in buffer: *test-occur* 1:a : 4:a @@ -97,7 +97,7 @@ d ex fx " "\ -2 matches for \"x^J.x^J\" in buffer: *temp*<2> +2 matches for \"x^J.x^J\" in buffer: *test-occur* 1:ax :bx :c @@ -116,7 +116,7 @@ f g hx " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* 1:ax :b ------- @@ -136,7 +136,7 @@ d ex f " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* :a 2:bx :c @@ -159,7 +159,7 @@ i j kx " "\ -5 matches for \"x\" in buffer: *temp*<2> +5 matches for \"x\" in buffer: *test-occur* 1:ax 2:bx :c @@ -184,7 +184,7 @@ gx h i " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* :a :b 3:cx @@ -207,7 +207,7 @@ gx h " "\ -2 matches for \"x\" in buffer: *temp*<2> +2 matches for \"x\" in buffer: *test-occur* : :b 3:cx @@ -232,7 +232,7 @@ i jx kx " "\ -3 matches for \"x^J.x\" in buffer: *temp*<2> +3 matches for \"x^J.x\" in buffer: *test-occur* 1:ax :bx :c @@ -256,7 +256,7 @@ f gx hx " "\ -2 matches for \"x^J.x\" in buffer: *temp*<2> +2 matches for \"x^J.x\" in buffer: *test-occur* 1:ax :bx :c @@ -279,7 +279,7 @@ g h ix " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* :a 2:bx ------- @@ -302,7 +302,7 @@ f gx h " "\ -3 matches for \"x\" in buffer: *temp*<2> +3 matches for \"x\" in buffer: *test-occur* :a 2:bx :c @@ -321,14 +321,19 @@ 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))) - (save-window-excursion - (with-temp-buffer - (insert input-buffer-string) - (occur regexp nlines) - (equal output-buffer-string - (with-current-buffer "*Occur*" - (buffer-string))))))) + (output-buffer-string (nth 3 test)) + (temp-buffer (get-buffer-create " *test-occur*"))) + (unwind-protect + (save-window-excursion + (with-current-buffer temp-buffer + (erase-buffer) + (insert input-buffer-string) + (occur regexp nlines) + (equal output-buffer-string + (with-current-buffer "*Occur*" + (buffer-string))))) + (and (buffer-name temp-buffer) + (kill-buffer temp-buffer))))) (ert-deftest occur-tests () "Test the functionality of `occur'.