]> git.eshelyaron.com Git - emacs.git/commitdiff
* tests/automated/tildify-tests.el (tildify-test--test): Optimise the
authorMichal Nazarewicz <mina86@mina86.com>
Thu, 5 Jun 2014 14:42:45 +0000 (16:42 +0200)
committerMichal Nazarewicz <mina86@mina86.com>
Thu, 5 Jun 2014 14:42:45 +0000 (16:42 +0200)
test slightly by reusing the same temporary buffer across multiple
test cases.

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

index 6248d6cb9a6fc83617b0fb355ca5644b0098f74a..bb8ed89bed055ecf02bfd986e1cc39ad0525a3df 100644 (file)
@@ -1,5 +1,9 @@
 2014-06-05  Michal Nazarewicz  <mina86@mina86.com>
 
+       * automated/tildify-tests.el (tildify-test--test): Optimise the test
+       slightly by reusing the same temporary buffer across multiple test
+       cases.
+
        * automated/tildify-tests.el (tildify-test-find-env-end-re-bug)
        (tildify-test-find-env-group-index-bug): Update to support new
        signature of the `tildify-foreach-region-outside-env' function.
index cf18320030d5e0ec10d099fb17c1c87a299c286b..86c83d7ac5b13e9370c78a4d8d3de7116b01c300 100644 (file)
@@ -54,16 +54,16 @@ If IS-XML is non-nil, <pre> tag is not treated specially."
   "Test tildify running in MODES.
 INPUT is the initial content of the buffer and EXPECTED is expected result
 after `tildify-buffer' is run."
-  (dolist (mode modes)
-    (with-temp-buffer
+  (with-temp-buffer
+    (dolist (mode modes)
+      (erase-buffer)
       (funcall mode)
       (let ((header (concat "Testing `tildify-buffer' in "
                             (symbol-name mode) "\n")))
         (insert header input)
         (tildify-buffer t)
-        (should (string-equal (concat header expected) (buffer-string)))))
-    (with-temp-buffer
-      (funcall mode)
+        (should (string-equal (concat header expected) (buffer-string))))
+      (erase-buffer)
       (let ((header (concat "Testing `tildify-region' in "
                             (symbol-name mode) "\n")))
         (insert header input)