emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] test-ob-tangle.el: Fix dirty repo state caused by testing
@ 2020-05-27  0:47 Kevin Foley
  2020-05-27  2:05 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Foley @ 2020-05-27  0:47 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bastien

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]


The attached patch kills the buffer of the file modified
during testing to prevent leaving the repo in a dirty state.

Thanks to Kyle for seeing this and providing guidance on how to
address.

Thanks,
Kevin


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-test-ob-tangle.el-Fix-dirty-repo-state-caused-by-tes.patch --]
[-- Type: text/x-patch, Size: 1635 bytes --]

From 46dd1cf3c34a372612e4a67a79afd84ca3317500 Mon Sep 17 00:00:00 2001
From: "Kevin J. Foley" <kevin@kevinjfoley.me>
Date: Tue, 26 May 2020 20:42:54 -0400
Subject: [PATCH] test-ob-tangle.el: Fix dirty repo state caused by testing

* testing/lisp/test-ob-tangle.el (ob-tangle/detangle-false-positive):
Kill modified buffer after test.

Another test is causing the modifications to be saved which leaves the
repo in a dirty state after testing.
---
 testing/lisp/test-ob-tangle.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index ed75e6ca4..bd2d99ca2 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -384,12 +384,14 @@ (ert-deftest ob-tangle/commented-src-blocks ()

 (ert-deftest ob-tangle/detangle-false-positive ()
   "Test handling of false positive link during detangle."
-  (org-test-in-example-file (expand-file-name "babel.el" org-test-example-dir)
-    (org-babel-detangle)
-    (org-test-at-id "73115FB0-6565-442B-BB95-50195A499EF4"
-    (org-babel-next-src-block)
-    (should (equal (string-trim (org-element-property :value (org-element-at-point)))
-		   ";; detangle changes")))))
+  (unwind-protect
+      (org-test-in-example-file (expand-file-name "babel.el" org-test-example-dir)
+	(org-babel-detangle)
+	(org-test-at-id "73115FB0-6565-442B-BB95-50195A499EF4"
+	  (org-babel-next-src-block)
+	  (should (equal (string-trim (org-element-property :value (org-element-at-point)))
+			 ";; detangle changes"))))
+    (kill-buffer "babel.org")))

 (provide 'test-ob-tangle)

--
2.19.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] test-ob-tangle.el: Fix dirty repo state caused by testing
  2020-05-27  0:47 [PATCH] test-ob-tangle.el: Fix dirty repo state caused by testing Kevin Foley
@ 2020-05-27  2:05 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2020-05-27  2:05 UTC (permalink / raw)
  To: Kevin Foley, emacs-orgmode; +Cc: Bastien

Kevin Foley writes:

> The attached patch kills the buffer of the file modified
> during testing to prevent leaving the repo in a dirty state.

Thanks.  I applied it in 7a2b785d6 with a small tweak so that a buffer
rather than a buffer name is passed to kill-buffer.  In the context of
the tests, the buffer name "babel.org" is very likely to be the one we
intend to kill, but I think it's better to use the actual buffer object.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-27  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  0:47 [PATCH] test-ob-tangle.el: Fix dirty repo state caused by testing Kevin Foley
2020-05-27  2:05 ` Kyle Meyer

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).