From: Kevin Foley <kevin@kevinjfoley.me>
To: Kyle Meyer <kyle@kyleam.com>, Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix `org-babel-detangle' handling of false positives
Date: Sun, 24 May 2020 14:14:45 -0400 [thread overview]
Message-ID: <m2r1v9ci96.fsf@Kevins-MacBook-Pro.local.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87wo515mu6.fsf@kyleam.com>
Kyle Meyer <kyle@kyleam.com> writes:
> Kevin, could you look into updating the test to avoid changing the repo
> state?
Sorry about that. Do you have any suggestions on how to avoid changing
the state or any examples of similar tests?
I tried the following to replace the file with it's original contents
but it doesn't seem to be working as I intend. I also worry it's a
convoluted approach and there may be a simpler way.
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index ed75e6ca4..a91bd3446 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -384,12 +384,19 @@ (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")))))
+ (let* ((babel-org-file (expand-file-name "babel.org" org-test-example-dir))
+ (orig-file-buffer
+ (get-buffer-create " bable-org")))
+ (with-current-buffer orig-file-buffer (insert-file-contents babel-org-file))
+ (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"))))
+ (with-current-buffer orig-file-buffer
+ (kill-buffer (get-file-buffer babel-org-file))
+ (write-region (point-min) (point-max) babel-org-file))))
(provide 'test-ob-tangle)
Thanks,
Kevin
next prev parent reply other threads:[~2020-05-24 18:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 23:15 [PATCH] Fix `org-babel-detangle' handling of false positives Kevin Foley
2020-02-01 9:22 ` Bastien
2020-02-09 16:24 ` Kevin Foley
2020-02-10 6:22 ` Bastien
2020-05-22 14:37 ` Kevin Foley
2020-05-22 15:36 ` Bastien
2020-05-24 12:30 ` Kevin Foley
2020-05-24 13:46 ` Bastien
2020-05-24 16:17 ` Kyle Meyer
2020-05-24 18:14 ` Kevin Foley [this message]
2020-05-24 20:19 ` Kyle Meyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r1v9ci96.fsf@Kevins-MacBook-Pro.local.i-did-not-set--mail-host-address--so-tickle-me \
--to=kevin@kevinjfoley.me \
--cc=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=kyle@kyleam.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).