[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix `org-babel-detangle' handling of false positives
From: |
Kevin Foley |
Subject: |
Re: [PATCH] Fix `org-babel-detangle' handling of false positives |
Date: |
Sun, 24 May 2020 14:14:45 -0400 |
Kyle Meyer <address@hidden> 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