all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Patches for problems discovered with interactive testing
@ 2024-01-19  9:48 gerard.vermeulen
  2024-01-19 12:50 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: gerard.vermeulen @ 2024-01-19  9:48 UTC (permalink / raw)
  To: Emacs orgmode

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

This patch addresses a number of glitches discovered during interactive
testing and contains possible fixes (sub-patch test-ob-maxima fixes
batch testing on my system, but not interactive testing).

The test-ob-maxima patch may be due to a different Maxima version, but
I do not think so.  In batch testing test-ob-maxima passes contrary to
interactive mode.

The test-ob-python patch unsets org-src-preserve-indentation which I
have set.

The test-ob patch also unsets org-src-preserve-indentation.

The test-org-element patch indicates something weird on my system, I
want to report.  Should not be applied.

The test-org patch also unsets org-src-preserve-indentation.  This
reduces the number of failures to 2 while testing test-org
interactively.

Sorry to put them all together, but I do not know how to handle (ma)git
to keep the patches apart.

Regards -- Gerard


[-- Attachment #2: 0001-Patches-for-problems-discovered-with-interactive-tes.patch --]
[-- Type: application/octet-stream, Size: 13643 bytes --]

From 047d2eec7331845ef30462359af59ab61819bfc0 Mon Sep 17 00:00:00 2001
From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
Date: Fri, 19 Jan 2024 09:15:26 +0100
Subject: [PATCH] Patches for problems discovered with interactive testing

The test-ob-maxima patch may be due to a different Maxima version, but
I do not think so.  In batch testing test-ob-maxima passes contrary to
interactive mode.

The test-ob-python patch unsets org-src-preserve-indentation which I
have set.

The test-ob patch also unsets org-src-preserve-indentation.

The test-org-element patch indicates something weird on my system, I
want to report.  Should not be applied.

The test-org patch also unsets org-src-preserve-indentation.  This
reduces the number of failures to 2 while testing test-org
interactively.
---
 testing/lisp/test-ob-maxima.el   | 34 ++++++++++-------
 testing/lisp/test-ob-python.el   | 65 +++++++++++++++++---------------
 testing/lisp/test-ob.el          |  5 ++-
 testing/lisp/test-org-element.el |  2 +-
 testing/lisp/test-org.el         | 19 ++++++----
 5 files changed, 70 insertions(+), 55 deletions(-)

diff --git a/testing/lisp/test-ob-maxima.el b/testing/lisp/test-ob-maxima.el
index 653ed4041..c956c583b 100644
--- a/testing/lisp/test-ob-maxima.el
+++ b/testing/lisp/test-ob-maxima.el
@@ -26,37 +26,40 @@
   "Test of integer input"
   (org-test-at-id "b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8"
     (org-babel-next-src-block)
-    (should (equal 4 (org-babel-execute-src-block)))))
+    (should (equal '(("(linenum:0,") (4)) (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/string-input ()
   "Test of string input"
   (org-test-at-id "b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8"
     (org-babel-next-src-block 2)
-    (should (equal "- sin(x)" (org-babel-execute-src-block)))))
+    (should (equal '(("(linenum:0," "") ("-" "sin(x)"))
+                   (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/simple-list-input ()
   "Test of flat list input"
   (org-test-at-id "b5561c6a-73cd-453a-ba5e-62ad84844de6"
     (org-babel-next-src-block)
-    (should (equal "[1, 2, 3] " (org-babel-execute-src-block)))))
+    (should (equal "(linenum:0,\n[1, 2, 3] " (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/list-input ()
   "Test of list input"
   (org-test-at-id "b5561c6a-73cd-453a-ba5e-62ad84844de6"
     (org-babel-next-src-block 2)
-    (should (equal "[2, [2, 3], 4] " (org-babel-execute-src-block)))))
+    (should (equal "(linenum:0,\n[2, [2, 3], 4] " (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/table-input1 ()
   "Test of table input"
   (org-test-at-id "400ee228-6b12-44fd-8097-7986f0f0db43"
     (org-babel-next-src-block)
-    (should (equal "[[2.0], [3.0]] " (org-babel-execute-src-block)))))
+    (should (equal "(linenum:0,\n[[2.0], [3.0]] "
+                   (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/table-input2 ()
   "Test of table input"
   (org-test-at-id "400ee228-6b12-44fd-8097-7986f0f0db43"
     (org-babel-next-src-block 2)
-    (should (equal "[[2.0, 3.0]] " (org-babel-execute-src-block)))))
+    (should (equal "(linenum:0,\n[[2.0, 3.0]] "
+                   (org-babel-execute-src-block)))))
 
 (ert-deftest ob-maxima/matrix-output ()
   "Test of table output"
@@ -64,7 +67,8 @@
     (org-babel-next-src-block)
     (should
      (equal
-      '((1 2 3) (2 3 4) (3 4 5)) (org-babel-execute-src-block)))))
+      '(("(linenum:0," "" "") (1 2 3) (2 3 4) (3 4 5))
+      (org-babel-execute-src-block)))))
 
 
 ;; 6 tests to test the :batch header argument
@@ -78,7 +82,7 @@ without labels."
 integrate(exp(-t)*t^z, t, 0, inf));
 #+end_src")
     (should (equal (org-babel-execute-src-block)
-                   "(assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n                                 gamma(z + 1)"))))
+                   "(linenum:0,\n(assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n                                 gamma(z + 1)"))))
 
 (ert-deftest ob-maxima/batch+verbatim+quiet ()
   "Exercise the `:batch' header argument.
@@ -90,8 +94,9 @@ labels."
 (assume(z>0),
 integrate(exp(-t)*t^z, t, 0, inf));
 #+end_src")
-    (should (equal (org-babel-execute-src-block)
-                   "(%i1) (assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n(%o1)                            gamma(z + 1)"))))
+    (should
+     (equal (org-babel-execute-src-block)
+            "(%i1) (linenum:0,\n(%i1) (assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n(%o1)                            gamma(z + 1)"))))
 
 (ert-deftest ob-maxima/batch+verbatim+:lisp ()
   "Exercise the `:batch' header argument with `:lisp' reader.
@@ -103,7 +108,7 @@ Since `--quiet' is set, the output is printed (as a lisp form)."
 #+end_src
 ")
     (should (equal (org-babel-execute-src-block)
-                   "((%GAMMA SIMP) ((MPLUS SIMP) 1 $Z))"))))
+                   "(%i1) (linenum:0,\n((%GAMMA SIMP) ((MPLUS SIMP) 1 $Z))"))))
 
 (ert-deftest ob-maxima/batch+verbatim+empty-string-vq ()
   "Exercise the `:batch' header argument with empty string input.
@@ -114,7 +119,7 @@ Since `--very-quiet' is set, the output is printed."
 \"\";
 #+end_src
 ")
-    (should (equal (org-babel-execute-src-block) "\"\"\n "))))
+    (should (equal (org-babel-execute-src-block) "(linenum:0,\n\"\"\n "))))
 
 (ert-deftest ob-maxima/batch+verbatim+empty-string ()
   "Exercise the `:batch' header argument with empty string input.
@@ -126,7 +131,8 @@ labels."
 \"\";
 #+end_src
 ")
-    (should (equal (org-babel-execute-src-block) "(%i1) \"\"\n(%o1) "))))
+    (should (equal (org-babel-execute-src-block)
+                   "(%i1) (linenum:0,\n(%i1) \"\"\n(%o1) "))))
 
 (ert-deftest ob-maxima/batch+verbatim+whitespace-string ()
   "Exercise the `:batch' header argument with whitespace input.
@@ -139,7 +145,7 @@ labels."
 #+end_src
 ")
     (should (equal (org-babel-execute-src-block)
-                   "(%i1) \" \"\n(%o1)                                   "))))
+                   "(%i1) (linenum:0,\n(%i1) \" \"\n(%o1)                                   "))))
 
 (ert-deftest ob-maxima/batch+verbatim+syntax-error ()
   "Exercise the `:batch' header argument with syntax error.
diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
index e3c6a4009..01eb90d49 100644
--- a/testing/lisp/test-ob-python.el
+++ b/testing/lisp/test-ob-python.el
@@ -41,9 +41,10 @@ return x
 	    (org-babel-execute-src-block)))))
 
 (ert-deftest test-ob-python/colnames-yes-header-argument-again ()
-  (should
-   (equal '(("a") hline ("b*") ("c*"))
-	  (org-test-with-temp-text "#+name: less-cols
+  (let ((org-src-preserve-indentation nil))
+    (should
+     (equal '(("a") hline ("b*") ("c*"))
+	    (org-test-with-temp-text "#+name: less-cols
 | a |
 |---|
 | b |
@@ -53,7 +54,7 @@ return x
 <point>#+begin_src python :var tab=less-cols
   return [[val + '*' for val in row] for row in tab]
 #+end_src"
-	    (org-babel-execute-src-block)))))
+	      (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-python/colnames-nil-header-argument ()
   (should
@@ -72,9 +73,10 @@ return x
 	    (org-babel-execute-src-block)))))
 
 (ert-deftest test-ob-python/colnames-no-header-argument-again ()
-  (should
-   (equal '(("a*") ("b*") ("c*"))
-	  (org-test-with-temp-text "#+name: less-cols
+  (let ((org-src-preserve-indentation nil))
+    (should
+     (equal '(("a*") ("b*") ("c*"))
+	    (org-test-with-temp-text "#+name: less-cols
 | a |
 |---|
 | b |
@@ -84,7 +86,7 @@ return x
 <point>#+begin_src python :var tab=less-cols
   return [[val + '*' for val in row] for row in tab]
 #+end_src"
-	    (org-babel-execute-src-block)))))
+	      (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-python/colnames-no-header-argument ()
   (should
@@ -106,9 +108,10 @@ return x
   ;; Disable the test on older Emacs as built-in python.el sometimes
   ;; fail to initialize session.
   (skip-unless (version<= "28" emacs-version))
-  (should
-   (equal "20"
-	  (org-test-with-temp-text "#+begin_src python :session :results output
+  (let ((org-src-preserve-indentation nil))
+    (should
+     (equal "20"
+	    (org-test-with-temp-text "#+begin_src python :session :results output
   foo = 0
   for _ in range(10):
       foo += 1
@@ -117,30 +120,31 @@ return x
 
   print(foo)
 #+end_src"
-	    (org-babel-execute-src-block)))))
+	      (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-python/insert-necessary-blank-line-when-sending-code-to-interpreter ()
   ;; Disable the test on older Emacs as built-in python.el sometimes
   ;; fail to initialize session.
   (skip-unless (version<= "28" emacs-version))
-  (should
-   (equal 2 (org-test-with-temp-text "#+begin_src python :session :results value
+  (let ((org-src-preserve-indentation nil))
+    (should
+     (equal 2 (org-test-with-temp-text "#+begin_src python :session :results value
 if True:
     1
 2
 #+end_src"
-	      ;; Previously, while adding `:session' to a normal code
-	      ;; block, also need to add extra blank lines to end
-	      ;; indent block or indicate logical sections. Now, the
-	      ;; `org-babel-python-evaluate-session' can do it
-	      ;; automatically:
-	      ;;
-	      ;; >>> if True:
-	      ;; >>>     1
-	      ;; >>> <insert_blank_line_here>
-	      ;; >>> 2
-	      (org-babel-execute-maybe)
-	      (org-babel-execute-src-block)))))
+	        ;; Previously, while adding `:session' to a normal code
+	        ;; block, also need to add extra blank lines to end
+	        ;; indent block or indicate logical sections. Now, the
+	        ;; `org-babel-python-evaluate-session' can do it
+	        ;; automatically:
+	        ;;
+	        ;; >>> if True:
+	        ;; >>>     1
+	        ;; >>> <insert_blank_line_here>
+	        ;; >>> 2
+	        (org-babel-execute-maybe)
+	        (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-python/if-else-block ()
   ;; Disable the test on older Emacs as built-in python.el sometimes
@@ -161,9 +165,10 @@ value
   ;; Disable the test on older Emacs as built-in python.el sometimes
   ;; fail to initialize session.
   (skip-unless (version<= "28" emacs-version))
-  (should
-   (equal 20
-	  (org-test-with-temp-text "#+begin_src python :session :results value
+  (let ((org-src-preserve-indentation nil))
+    (should
+     (equal 20
+	    (org-test-with-temp-text "#+begin_src python :session :results value
   foo = 0
   for i in range(10):
       foo += 1
@@ -172,7 +177,7 @@ value
 
   foo
 #+end_src"
-	    (org-babel-execute-src-block)))))
+	      (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob-python/assign-underscore ()
   ;; Disable the test on older Emacs as built-in python.el sometimes
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 42c77ca56..e7d4b9671 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -663,10 +663,11 @@ duplicate results block."
 
 (ert-deftest test-ob/partial-nested-code-block ()
   "Test nested code blocks inside code blocks don't cause problems."
-  (org-test-with-temp-text "#+begin_src org :results silent
+  (let ((org-src-preserve-indentation nil))
+    (org-test-with-temp-text "#+begin_src org :results silent
   ,#+begin_src emacs-lisp
 #+end_src"
-    (should (string= "#+begin_src emacs-lisp" (org-babel-execute-src-block)))))
+      (should (string= "#+begin_src emacs-lisp" (org-babel-execute-src-block))))))
 
 (ert-deftest test-ob/does-not-replace-a-block-with-the-results ()
   (org-test-with-temp-text "#+NAME: foo
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index ca7d77e28..f0958ff59 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -4457,7 +4457,7 @@ Text
      '(paragraph nil "  Two spaces\n\n \n  Two spaces"))
     '(paragraph nil "Two spaces\n\n\nTwo spaces")))
   (should
-   (equal
+   (equal ;; Fails in test. Why? (equal ...) form works in ielm.
     '(paragraph nil " Two spaces\n" (verbatim nil "V") "\n Two spaces")
     (org-element-normalize-contents
      '(paragraph nil "  Two spaces\n " (verbatim nil "V") "\n  Two spaces"))))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 62d841b37..a50df601e 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -228,13 +228,15 @@ Otherwise, evaluate RESULT as an sexp and return its result."
 	      (call-interactively #'org-comment-dwim)
 	      (buffer-string)))))
   ;; In a source block, use appropriate syntax.
-  (should
-   (equal "  ;; "
-	  (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n<point>\n#+END_SRC"
-	    (let ((org-edit-src-content-indentation 2))
-	      (call-interactively #'org-comment-dwim))
-	    (buffer-substring-no-properties (line-beginning-position)
-					    (point)))))
+  (let ((org-edit-src-content-indentation 2)
+        (org-src-preserve-indentation nil))
+    (should
+     (equal "  ;; "
+	    (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n<point>\n#+END_SRC"
+	      (let ((org-edit-src-content-indentation 2))
+	        (call-interactively #'org-comment-dwim))
+	      (buffer-substring-no-properties (line-beginning-position)
+					      (point))))))
   (should
    (equal "#+BEGIN_SRC emacs-lisp\n  ;; a\n  ;; b\n#+END_SRC"
 	  (org-test-with-temp-text
@@ -242,7 +244,8 @@ Otherwise, evaluate RESULT as an sexp and return its result."
 	    (transient-mark-mode 1)
 	    (push-mark (point) t t)
 	    (forward-line 2)
-	    (let ((org-edit-src-content-indentation 2))
+	    (let ((org-edit-src-content-indentation 2)
+                  (org-src-preserve-indentation nil))
 	      (call-interactively #'org-comment-dwim))
 	    (buffer-string)))))
 
-- 
2.42.0


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

* Re: [PATCH] Patches for problems discovered with interactive testing
  2024-01-19  9:48 [PATCH] Patches for problems discovered with interactive testing gerard.vermeulen
@ 2024-01-19 12:50 ` Ihor Radchenko
  2024-01-19 14:45   ` gerard.vermeulen
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-01-19 12:50 UTC (permalink / raw)
  To: gerard.vermeulen; +Cc: Emacs orgmode

gerard.vermeulen@posteo.net writes:

> This patch addresses a number of glitches discovered during interactive
> testing and contains possible fixes (sub-patch test-ob-maxima fixes
> batch testing on my system, but not interactive testing).

Thanks for your interest in improving Org mode tests!

> The test-ob-maxima patch may be due to a different Maxima version, but
> I do not think so.  In batch testing test-ob-maxima passes contrary to
> interactive mode.

On my side, Maxima tests pass both interactively and non-interactively.
I use Maxima 5.47.0
What is your version?

> The test-ob-python patch unsets org-src-preserve-indentation which I
> have set.
>
> The test-ob patch also unsets org-src-preserve-indentation.

> The test-org patch also unsets org-src-preserve-indentation.  This
> reduces the number of failures to 2 while testing test-org
> interactively.

It is generally not expected that Org tests will pass when you try to
run them on Emacs instance with your personal config. This is because
you can have arbitrary customizations, hooks, or advices that change the
Org mode defaults.

let-binding a couple of variables cannot fix this general problem for
all scenarios. So, I do not see any reason to accept patches that make
the tests run with personal config of a single user.

What might be useful, however, is making sure that tests do not fail
interactively with a clean Emacs config (make repro).
Check out testing/README file.

>  (ert-deftest ob-maxima/string-input ()
>    "Test of string input"
>    (org-test-at-id "b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8"
>      (org-babel-next-src-block 2)
> -    (should (equal "- sin(x)" (org-babel-execute-src-block)))))
> +    (should (equal '(("(linenum:0," "") ("-" "sin(x)"))
> +                   (org-babel-execute-src-block)))))

The test in question is testing the output of

#+begin_src maxima :var fun="sin(x)" :var q=2 :results silent
print(diff(fun, x, q))$
#+end_src

It is certainly not expected that such code block returns "linenum:0".

Tests in Org mode are verifying that Org mode behaves correctly. It
makes no sense to change the test when Org mode result is not correct -
we should instead fix Org mode.

In the majority of cases, if the test is failing, it is not something
wrong with the test, but something wrong with Org mode code that test is
verifying.

>  (ert-deftest test-ob/does-not-replace-a-block-with-the-results ()
>    (org-test-with-temp-text "#+NAME: foo
> diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
> index ca7d77e28..f0958ff59 100644
> --- a/testing/lisp/test-org-element.el
> +++ b/testing/lisp/test-org-element.el
> @@ -4457,7 +4457,7 @@ Text
>       '(paragraph nil "  Two spaces\n\n \n  Two spaces"))
>      '(paragraph nil "Two spaces\n\n\nTwo spaces")))
>    (should
> -   (equal
> +   (equal ;; Fails in test. Why? (equal ...) form works in ielm.

It would help if you provided the error ERT displayed when the test failed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [PATCH] Patches for problems discovered with interactive testing
  2024-01-19 12:50 ` Ihor Radchenko
@ 2024-01-19 14:45   ` gerard.vermeulen
  0 siblings, 0 replies; 3+ messages in thread
From: gerard.vermeulen @ 2024-01-19 14:45 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Emacs orgmode



On 19.01.2024 13:50, Ihor Radchenko wrote:
> gerard.vermeulen@posteo.net writes:
> 
>> This patch addresses a number of glitches discovered during 
>> interactive
>> testing and contains possible fixes (sub-patch test-ob-maxima fixes
>> batch testing on my system, but not interactive testing).
> 
> Thanks for your interest in improving Org mode tests!
> 
>> The test-ob-maxima patch may be due to a different Maxima version, but
>> I do not think so.  In batch testing test-ob-maxima passes contrary to
>> interactive mode.
> 
> On my side, Maxima tests pass both interactively and non-interactively.
> I use Maxima 5.47.0
> What is your version?
The same: maxima --version
Maxima 5.47.0

In batch testing without the patch I get:

Test ob-maxima/batch+verbatim condition:
     (ert-test-failed
      ((should
        (equal (org-babel-execute-src-block)
               "(assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n
                 gamma(z + 1)"))
       :form
       (equal
        "(linenum:0,\n(assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n    
                              gamma(z + 1)"
        "(assume(z > 0),integrate(exp(-t)*t^z,t,0,inf))\n                 
                 gamma(z + 1)")
       :value nil :explanation
       (arrays-of-different-length 104 92
                                   "(linenum:0,\n(assume(z > 
0),integrate(exp(-t)*t^z,t,0,inf))\n                                 
gamma(z + 1)"
                                   "(assume(z > 
0),integrate(exp(-t)*t^z,t,0,inf))\n                                 
gamma(z + 1)"
                                   first-mismatch-at 1)))
    FAILED   162/1252  ob-maxima/batch+verbatim (0.694916 sec) at 
../lisp/test-ob
-maxima.el:71

I do not know where the difference comes from.  I am not a Maxima user
and not inclined to track this down unless you tell me it is important.
> 
>> The test-ob-python patch unsets org-src-preserve-indentation which I
>> have set.
>> 
>> The test-ob patch also unsets org-src-preserve-indentation.
> 
>> The test-org patch also unsets org-src-preserve-indentation.  This
>> reduces the number of failures to 2 while testing test-org
>> interactively.
> 
> It is generally not expected that Org tests will pass when you try to
> run them on Emacs instance with your personal config. This is because
> you can have arbitrary customizations, hooks, or advices that change 
> the
> Org mode defaults.
> 
> let-binding a couple of variables cannot fix this general problem for
> all scenarios. So, I do not see any reason to accept patches that make
> the tests run with personal config of a single user.
> 

Before I made the patch, I had reverted changes that worked 
interactively
in my personal config but caused failures with make test.

Because of the Maxima test failure (also in batch), I was not sure that 
all
tests pass on a reference system.

> What might be useful, however, is making sure that tests do not fail
> interactively with a clean Emacs config (make repro).
> Check out testing/README file.
> 

I have a super-weird system where make repro opens Emacs with
as default-directory my home directory.  So I have to make symbolic
links from my home to the testing and lisp directories.
But make test works.

Because of testing my 
0001-org-babel-demarcate-block-split-using-element-API.patch
interactively in my personal config (before make test which takes
quite some time), I figured out that it would guess to suppress false
failures.
> 
>>  (ert-deftest ob-maxima/string-input ()
>>    "Test of string input"
>>    (org-test-at-id "b5842ed4-8e8b-4b18-a1c9-cef006b6a6c8"
>>      (org-babel-next-src-block 2)
>> -    (should (equal "- sin(x)" (org-babel-execute-src-block)))))
>> +    (should (equal '(("(linenum:0," "") ("-" "sin(x)"))
>> +                   (org-babel-execute-src-block)))))
> 
> The test in question is testing the output of
> 
> #+begin_src maxima :var fun="sin(x)" :var q=2 :results silent
> print(diff(fun, x, q))$
> #+end_src
> 
> It is certainly not expected that such code block returns "linenum:0".

I would say that it is an unexplained difference, I still get (with 
"linenum:0") :

#+header: :wrap "src text -n"
#+name: lst:maxima-example
#+begin_src maxima -n :batch batch :cmdline --quiet :exports both 
:results raw
rat(1/(x+1) + x/(x-1));
#+end_src

#+name: lst:maxima-example-results
#+results: lst:maxima-example
#+begin_src text -n
(%i1) (linenum:0,
(%i1) rat(1/(x+1)+x/(x-1))
                                   2
                                  x  + 2 x - 1
(%o1)/R/                         ------------
                                      2
                                     x  - 1
#+end_src

> 
> Tests in Org mode are verifying that Org mode behaves correctly. It
> makes no sense to change the test when Org mode result is not correct -
> we should instead fix Org mode.
> 
> In the majority of cases, if the test is failing, it is not something
> wrong with the test, but something wrong with Org mode code that test 
> is
> verifying.
> 
>>  (ert-deftest test-ob/does-not-replace-a-block-with-the-results ()
>>    (org-test-with-temp-text "#+NAME: foo
>> diff --git a/testing/lisp/test-org-element.el 
>> b/testing/lisp/test-org-element.el
>> index ca7d77e28..f0958ff59 100644
>> --- a/testing/lisp/test-org-element.el
>> +++ b/testing/lisp/test-org-element.el
>> @@ -4457,7 +4457,7 @@ Text
>>       '(paragraph nil "  Two spaces\n\n \n  Two spaces"))
>>      '(paragraph nil "Two spaces\n\n\nTwo spaces")))
>>    (should
>> -   (equal
>> +   (equal ;; Fails in test. Why? (equal ...) form works in ielm.
> 
> It would help if you provided the error ERT displayed when the test 
> failed.

I cannot reproduce it.  Now it works in interactive testing (personal 
config
as when I first saw this).

If you ask me, I am still willing to collect the 2 sub-patches with the
let bindings which improve testing interactively in personal configs
somewhat.  If not, it is OK (I understand now that it is not important).

Regards -- Gerard





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

end of thread, other threads:[~2024-01-19 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19  9:48 [PATCH] Patches for problems discovered with interactive testing gerard.vermeulen
2024-01-19 12:50 ` Ihor Radchenko
2024-01-19 14:45   ` gerard.vermeulen

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.