emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing framework and package.el


From: Eric Schulte
Subject: Re: testing framework and package.el
Date: Mon, 04 Oct 2010 11:22:53 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Christian Ohler <address@hidden> writes:

>  On 4/10/10 6:22, Sebastian Rose wrote:
>> A structure like that could be enforced later
>> if needed.  We will start with a very small project.  I want to make it
>> easy to jump to the test-file for a given source-file and execute tests
>> for current defun automatically.  This could be done based on such a
>> structure (i.e. conventions).
>>
>> I guess reading more of ERT's code I'll find other ways to find the file
>> a certain test (or tests matching a selector) is defined.
> I just started experimenting with a directory layout where ERT's code
> is in lisp/emacs-lisp/*.el and the tests are in
> test/lisp/emacs-lisp/*.el.  It is indeed very clumsy to jump back and
> forth between the tests and the code under test.  (Putting the tests
> in test/emacs-lisp/*.el would make no difference.)
>
> I suspect it would be easier if the convention was that a file
> /some/path/foo.el had its tests in /some/path/test/foo.el.  The
> convention of having a top-level src/ and test/ split makes sense in
> Java because of its package file layout and visibility rules, but
> Emacs Lisp has no such constraints.  Has anyone else thought about the
> pros and cons of these different conventions?  Is there a deep reason
> why Emacs currently has test/ as a separate top-level directory?
>

I've been working with Sebastian on a branch of the Org-mode repository
which includes a test suite [1].  Included in this setup is some
functionality for jumping between e-lisp files and their related test
files.  This uses an old utility I wrote long ago [2] which allows the
definition of "jumping" functions defined using a simple schema.  In the
org-mode repository the tests and elisp are organized as

elisp file in

  /lisp/org-foo.el

related tests can be in either of the following

  /testing/lisp/test-org-foo.el
  /testing/lisp/org-foo.el/test.el
  /testing/lisp/org-foo.el/tests.el

the following is used to define our jumping function in this setup [3].
Maybe this would be helpful for navigating the Emacs tests as well.

Cheers -- Eric

Footnotes: 
[1]  http://repo.or.cz/w/org-mode.git/shortlog/refs/heads/combined-testing

[2]  http://github.com/eschulte/jump.el
       I was just learning elisp when I wrote this,
       so please don't judge me by the code :)

[3]  example jump schema
--8<---------------cut here---------------start------------->8---
;;; Navigation Functions
(defjump 'org-test-jump
  '(("lisp/\\1.el" . "testing/lisp/test-\\1.el")
    ("lisp/\\1.el" . "testing/lisp/\\1.el/test.*.el")
    ("contrib/lisp/\\1.el" . "testing/contrib/lisp/test-\\1.el")
    ("contrib/lisp/\\1.el" . "testing/contrib/lisp/\\1.el/test.*.el")
    ("testing/lisp/test-\\1.el" . "lisp/\\1.el")
    ("testing/lisp/\\1.el" . "lisp/\\1.el/test.*.el")
    ("testing/contrib/lisp/test-\\1.el" . "contrib/lisp/\\1.el")
    ("testing/contrib/lisp/test-\\1.el" . "contrib/lisp/\\1.el/test.*.el"))
  (concat org-base-dir "/")
  "Jump between org-mode files and their tests.")
--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]