emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109254: * test/automated/occur-tests


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109254: * test/automated/occur-tests.el (occur-test-case): Use predefined
Date: Sun, 29 Jul 2012 03:12:13 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109254
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-29 03:12:13 +0300
message:
  * test/automated/occur-tests.el (occur-test-case): Use predefined
  buffer name " *test-occur*" instead of a random buffer name.
modified:
  test/ChangeLog
  test/automated/occur-tests.el
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2012-07-20 11:10:25 +0000
+++ b/test/ChangeLog    2012-07-29 00:12:13 +0000
@@ -1,3 +1,8 @@
+2012-07-29  Juri Linkov  <address@hidden>
+
+       * automated/occur-tests.el (occur-test-case): Use predefined
+       buffer name " *test-occur*" instead of a random buffer name.
+
 2012-07-20  Dmitry Gutov  <address@hidden>
 
        * automated/ruby-mode-tests.el: New file with one test.

=== modified file 'test/automated/occur-tests.el'
--- a/test/automated/occur-tests.el     2012-01-05 09:46:05 +0000
+++ b/test/automated/occur-tests.el     2012-07-29 00:12:13 +0000
@@ -35,7 +35,7 @@
 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
 " "\
-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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 h
 
 " "\
-2 matches for \"x\" in buffer:  *temp*<2>
+2 matches for \"x\" in buffer:  *test-occur*
        :
        :b
       3:cx
@@ -232,7 +232,7 @@
 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 @@
 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 @@
 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 @@
 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 @@
   (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'.


reply via email to

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