all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Failing tests
@ 2020-04-17 23:02 Marco Wahl
  2020-04-21  3:00 ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Wahl @ 2020-04-17 23:02 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

When building with "make test" I get

#v+
2 unexpected results:
   FAILED  ob-tangle/jump-to-org
   FAILED  test-org-attach/dir
#v-

does this ring a bell for anybody?


Best regards,
-- Marco



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

* Re: Failing tests
  2020-04-17 23:02 Failing tests Marco Wahl
@ 2020-04-21  3:00 ` Kyle Meyer
  2020-04-21  9:32   ` Marco Wahl
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2020-04-21  3:00 UTC (permalink / raw)
  To: Marco Wahl, emacs-orgmode

Marco Wahl <marcowahlsoft@gmail.com> writes:

> When building with "make test" I get
>
> #v+
> 2 unexpected results:
>    FAILED  ob-tangle/jump-to-org
>    FAILED  test-org-attach/dir
> #v-
>
> does this ring a bell for anybody?

FWIW I don't see either failure on my end (Emacs 26.3).  Do they fail
for you consistently?


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

* Re: Failing tests
  2020-04-21  3:00 ` Kyle Meyer
@ 2020-04-21  9:32   ` Marco Wahl
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Wahl @ 2020-04-21  9:32 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

> Marco Wahl <marcowahlsoft@gmail.com> writes:
>
>> When building with "make test" I get
>>
>> #v+
>> 2 unexpected results:
>>    FAILED  ob-tangle/jump-to-org
>>    FAILED  test-org-attach/dir
>> #v-
>>
>> does this ring a bell for anybody?
>
> FWIW I don't see either failure on my end (Emacs 26.3).  Do they fail
> for you consistently?

Good to know that the tests pass on your side.

I'll check again and report in the case I find something interesting.


Thanks!
-- Marco


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

* Re: Failing tests
  2020-05-29 12:41 ` Failing tests (was: Possible fix for :includes header argument in org-babel C source blocks) Kévin Le Gouguec
  2020-05-31  4:59   ` Kyle Meyer
@ 2020-06-01 13:54   ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2020-06-01 13:54 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: emacs-orgmode

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> Thanks for the pointer, and for applying the patches!
>
>>>>   FAILED  ob-tangle/jump-to-org
>>>>   FAILED  test-org-attach/dir

I have had both tests failing for a while without understanding why,
if this gets fixed as a side-effect of the incomplete fix I made for 
ob-C.el, I'd be very happy!

-- 
 Bastien


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

* Re: Failing tests
  2020-05-31  4:59   ` Kyle Meyer
@ 2020-06-01 14:48     ` Kévin Le Gouguec
  2020-06-01 14:56       ` Kévin Le Gouguec
  2020-06-03  4:20       ` Kyle Meyer
  0 siblings, 2 replies; 7+ messages in thread
From: Kévin Le Gouguec @ 2020-06-01 14:48 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, emacs-orgmode

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

Kyle Meyer <kyle@kyleam.com> writes:

>> I think I've narrowed this down to org-open-file running "less
>> examples/att1/fileA" instead of visiting this file.
> [...]
>> Let-binding org-file-apps to '(("." . emacs)) makes the tests pass, but
>> I don't know if that's the way we want to solve this.
>
> Thanks for looking into the failures.  Let-binding org-file-apps sounds
> like a good approach to me.  Rather than the catch-all regular
> expression, I believe the value could be ((t . emacs)).

Absolutely.  I've attached a patch to that effect.

I wonder though, shouldn't org-open-file always visit text/plain files?
Why would we ever want to send those to an external viewer?

I think this would need special-casing inside org-open-file, since I
don't see a way to catch all text/plain files with org-file-apps.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-tests-robust-with-respect-to-mailcap-entries.patch --]
[-- Type: text/x-diff, Size: 13127 bytes --]

From 05a71740c662fcde3fcfad7c07975052781ec589 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@gmail.com>
Date: Mon, 1 Jun 2020 16:07:44 +0200
Subject: [PATCH] Make tests robust with respect to mailcap entries

When /etc/mailcap specifies a program for text/plain
files (e.g. less(1)), org-open-file will run this program instead of
visiting the file.  This throws off some tests which expect
extension-less temporary files to be visited.

