From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix test example in testing/README
Date: Fri, 3 Jan 2025 13:30:42 +0100 [thread overview]
Message-ID: <CALn3zog0=Ljn-u0dAzb+L0LeCS1Mju6At4eskG_wXHBBM9ebnw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 73 bytes --]
Hi all
Patch attached. My copyright assignment is still valid.
Michael
[-- Attachment #2: 0001-Adapt-formatting-of-testing-README.patch --]
[-- Type: application/octet-stream, Size: 5447 bytes --]
From 89c6ff9e1e7b1273b927ecf15d02472584424b92 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Fri, 3 Jan 2025 13:21:58 +0100
Subject: [PATCH 1/2] Adapt formatting of testing/README
* testing/README: Adapt formatting of source blocks to d87148057e and
c04e357f3d (9632401dc6).
---
testing/README | 82 +++++++++++++++++++++++++-------------------------
1 file changed, 41 insertions(+), 41 deletions(-)
diff --git a/testing/README b/testing/README
index 2469d1458..99cb488ba 100644
--- a/testing/README
+++ b/testing/README
@@ -17,16 +17,16 @@ relative to the base of the Org mode directory.
Also note that many of the current tests uses babel evaluation...
-#+BEGIN_SRC sh :dir (expand-file-name "..")
- # For Emacs earlier than 24, add -L /path/to/ert
- emacs -Q --batch \
- -L lisp/ -L testing/ -L testing/lisp -l lisp/org.el \
- -l lisp/org-id.el -l testing/org-test.el \
- --eval "(progn (org-reload) (setq org-confirm-babel-evaluate nil) \
- (org-babel-do-load-languages 'org-babel-load-languages \
- '((emacs-lisp . t) (shell . t) (org . t))))" \
- -f org-test-run-batch-tests
-#+END_SRC
+#+begin_src sh :dir (expand-file-name "..")
+# For Emacs earlier than 24, add -L /path/to/ert
+emacs -Q --batch \
+ -L lisp/ -L testing/ -L testing/lisp -l lisp/org.el \
+ -l lisp/org-id.el -l testing/org-test.el \
+ --eval "(progn (org-reload) (setq org-confirm-babel-evaluate nil) \
+ (org-babel-do-load-languages 'org-babel-load-languages \
+ '((emacs-lisp . t) (shell . t) (org . t))))" \
+ -f org-test-run-batch-tests
+#+end_src
The options in the above command are explained below.
@@ -43,9 +43,9 @@ The options in the above command are explained below.
Target ~test~ can be used to trigger a test run. The tests start
after cleaning up and recompilation.
-#+BEGIN_SRC sh :dir (expand-file-name "..") :results silent
+#+begin_src sh :dir (expand-file-name "..") :results silent
make test
-#+END_SRC
+#+end_src
See ../mk/default.mk for details.
@@ -58,9 +58,9 @@ weird errors due to the unclean build.
The dirty target for testing is called ~test-dirty~.
-#+BEGIN_SRC sh :dir (expand-file-name "..") :results silent
+#+begin_src sh :dir (expand-file-name "..") :results silent
make test-dirty
-#+END_SRC
+#+end_src
** Select tests by regexp
@@ -92,40 +92,40 @@ To run the Org mode test suite from a current Emacs instance simply
load and run the test suite with the following commands.
1) First load the test suite.
- #+BEGIN_SRC emacs-lisp :var here=(buffer-file-name)
- (add-to-list 'load-path (file-name-directory here))
- (require 'org-test)
- #+END_SRC
+ #+begin_src emacs-lisp :var here=(buffer-file-name)
+ (add-to-list 'load-path (file-name-directory here))
+ (require 'org-test)
+ #+end_src
2) Load required Babel languages
- #+BEGIN_SRC emacs-lisp
- (org-babel-do-load-languages
- 'org-babel-load-languages
- (and
- (mapc (lambda (lang) (add-to-list 'org-babel-load-languages (cons lang t)))
- '(emacs-lisp shell org))
- org-babel-load-languages))
- #+END_SRC
+ #+begin_src emacs-lisp
+ (org-babel-do-load-languages
+ 'org-babel-load-languages
+ (and (mapc (lambda (lang)
+ (add-to-list 'org-babel-load-languages (cons lang t)))
+ '(emacs-lisp shell org))
+ org-babel-load-languages))
+ #+end_src
3) Then run the test suite. Babel evaluation confirmation is disabled
and ~C-c C-c~ is enabled while running the tests.
- #+BEGIN_SRC emacs-lisp
- (let (org-babel-no-eval-on-ctrl-c-ctrl-c
- org-confirm-babel-evaluate)
- (org-test-run-all-tests))
- #+END_SRC
+ #+begin_src emacs-lisp
+ (let (org-babel-no-eval-on-ctrl-c-ctrl-c
+ org-confirm-babel-evaluate)
+ (org-test-run-all-tests))
+ #+end_src
When a test fails, run it interactively and investigate the problem
in the ERT results buffer.
To run one test: Use this as a demo example of a failing test
- #+BEGIN_SRC emacs-lisp
- (ert-deftest test-org/org-link-encode-ascii-character-demo-of-fail ()
- (should (string= "%5B" ; Expecting %5B is correct.
- (org-link-encode "[")))
- (should (string= "%5C" ; Expecting %5C is wrong, %5D correct.
- (org-link-encode "]"))))
- #+END_SRC
+ #+begin_src emacs-lisp
+ (ert-deftest test-org/org-link-encode-ascii-character-demo-of-fail ()
+ (should (string= "%5B" ; Expecting %5B is correct.
+ (org-link-encode "[")))
+ (should (string= "%5C" ; Expecting %5C is wrong, %5D correct.
+ (org-link-encode "]"))))
+ #+end_src
or evaluate the ~ert-deftest form~ of the test you want to run.
Then ~M-x ert RET
test-org/org-link-encode-ascii-character-demo-of-fail RET~. When
@@ -141,9 +141,9 @@ load and run the test suite with the following commands.
M-x ert RET t RET~.
Consider to set
- #+BEGIN_SRC emacs-lisp
- (setq pp-escape-newlines nil)
- #+END_SRC
+ #+begin_src emacs-lisp
+ (setq pp-escape-newlines nil)
+ #+end_src
before running the test when looking at ~should~ in the ERT results
buffer. Especially when using ~l~ to look at passed test results
and possibly missing an appropriate setting of ~pp-escape-newlines~
--
2.39.3 (Apple Git-145)
[-- Attachment #3: 0002-Fix-test-example-in-testing-README.patch --]
[-- Type: application/octet-stream, Size: 1958 bytes --]
From b4848f9dd8f00b8559521dcf013577c6b4c69afc Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Fri, 3 Jan 2025 13:22:01 +0100
Subject: [PATCH 2/2] Fix test example in testing/README
* testing/README (Interactive testing from within Emacs): Fix test
example not adapted in 2b00d62816.
---
testing/README | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/testing/README b/testing/README
index 99cb488ba..1c4dd9e76 100644
--- a/testing/README
+++ b/testing/README
@@ -120,19 +120,16 @@ load and run the test suite with the following commands.
To run one test: Use this as a demo example of a failing test
#+begin_src emacs-lisp
- (ert-deftest test-org/org-link-encode-ascii-character-demo-of-fail ()
- (should (string= "%5B" ; Expecting %5B is correct.
- (org-link-encode "[")))
- (should (string= "%5C" ; Expecting %5C is wrong, %5D correct.
- (org-link-encode "]"))))
+ (ert-deftest test-demo/example-of-a-failing-test ()
+ (should (string= "AB" (concat "A" "B")))
+ (should (string= "CD" (concat "C" "C" "D"))))
#+end_src
- or evaluate the ~ert-deftest form~ of the test you want to run.
- Then ~M-x ert RET
- test-org/org-link-encode-ascii-character-demo-of-fail RET~. When
+ or evaluate the ~ert-deftest~ form of the test you want to run.
+ Then ~M-x ert RET test-demo/example-of-a-failing-test RET~. When
not visible yet switch to the ERT results buffer named ~*ert*~.
When a test failed the ERT results buffer shows the details of the
- first ~should~ that failed. See ~(info "(ert)Running Tests
- Interactively")~ on how to re-run, start the debugger etc.
+ first ~should~ that failed. See [[info:ert::Running Tests
+ Interactively]] for how to re-run, start the debugger etc.
To run several tests: ~M-x ert RET "<your regexp here>" RET~.
--
2.39.3 (Apple Git-145)
next reply other threads:[~2025-01-03 12:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 12:30 Michael Brand [this message]
2025-01-03 17:46 ` [PATCH] Fix test example in testing/README Ihor Radchenko
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='CALn3zog0=Ljn-u0dAzb+L0LeCS1Mju6At4eskG_wXHBBM9ebnw@mail.gmail.com' \
--to=michael.ch.brand@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).