emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Cc: carsten.dominik@gmail.com
Subject: Testing --- again...
Date: Sat, 02 Oct 2010 05:51:27 +0200	[thread overview]
Message-ID: <87vd5li75s.fsf@gmx.de> (raw)

Hi,


I thought about testing again recently.  This is something, that never
really got started.  For a reason:  there's no framework for testing.

I therefore wrote a very rough proposal,  found  on
http://github.com/SebastianRose/org-test

The idea is, to provide two simple commands:


  *  org-test-test-current-defun
     will search for tests for the defun point is in or behind
     (`beginning-of-defun') and execute them surrounded by

  (let ((select (or selector "^org"))
   	(deactivate-mark nil))
    (save-excursion
      (save-match-data


  *  org-test-test-buffer-file
     will search for tests for the entire file and execute them the same
     way.

If you use one of these commands, all currently registered ERT tests are
deleted, and files are reloaded (since you're likely to work on the
tests, too).  To repeat the tests without reloading, you will use the
ERT commands like `ert-results-rerun-all-tests', bound to `r' in the ERT
results buffer.



I choose ERT (git clone http://github.com/ohler/ert.git) because that's
likely to go into Emacs core (or elpa.gnu.org).




The idea is to search the directory structure from the current source
file upwards for a directory named "tests/" if it exists.  Else ask the
user.  Similar to what `add-change-log-entry' does.

Below that directory, a tree like the source tree exists:

project
   +-- lisp/
   |     +-- a.el
   |     `-- b/
   |         +-- b.el
   |
   `-- tests/
         +-- a.el/
         |     +-- tests.el
         |     `-- a-defun.el
         `-- b/
             +-- b.el/
                   +-- tests.el
                   `-- b-defun.el

If this setup exists, when editing defun-x in lisp/a.el,
`M-x org-test-test-current-defun' will load tests/a.el/defun-x.el
(fallback: tests.el there) and execute all tests with selector
"^a-defun".
`M-x org-test-test-buffer-file' in that same source file will load all
*.el files in tests/a.el/ and execute all ERT tests for selector "^a".


Thus tests for
    org-mode/lisp/org-protocol.el
will be searched in the directory
    org-mode/tests/lisp/org-protocol.el/*.el


Once the basic route of testing is clear, I'd like to "translate" the
existing tests for org-html.el to work with ERT, which will involve
writing more tools (create output buffers, compare output with control
files using ediff etc.).  I know Lennart Borgman has wrote that stuff
for nXhtml already.  I hope we can use his stuff and help here.

The directory org-mode/lisp/tests/ would not need to be part of the
"official" Org mode package.  It could as well be checked out
separately, if "tests" is part of org-mode/lisp/.gitignore (e.g.).


Any thoughts?




  Sebastian

             reply	other threads:[~2010-10-02  3:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02  3:51 Sebastian Rose [this message]
2010-10-02  8:09 ` Testing --- again Carsten Dominik
2010-10-02 14:53   ` Sebastian Rose
2010-10-02 15:01   ` Sebastian Rose
2010-10-02 17:05     ` Carsten Dominik
2010-10-02 18:12   ` Eric Schulte
2010-10-02 19:33     ` Sebastian Rose
2010-10-02 20:30       ` Eric Schulte
2010-10-02 21:55         ` Eric Schulte
2010-10-03  0:46           ` Sebastian Rose
2010-10-04  1:26             ` Eric Schulte
2010-10-04  3:59               ` Sebastian Rose
2010-10-04 15:26                 ` Eric Schulte
2010-10-05  0:21                   ` Sebastian Rose
2010-10-05 18:57                     ` Eric Schulte
2010-10-06  0:48                   ` Bernt Hansen
2010-10-06  2:57                     ` Eric Schulte
2010-10-02 22:14         ` Sebastian Rose

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=87vd5li75s.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=carsten.dominik@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).