emacs-devel
[Top][All Lists]
Advanced

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

Installing ERT (an automated testing tool for Emacs Lisp)


From: Christian Ohler
Subject: Installing ERT (an automated testing tool for Emacs Lisp)
Date: Mon, 11 Oct 2010 19:50:05 +1100

ERT has been suggested for inclusion in Emacs on this list before but there were some parts of it (mainly the manual) that I wanted to improve first. It is now approaching a state where I think it can be installed.

ERT is a tool for automated testing in Emacs Lisp. Its main features are facilities for defining tests, running them and reporting the results, and for debugging test failures interactively. It is similar to tools for other environments such as JUnit, but has unique features that take advantage of the dynamic and interactive nature of Emacs.

Tests are plain Lisp code, defined using `ert-deftest' rather than `defun', and generally use `should' instead of `assert'. In the simplest case, they look like this:

(ert-deftest equal-including-properties ()
  (should (equal-including-properties "foo" "foo"))
  (should (equal-including-properties #("foo" 0 3 (a b c d))
                                      (propertize "foo" 'a 'b 'c 'd)))
  (should-not (equal-including-properties #("foo" 0 3 (a b c e))
                                          (propertize "foo" 'a 'b 'c 'd)))
  (should (equal-including-properties #("foo" 0 3 (a (t)))
                                      (propertize "foo" 'a (list t)))))


There are still a few things that I would like to change (e.g., use ediff to visualize differences between expected and actual results, move ert.texi from doc/misc to doc/lispref), but these don't have to hold up installation.

The code is at http://github.com/ohler/ert . It includes a script install.sh that installs the code into an Emacs bzr workspace.

Please take a look and let me know what you think.


The script adds the following files (and one directory, test/automated):

lisp/emacs-lisp/ert.el
lisp/emacs-lisp/ert-batch.el
lisp/emacs-lisp/ert-run.el
lisp/emacs-lisp/ert-ui.el
lisp/emacs-lisp/ert-x.el
test/automated/ert-tests.el
test/automated/ert-x-tests.el
test/automated/Makefile.in
doc/misc/ert.texi

Since these are >5000 lines total, I'm not including them here. You can find them at the URL above.

Also, it modifies files as follows. These are mainly NEWS and ChangeLog entries, makefile and configuration changes to add doc/misc/ert.texi and test/automated/Makefile.in, and a change to the top-level Makefile.in to let "make check" run the tests in test/automated.


=== modified file 'ChangeLog'
*** ChangeLog    2010-10-09 18:46:57 +0000
--- ChangeLog    2010-10-10 12:37:08 +0000
***************
*** 1,3 ****
--- 1,12 ----
+ 2010-10-10  Christian Ohler <address@hidden>
+
+     * Makefile.in (INFO_FILES): Add ERT.
+
+     * Makefile.in (check): Run tests in test/automated.
+
+     * Makefile.in:
+     * configure.in: Add test/automated/Makefile.
+
  2010-10-09  Glenn Morris <address@hidden>

      * make-dist: No more doc/emacs/*.texi.in.

=== modified file 'Makefile.in'
*** Makefile.in    2010-10-09 01:15:15 +0000
--- Makefile.in    2010-10-10 12:37:08 +0000
*************** MAN_PAGES=ctags.1 ebrowse.1 emacs.1 emac
*** 135,141 ****
  address@hidden@
INFO_FILES=ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse \ ede ediff edt eieio efaq eintr elisp emacs emacs-mime epa erc \
!        eshell eudc flymake forms gnus idlwave info mairix-el    \
         message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc    \
         reftex remember sasl sc semantic ses sieve smtpmail speedbar \
         tramp url vip viper widget woman
--- 135,141 ----
  address@hidden@
INFO_FILES=ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse \ ede ediff edt eieio efaq eintr elisp emacs emacs-mime epa erc \
!        ert eshell eudc flymake forms gnus idlwave info mairix-el    \
         message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc    \
         reftex remember sasl sc semantic ses sieve smtpmail speedbar \
         tramp url vip viper widget woman
*************** EMACSFULL = `echo emacs-${version}${EXEE
*** 265,271 ****
  SUBDIR = lib-src src lisp

  # The subdir makefiles created by config.status.
! SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile

  # Subdirectories to install, and where they'll go.
  # lib-src's makefile knows how to install it, so we don't do that here.
--- 265,271 ----
  SUBDIR = lib-src src lisp

  # The subdir makefiles created by config.status.
! SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile test/automated/Makefile

  # Subdirectories to install, and where they'll go.
  # lib-src's makefile knows how to install it, so we don't do that here.
*************** Makefile: config.status $(srcdir)/src/co
*** 366,372 ****
            $(srcdir)/oldXMenu/Makefile.in \
            $(srcdir)/lwlib/Makefile.in \
            $(srcdir)/leim/Makefile.in \
!           $(srcdir)/lisp/Makefile.in
      ./config.status

  config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
--- 366,373 ----
            $(srcdir)/oldXMenu/Makefile.in \
            $(srcdir)/lwlib/Makefile.in \
            $(srcdir)/leim/Makefile.in \
!           $(srcdir)/lisp/Makefile.in \
!           $(srcdir)/test/automated/Makefile.in
      ./config.status

  config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
*************** TAGS tags: lib-src src
*** 817,823 ****
      cd src; $(MAKE) tags

  check:
!     @echo "We don't have any tests for GNU Emacs yet."

  dist:
      cd ${srcdir}; ./make-dist
--- 818,824 ----
      cd src; $(MAKE) tags

  check:
!     cd test/automated; $(MAKE) check

  dist:
      cd ${srcdir}; ./make-dist

=== modified file 'configure.in'
*** configure.in    2010-10-09 17:59:55 +0000
--- configure.in    2010-10-10 12:37:08 +0000
*************** dnl the use of force in the `epaths-forc
*** 3771,3777 ****
  AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
      doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
      doc/lispref/Makefile src/Makefile \
!     lwlib/Makefile lisp/Makefile leim/Makefile, [

  ### Make the necessary directories, if they don't exist.
  for dir in etc lisp ; do
--- 3771,3777 ----
  AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
      doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
      doc/lispref/Makefile src/Makefile \
!     lwlib/Makefile lisp/Makefile leim/Makefile test/automated/Makefile, [

  ### Make the necessary directories, if they don't exist.
  for dir in etc lisp ; do

=== modified file 'doc/misc/ChangeLog'
*** doc/misc/ChangeLog    2010-10-10 00:15:21 +0000
--- doc/misc/ChangeLog    2010-10-10 12:37:08 +0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2010-10-10  Christian Ohler <address@hidden>
+
+     * ert.texi: New file.
+
+     * Makefile.in:
+     * makefile.w32-in: Add ert.texi.
+
  2010-10-09  Lars Magne Ingebrigtsen <address@hidden>

      * gnus.texi (Spam Package Introduction): Mention `$'.

=== modified file 'doc/misc/Makefile.in'
*** doc/misc/Makefile.in    2010-10-09 22:40:30 +0000
--- doc/misc/Makefile.in    2010-10-10 12:37:08 +0000
*************** INFO_TARGETS = \
*** 62,67 ****
--- 62,68 ----
      $(infodir)/emacs-mime \
      $(infodir)/epa \
      $(infodir)/erc \
+     $(infodir)/ert \
      $(infodir)/eshell \
      $(infodir)/eudc \
      $(infodir)/efaq \
*************** DVI_TARGETS = \
*** 112,117 ****
--- 113,119 ----
      emacs-mime.dvi \
      epa.dvi \
      erc.dvi \
+     ert.dvi \
      eshell.dvi \
      eudc.dvi \
      faq.dvi \
*************** PDF_TARGETS = \
*** 162,167 ****
--- 164,170 ----
      emacs-mime.pdf \
      epa.pdf \
      erc.pdf \
+     ert.pdf \
      eshell.pdf \
      eudc.pdf \
      faq.pdf \
*************** erc.dvi: ${srcdir}/erc.texi
*** 365,370 ****
--- 368,381 ----
  erc.pdf: ${srcdir}/erc.texi
      $(ENVADD) $(TEXI2PDF) $<

+ ert : $(infodir)/ert
+ $(infodir)/ert: ert.texi $(infodir)
+     cd $(srcdir); $(MAKEINFO) ert.texi
+ ert.dvi: ert.texi
+     $(ENVADD) $(TEXI2DVI) ${srcdir}/ert.texi
+ ert.pdf: ert.texi
+     $(ENVADD) $(TEXI2PDF) ${srcdir}/ert.texi
+
  eshell : $(infodir)/eshell
  $(infodir)/eshell: eshell.texi
      $(mkinfodir)

=== modified file 'doc/misc/makefile.w32-in'
*** doc/misc/makefile.w32-in    2010-10-09 21:38:04 +0000
--- doc/misc/makefile.w32-in    2010-10-10 12:37:08 +0000
*************** INFO_TARGETS = $(infodir)/ccmode \
*** 47,53 ****
          $(infodir)/org $(infodir)/url $(infodir)/speedbar \
          $(infodir)/tramp $(infodir)/ses $(infodir)/smtpmail \
          $(infodir)/flymake $(infodir)/newsticker $(infodir)/rcirc \
!         $(infodir)/erc $(infodir)/remember $(infodir)/nxml-mode \
          $(infodir)/epa $(infodir)/mairix-el $(infodir)/sasl \
          $(infodir)/auth $(infodir)/eieio $(infodir)/ede \
          $(infodir)/semantic $(infodir)/edt
--- 47,54 ----
          $(infodir)/org $(infodir)/url $(infodir)/speedbar \
          $(infodir)/tramp $(infodir)/ses $(infodir)/smtpmail \
          $(infodir)/flymake $(infodir)/newsticker $(infodir)/rcirc \
!         $(infodir)/erc $(infodir)/ert \
!         $(infodir)/remember $(infodir)/nxml-mode \
          $(infodir)/epa $(infodir)/mairix-el $(infodir)/sasl \
          $(infodir)/auth $(infodir)/eieio $(infodir)/ede \
          $(infodir)/semantic $(infodir)/edt
*************** DVI_TARGETS = calc.dvi cc-mode.dvi cl.dv
*** 58,64 ****
          ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
          pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
          speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
!         newsticker.dvi rcirc.dvi erc.dvi remember.dvi nxml-mode.dvi \
          epa.dvi mairix-el.dvi sasl.dvi auth.dvi eieio.dvi ede.dvi \
          semantic.dvi edt.dvi
  INFOSOURCES = info.texi
--- 59,66 ----
          ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
          pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
          speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
!         newsticker.dvi rcirc.dvi erc.dvi ert.dvi \
!         remember.dvi nxml-mode.dvi \
          epa.dvi mairix-el.dvi sasl.dvi auth.dvi eieio.dvi ede.dvi \
          semantic.dvi edt.dvi
  INFOSOURCES = info.texi
*************** $(infodir)/erc: erc.texi
*** 305,310 ****
--- 307,317 ----
  erc.dvi: erc.texi
      $(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi

+ $(infodir)/ert: ert.texi
+     $(MAKEINFO) ert.texi
+ ert.dvi: ert.texi
+     $(ENVADD) $(TEXI2DVI) $(srcdir)/ert.texi
+
  $(infodir)/epa: epa.texi
      $(MAKEINFO) epa.texi
  epa.dvi: epa.texi
*************** clean: mostlyclean
*** 362,368 ****
           $(infodir)/url* $(infodir)/org* \
           $(infodir)/flymake* $(infodir)/newsticker* \
           $(infodir)/sieve* $(infodir)/pgg* \
!          $(infodir)/erc* $(infodir)/rcirc* \
           $(infodir)/remember* $(infodir)/nxml-mode* \
           $(infodir)/epa* $(infodir)/sasl* \
           $(infodir)/mairix-el* $(infodir)/auth* \
--- 369,375 ----
           $(infodir)/url* $(infodir)/org* \
           $(infodir)/flymake* $(infodir)/newsticker* \
           $(infodir)/sieve* $(infodir)/pgg* \
!          $(infodir)/erc* $(infodir)/ert* $(infodir)/rcirc* \
           $(infodir)/remember* $(infodir)/nxml-mode* \
           $(infodir)/epa* $(infodir)/sasl* \
           $(infodir)/mairix-el* $(infodir)/auth* \

=== modified file 'etc/ChangeLog'
*** etc/ChangeLog    2010-09-23 19:00:31 +0000
--- etc/ChangeLog    2010-10-10 12:37:08 +0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2010-10-10  Christian Ohler <address@hidden>
+
+     * NEWS: Mention ERT.
+
  2010-09-21  Eric Ludlam <address@hidden>

      * srecode/java.srt: Make NAME be a prompt.

=== modified file 'etc/NEWS'
*** etc/NEWS    2010-10-08 03:17:31 +0000
--- etc/NEWS    2010-10-10 12:37:08 +0000
*************** automatically when Emacs starts up.  To
*** 195,200 ****
--- 195,204 ----
  `package-enable-at-startup' to nil.  To change which packages are
  loaded, customize `package-load-list'.

+ ** An Emacs Lisp testing framework is now included.
+ Emacs Lisp developers can use this to write automated tests for their
+ code.  See the ERT info manual for details.
+
  ** The user option `remote-file-name-inhibit-cache' controls whether
  the remote file-name cache is used for read access.


=== modified file 'lisp/ChangeLog'
*** lisp/ChangeLog    2010-10-10 03:40:58 +0000
--- lisp/ChangeLog    2010-10-10 12:37:08 +0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2010-10-10  Christian Ohler <address@hidden>
+
+     * emacs/lisp/ert.el, emacs/lisp/ert-run.el:
+     * emacs/lisp/ert-batch.el, emacs/lisp/ert-ui.el:
+     * emacs/lisp/ert-x.el: New files.
+
  2010-10-10  Dan Nicolaescu <address@hidden>

      * vc/log-view.el (log-view-mode-map): Bind revert-buffer.

=== modified file 'test/ChangeLog'
*** test/ChangeLog    2010-09-20 14:57:01 +0000
--- test/ChangeLog    2010-10-10 12:37:09 +0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2010-10-10  Christian Ohler <address@hidden>
+
+     * automated: New directory for automated tests.
+
+     * automated/ert-tests.el, automated/ert-x-tests.el: New files.
+
+     * automated/Makefile.in: New file.
+
  2010-09-20  Stefan Monnier <address@hidden>

      * indent/prolog.prolog: Use normal spacing around !.




reply via email to

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