From 955ada112b25068c6756b9fa904c6701da9911b0 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 24 Oct 2013 09:40:05 +0200 Subject: [PATCH] * ert.texi (Running Tests Interactively): Adapt examle output. (Tests and Their Environment): Mention skip-unless. --- doc/misc/ChangeLog | 5 +++++ doc/misc/ert.texi | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index ad045fc6d5f..1396fc12f43 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2013-10-24 Michael Albinus + + * ert.texi (Running Tests Interactively): Adapt examle output. + (Tests and Their Environment): Mention skip-unless. + 2013-10-23 Glenn Morris * dired-x.texi, ebrowse.texi, ede.texi, eieio.texi, eshell.texi: diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 8728d53ea27..ac87b98eae9 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -183,9 +183,10 @@ tests run. It looks like this: @example Selector: t -Passed: 31 -Failed: 2 (2 unexpected) -Total: 33/33 +Passed: 31 +Skipped: 0 +Failed: 2 (2 unexpected) +Total: 33/33 Started at: 2008-09-11 08:39:25-0700 Finished. @@ -454,6 +455,19 @@ versions, specific architectures, etc.: @node Tests and Their Environment @section Tests and Their Environment +Sometimes, it doesn't make sense to run a test due to missing +preconditions. A required Emacs feature might not be compiled in, the +function to be tested could call an external binary which might not be +available on the test machine, you name it. In this case, the macro +@code{skip-unless} could be used to skip the test: + +@lisp +(ert-deftest test-dbus () + "A test that checks D-BUS functionality." + (skip-unless (featurep 'dbusbind)) + ...) +@end lisp + The outcome of running a test should not depend on the current state of the environment, and each test should leave its environment in the same state it found it in. In particular, a test should not depend on -- 2.39.2