* testing/lisp/test-ob-tangle.el (ob-tangle/jump-to-org):
* testing/lisp/test-org-attach.el (test-org-attach/dir): Rig
org-file-apps so that temporary files are visited inside Emacs.
---
 testing/lisp/test-ob-tangle.el  | 121 +++++++++++++-------------
 testing/lisp/test-org-attach.el | 147 ++++++++++++++++----------------
 2 files changed, 135 insertions(+), 133 deletions(-)

diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 2283037fc..35490f538 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -125,23 +125,24 @@ echo 1
 (ert-deftest ob-tangle/jump-to-org ()
   "Test `org-babel-tangle-jump-to-org' specifications."
   ;; Standard test.
-  (should
-   (equal
-    "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
-    (org-test-with-temp-text-in-file
-        "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string))))))
-  ;; Multiple blocks in the same section.
-  (should
-   (equal
-    "2"
-    (org-test-with-temp-text-in-file
-        "* H
+  (let ((org-file-apps '((t . emacs))))
+    (should
+     (equal
+      "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
+      (org-test-with-temp-text-in-file
+          "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))
+    ;; Multiple blocks in the same section.
+    (should
+     (equal
+      "2"
+      (org-test-with-temp-text-in-file
+          "* H
 
 first block
 
@@ -155,49 +156,49 @@ another block
 2
 #+end_src
 "
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:2]]\n<point>2\n;; H:2 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-substring (line-beginning-position)
-                            (line-end-position)))))))
-  ;; Preserve position within the source code.
-  (should
-   (equal
-    "1)"
-    (org-test-with-temp-text-in-file
-        "* H\n#+begin_src emacs-lisp\n(+ 1 1)\n#+end_src"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n(+ 1 <point>1)\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-substring-no-properties (point) (line-end-position)))))))
-  ;; Blocks before first heading.
-  (should
-   (equal
-    "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-    (org-test-with-temp-text-in-file
-        "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string))))))
-  ;; Special case: buffer starts with a source block.
-  (should
-   (equal
-    "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-    (org-test-with-temp-text-in-file
-        "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string)))))))
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:2]]\n<point>2\n;; H:2 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-substring (line-beginning-position)
+                              (line-end-position)))))))
+    ;; Preserve position within the source code.
+    (should
+     (equal
+      "1)"
+      (org-test-with-temp-text-in-file
+          "* H\n#+begin_src emacs-lisp\n(+ 1 1)\n#+end_src"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n(+ 1 <point>1)\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-substring-no-properties (point) (line-end-position)))))))
+    ;; Blocks before first heading.
+    (should
+     (equal
+      "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+      (org-test-with-temp-text-in-file
+          "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))
+    ;; Special case: buffer starts with a source block.
+    (should
+     (equal
+      "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+      (org-test-with-temp-text-in-file
+          "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))))
 
 (ert-deftest ob-tangle/nested-block ()
   "Test tangling of org file with nested block."
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
index f910526c2..168e5d56f 100644
--- a/testing/lisp/test-org-attach.el
+++ b/testing/lisp/test-org-attach.el
@@ -30,80 +30,81 @@
 
 (ert-deftest test-org-attach/dir ()
   "Test `org-attach-get' specifications."
-  (should (equal "Text in fileA\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 157) ;; First attachment link
-		   (org-open-at-point)
-		   (buffer-string))))
-  (should-not (equal "Text in fileB\n"
-		     (org-test-in-example-file org-test-attachments-file
-		       (goto-char 219) ;; Second attachment link
-		       (let ((org-attach-use-inheritance nil))
-			 (org-open-at-point)
-			 (buffer-string)))))
-  (should (equal "Text in fileB\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 219) ;; Second attachment link
-		   (let ((org-attach-use-inheritance t))
+  (let ((org-file-apps '((t . emacs))))
+    (should (equal "Text in fileA\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 157) ;; First attachment link
 		     (org-open-at-point)
-		     (buffer-string)))))
-  (should-not (equal "att1"
-		     (org-test-in-example-file org-test-attachments-file
-		       (goto-char 179) ;; H1.1
-		       (let ((org-attach-use-inheritance nil))
-			 (org-attach-dir)))))
-  (should (equal "att1"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 179) ;; H1.1
-		   (let ((org-attach-use-inheritance t))
-		     (org-attach-dir)))))
-  (should (equal '("fileC" "fileD")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 239) ;; H1.2
-		   (org-attach-file-list (org-attach-dir)))))
-  (should (equal '("fileC" "fileD")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 239) ;; H1.2
-		   (org-attach-file-list (org-attach-dir)))))
-  (should (equal '("fileE")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 289) ;; H2
-		   (let ((org-attach-id-dir "data/"))
-		     (org-attach-file-list (org-attach-dir))))))
-  (should (equal "peek-a-boo\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 289) ;; H2
-		   (let ((org-attach-id-dir "data/"))
-		     (org-attach-open-in-emacs)
-		     (buffer-string)))))
-  (should (equal  '("fileA" "fileB")
-		  (org-test-in-example-file org-test-attachments-file
-		    (goto-char 336) ;; H3
-		    (org-attach-file-list (org-attach-dir)))))
-  ;; Test for folder not initialized in the filesystem
-  (should-not (org-test-in-example-file org-test-attachments-file
-		(goto-char 401) ;; H3.1
-		(let ((org-attach-use-inheritance nil)
-		      (org-attach-id-dir "data/"))
-		  (org-attach-dir))))
-  ;; Not yet initialized folder should be found if no-fs-check is
-  ;; non-nil
-  (should (equal "data/ab/cd12345"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 401) ;; H3.1
-		   (let ((org-attach-use-inheritance nil)
-			 (org-attach-id-dir "data/"))
-		     (file-relative-name (org-attach-dir nil t))))))
-  (should (equal '("fileA" "fileB")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 401) ;; H3.1
-		   (let ((org-attach-use-inheritance t))
-		     ;; This is where it gets a bit sketchy...! DIR always has
-		     ;; priority over ID, even if ID is declared "higher up" in the
-		     ;; tree.  This can potentially be revised.  But it is also
-		     ;; pretty clean.  DIR is always higher in priority than ID right
-		     ;; now, no matter the depth in the tree.
-		     (org-attach-file-list (org-attach-dir)))))))
+		     (buffer-string))))
+    (should-not (equal "Text in fileB\n"
+		       (org-test-in-example-file org-test-attachments-file
+			 (goto-char 219) ;; Second attachment link
+			 (let ((org-attach-use-inheritance nil))
+			   (org-open-at-point)
+			   (buffer-string)))))
+    (should (equal "Text in fileB\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 219) ;; Second attachment link
+		     (let ((org-attach-use-inheritance t))
+		       (org-open-at-point)
+		       (buffer-string)))))
+    (should-not (equal "att1"
+		       (org-test-in-example-file org-test-attachments-file
+			 (goto-char 179) ;; H1.1
+			 (let ((org-attach-use-inheritance nil))
+			   (org-attach-dir)))))
+    (should (equal "att1"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 179) ;; H1.1
+		     (let ((org-attach-use-inheritance t))
+		       (org-attach-dir)))))
+    (should (equal '("fileC" "fileD")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 239) ;; H1.2
+		     (org-attach-file-list (org-attach-dir)))))
+    (should (equal '("fileC" "fileD")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 239) ;; H1.2
+		     (org-attach-file-list (org-attach-dir)))))
+    (should (equal '("fileE")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 289) ;; H2
+		     (let ((org-attach-id-dir "data/"))
+		       (org-attach-file-list (org-attach-dir))))))
+    (should (equal "peek-a-boo\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 289) ;; H2
+		     (let ((org-attach-id-dir "data/"))
+		       (org-attach-open-in-emacs)
+		       (buffer-string)))))
+    (should (equal  '("fileA" "fileB")
+		    (org-test-in-example-file org-test-attachments-file
+		      (goto-char 336) ;; H3
+		      (org-attach-file-list (org-attach-dir)))))
+    ;; Test for folder not initialized in the filesystem
+    (should-not (org-test-in-example-file org-test-attachments-file
+		  (goto-char 401) ;; H3.1
+		  (let ((org-attach-use-inheritance nil)
+			(org-attach-id-dir "data/"))
+		    (org-attach-dir))))
+    ;; Not yet initialized folder should be found if no-fs-check is
+    ;; non-nil
+    (should (equal "data/ab/cd12345"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 401) ;; H3.1
+		     (let ((org-attach-use-inheritance nil)
+			   (org-attach-id-dir "data/"))
+		       (file-relative-name (org-attach-dir nil t))))))
+    (should (equal '("fileA" "fileB")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 401) ;; H3.1
+		     (let ((org-attach-use-inheritance t))
+		       ;; This is where it gets a bit sketchy...! DIR always has
+		       ;; priority over ID, even if ID is declared "higher up" in the
+		       ;; tree.  This can potentially be revised.  But it is also
+		       ;; pretty clean.  DIR is always higher in priority than ID right
+		       ;; now, no matter the depth in the tree.
+		       (org-attach-file-list (org-attach-dir))))))))
 
 (ert-deftest test-org-attach/dired-attach-to-next-best-subtree/1 ()
   "Attach file at point in dired to subtree."
-- 
2.17.1


[-- Attachment #3: Type: text/plain, Size: 111 bytes --]


The diff looks big, but most of it is just re-indentation.  Here is the
signal beneath the whitespace noise:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: clean.diff --]
[-- Type: text/x-diff, Size: 1687 bytes --]

diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 2283037fc..35490f538 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -125,6 +125,7 @@
 (ert-deftest ob-tangle/jump-to-org ()
   "Test `org-babel-tangle-jump-to-org' specifications."
   ;; Standard test.
+  (let ((org-file-apps '((t . emacs))))
   (should
    (equal
     "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
@@ -197,7 +197,7 @@
             (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
                     (file-name-nondirectory file))
           (org-babel-tangle-jump-to-org)
-          (buffer-string)))))))
+            (buffer-string))))))))
 
 (ert-deftest ob-tangle/nested-block ()
   "Test tangling of org file with nested block."
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
index f910526c2..168e5d56f 100644
--- a/testing/lisp/test-org-attach.el
+++ b/testing/lisp/test-org-attach.el
@@ -30,6 +30,7 @@
 
 (ert-deftest test-org-attach/dir ()
   "Test `org-attach-get' specifications."
+  (let ((org-file-apps '((t . emacs))))
   (should (equal "Text in fileA\n"
 		 (org-test-in-example-file org-test-attachments-file
 		   (goto-char 157) ;; First attachment link
@@ -103,7 +104,7 @@
 		     ;; tree.  This can potentially be revised.  But it is also
 		     ;; pretty clean.  DIR is always higher in priority than ID right
 		     ;; now, no matter the depth in the tree.
-		     (org-attach-file-list (org-attach-dir)))))))
+		       (org-attach-file-list (org-attach-dir))))))))
 
 (ert-deftest test-org-attach/dired-attach-to-next-best-subtree/1 ()
   "Attach file at point in dired to subtree."

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

* Re: Failing tests
  2020-06-01 14:48     ` Failing tests Kévin Le Gouguec
@ 2020-06-01 14:56       ` Kévin Le Gouguec
  2020-06-03  4:20       ` Kyle Meyer
  1 sibling, 0 replies; 7+ messages in thread
From: Kévin Le Gouguec @ 2020-06-01 14:56 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, emacs-orgmode

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

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> Absolutely.  I've attached a patch to that effect.

I just realized that these let-bindings probably deserved explanatory
comments.  Here is an updated patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-tests-robust-with-respect-to-mailcap-entries.patch --]
[-- Type: text/x-diff, Size: 13274 bytes --]

From f996ec3a10a845abae2fa463ab0ea7a761af1707 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <kevin.legouguec@gmail.com>
Date: Mon, 1 Jun 2020 16:07:44 +0200
Subject: [PATCH] Make tests robust with respect to mailcap entries

When /etc/mailcap specifies a program for text/plain
files (e.g. less(1)), org-open-file will run this program instead of
visiting the file.  This throws off some tests which expect
extension-less temporary files to be visited.

* testing/lisp/test-ob-tangle.el (ob-tangle/jump-to-org):
* testing/lisp/test-org-attach.el (test-org-attach/dir): Rig
org-file-apps so that temporary files are visited inside Emacs.
---
 testing/lisp/test-ob-tangle.el  | 124 +++++++++++++-------------
 testing/lisp/test-org-attach.el | 148 ++++++++++++++++----------------
 2 files changed, 138 insertions(+), 134 deletions(-)

diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 2283037fc..7b1f617ed 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -124,24 +124,26 @@ echo 1
 
 (ert-deftest ob-tangle/jump-to-org ()
   "Test `org-babel-tangle-jump-to-org' specifications."
-  ;; Standard test.
-  (should
-   (equal
-    "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
-    (org-test-with-temp-text-in-file
-        "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string))))))
-  ;; Multiple blocks in the same section.
-  (should
-   (equal
-    "2"
-    (org-test-with-temp-text-in-file
-        "* H
+  ;; Make sure temporary files will be visited inside Emacs.
+  (let ((org-file-apps '((t . emacs))))
+    ;; Standard test.
+    (should
+     (equal
+      "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
+      (org-test-with-temp-text-in-file
+          "* H\n#+begin_src emacs-lisp\n1\n#+end_src"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))
+    ;; Multiple blocks in the same section.
+    (should
+     (equal
+      "2"
+      (org-test-with-temp-text-in-file
+          "* H
 
 first block
 
@@ -155,49 +157,49 @@ another block
 2
 #+end_src
 "
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:2]]\n<point>2\n;; H:2 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-substring (line-beginning-position)
-                            (line-end-position)))))))
-  ;; Preserve position within the source code.
-  (should
-   (equal
-    "1)"
-    (org-test-with-temp-text-in-file
-        "* H\n#+begin_src emacs-lisp\n(+ 1 1)\n#+end_src"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n(+ 1 <point>1)\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-substring-no-properties (point) (line-end-position)))))))
-  ;; Blocks before first heading.
-  (should
-   (equal
-    "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-    (org-test-with-temp-text-in-file
-        "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string))))))
-  ;; Special case: buffer starts with a source block.
-  (should
-   (equal
-    "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-    (org-test-with-temp-text-in-file
-        "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
-      (let ((file (buffer-file-name)))
-        (org-test-with-temp-text
-            (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
-                    (file-name-nondirectory file))
-          (org-babel-tangle-jump-to-org)
-          (buffer-string)))))))
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:2]]\n<point>2\n;; H:2 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-substring (line-beginning-position)
+                              (line-end-position)))))))
+    ;; Preserve position within the source code.
+    (should
+     (equal
+      "1)"
+      (org-test-with-temp-text-in-file
+          "* H\n#+begin_src emacs-lisp\n(+ 1 1)\n#+end_src"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n(+ 1 <point>1)\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-substring-no-properties (point) (line-end-position)))))))
+    ;; Blocks before first heading.
+    (should
+     (equal
+      "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+      (org-test-with-temp-text-in-file
+          "Buffer start\n#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))
+    ;; Special case: buffer starts with a source block.
+    (should
+     (equal
+      "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+      (org-test-with-temp-text-in-file
+          "#+begin_src emacs-lisp\n1\n#+end_src\n* H"
+	(let ((file (buffer-file-name)))
+          (org-test-with-temp-text
+              (format ";; [[file:%s][H:1]]\n<point>1\n;; H:1 ends here\n"
+                      (file-name-nondirectory file))
+            (org-babel-tangle-jump-to-org)
+            (buffer-string))))))))
 
 (ert-deftest ob-tangle/nested-block ()
   "Test tangling of org file with nested block."
diff --git a/testing/lisp/test-org-attach.el b/testing/lisp/test-org-attach.el
index f910526c2..cdd1afb3d 100644
--- a/testing/lisp/test-org-attach.el
+++ b/testing/lisp/test-org-attach.el
@@ -30,80 +30,82 @@
 
 (ert-deftest test-org-attach/dir ()
   "Test `org-attach-get' specifications."
-  (should (equal "Text in fileA\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 157) ;; First attachment link
-		   (org-open-at-point)
-		   (buffer-string))))
-  (should-not (equal "Text in fileB\n"
-		     (org-test-in-example-file org-test-attachments-file
-		       (goto-char 219) ;; Second attachment link
-		       (let ((org-attach-use-inheritance nil))
-			 (org-open-at-point)
-			 (buffer-string)))))
-  (should (equal "Text in fileB\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 219) ;; Second attachment link
-		   (let ((org-attach-use-inheritance t))
+  ;; Make sure example files will be visited inside Emacs.
+  (let ((org-file-apps '((t . emacs))))
+    (should (equal "Text in fileA\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 157) ;; First attachment link
 		     (org-open-at-point)
-		     (buffer-string)))))
-  (should-not (equal "att1"
-		     (org-test-in-example-file org-test-attachments-file
-		       (goto-char 179) ;; H1.1
-		       (let ((org-attach-use-inheritance nil))
-			 (org-attach-dir)))))
-  (should (equal "att1"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 179) ;; H1.1
-		   (let ((org-attach-use-inheritance t))
-		     (org-attach-dir)))))
-  (should (equal '("fileC" "fileD")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 239) ;; H1.2
-		   (org-attach-file-list (org-attach-dir)))))
-  (should (equal '("fileC" "fileD")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 239) ;; H1.2
-		   (org-attach-file-list (org-attach-dir)))))
-  (should (equal '("fileE")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 289) ;; H2
-		   (let ((org-attach-id-dir "data/"))
-		     (org-attach-file-list (org-attach-dir))))))
-  (should (equal "peek-a-boo\n"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 289) ;; H2
-		   (let ((org-attach-id-dir "data/"))
-		     (org-attach-open-in-emacs)
-		     (buffer-string)))))
-  (should (equal  '("fileA" "fileB")
-		  (org-test-in-example-file org-test-attachments-file
-		    (goto-char 336) ;; H3
-		    (org-attach-file-list (org-attach-dir)))))
-  ;; Test for folder not initialized in the filesystem
-  (should-not (org-test-in-example-file org-test-attachments-file
-		(goto-char 401) ;; H3.1
-		(let ((org-attach-use-inheritance nil)
-		      (org-attach-id-dir "data/"))
-		  (org-attach-dir))))
-  ;; Not yet initialized folder should be found if no-fs-check is
-  ;; non-nil
-  (should (equal "data/ab/cd12345"
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 401) ;; H3.1
-		   (let ((org-attach-use-inheritance nil)
-			 (org-attach-id-dir "data/"))
-		     (file-relative-name (org-attach-dir nil t))))))
-  (should (equal '("fileA" "fileB")
-		 (org-test-in-example-file org-test-attachments-file
-		   (goto-char 401) ;; H3.1
-		   (let ((org-attach-use-inheritance t))
-		     ;; This is where it gets a bit sketchy...! DIR always has
-		     ;; priority over ID, even if ID is declared "higher up" in the
-		     ;; tree.  This can potentially be revised.  But it is also
-		     ;; pretty clean.  DIR is always higher in priority than ID right
-		     ;; now, no matter the depth in the tree.
-		     (org-attach-file-list (org-attach-dir)))))))
+		     (buffer-string))))
+    (should-not (equal "Text in fileB\n"
+		       (org-test-in-example-file org-test-attachments-file
+			 (goto-char 219) ;; Second attachment link
+			 (let ((org-attach-use-inheritance nil))
+			   (org-open-at-point)
+			   (buffer-string)))))
+    (should (equal "Text in fileB\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 219) ;; Second attachment link
+		     (let ((org-attach-use-inheritance t))
+		       (org-open-at-point)
+		       (buffer-string)))))
+    (should-not (equal "att1"
+		       (org-test-in-example-file org-test-attachments-file
+			 (goto-char 179) ;; H1.1
+			 (let ((org-attach-use-inheritance nil))
+			   (org-attach-dir)))))
+    (should (equal "att1"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 179) ;; H1.1
+		     (let ((org-attach-use-inheritance t))
+		       (org-attach-dir)))))
+    (should (equal '("fileC" "fileD")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 239) ;; H1.2
+		     (org-attach-file-list (org-attach-dir)))))
+    (should (equal '("fileC" "fileD")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 239) ;; H1.2
+		     (org-attach-file-list (org-attach-dir)))))
+    (should (equal '("fileE")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 289) ;; H2
+		     (let ((org-attach-id-dir "data/"))
+		       (org-attach-file-list (org-attach-dir))))))
+    (should (equal "peek-a-boo\n"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 289) ;; H2
+		     (let ((org-attach-id-dir "data/"))
+		       (org-attach-open-in-emacs)
+		       (buffer-string)))))
+    (should (equal  '("fileA" "fileB")
+		    (org-test-in-example-file org-test-attachments-file
+		      (goto-char 336) ;; H3
+		      (org-attach-file-list (org-attach-dir)))))
+    ;; Test for folder not initialized in the filesystem
+    (should-not (org-test-in-example-file org-test-attachments-file
+		  (goto-char 401) ;; H3.1
+		  (let ((org-attach-use-inheritance nil)
+			(org-attach-id-dir "data/"))
+		    (org-attach-dir))))
+    ;; Not yet initialized folder should be found if no-fs-check is
+    ;; non-nil
+    (should (equal "data/ab/cd12345"
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 401) ;; H3.1
+		     (let ((org-attach-use-inheritance nil)
+			   (org-attach-id-dir "data/"))
+		       (file-relative-name (org-attach-dir nil t))))))
+    (should (equal '("fileA" "fileB")
+		   (org-test-in-example-file org-test-attachments-file
+		     (goto-char 401) ;; H3.1
+		     (let ((org-attach-use-inheritance t))
+		       ;; This is where it gets a bit sketchy...! DIR always has
+		       ;; priority over ID, even if ID is declared "higher up" in the
+		       ;; tree.  This can potentially be revised.  But it is also
+		       ;; pretty clean.  DIR is always higher in priority than ID right
+		       ;; now, no matter the depth in the tree.
+		       (org-attach-file-list (org-attach-dir))))))))
 
 (ert-deftest test-org-attach/dired-attach-to-next-best-subtree/1 ()
   "Attach file at point in dired to subtree."
-- 
2.17.1


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

* Re: Failing tests
  2020-06-01 14:48     ` Failing tests Kévin Le Gouguec
  2020-06-01 14:56       ` Kévin Le Gouguec
@ 2020-06-03  4:20       ` Kyle Meyer
  1 sibling, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2020-06-03  4:20 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: Bastien, emacs-orgmode

Kévin Le Gouguec writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>>> I think I've narrowed this down to org-open-file running "less
>>> examples/att1/fileA" instead of visiting this file.
>> [...]
>>> Let-binding org-file-apps to '(("." . emacs)) makes the tests pass, but
>>> I don't know if that's the way we want to solve this.
>>
>> Thanks for looking into the failures.  Let-binding org-file-apps sounds
>> like a good approach to me.  Rather than the catch-all regular
>> expression, I believe the value could be ((t . emacs)).
>
> Absolutely.  I've attached a patch to that effect.

Thanks.  Applied (c8f7e89d7).

> I wonder though, shouldn't org-open-file always visit text/plain files?
> Why would we ever want to send those to an external viewer?
>
> I think this would need special-casing inside org-open-file, since I
> don't see a way to catch all text/plain files with org-file-apps.

Good question.  I'm not sure, though offhand I can't think of cases
where I'd want to send text/plain files to an external viewer.  I'd
guess this doesn't matter much in practice given the default position of

  (auto-mode . emacs)

in org-file-apps, which will catch a good number of text/plain files.


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

end of thread, other threads:[~2020-06-03  4:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-17 23:02 Failing tests Marco Wahl
2020-04-21  3:00 ` Kyle Meyer
2020-04-21  9:32   ` Marco Wahl
  -- strict thread matches above, loose matches on Subject: below --
2020-05-29  2:47 Possible fix for :includes header argument in org-babel C source blocks Kyle Meyer
2020-05-29 12:41 ` Failing tests (was: Possible fix for :includes header argument in org-babel C source blocks) Kévin Le Gouguec
2020-05-31  4:59   ` Kyle Meyer
2020-06-01 14:48     ` Failing tests Kévin Le Gouguec
2020-06-01 14:56       ` Kévin Le Gouguec
2020-06-03  4:20       ` Kyle Meyer
2020-06-01 13:54   ` Bastien

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.