]> git.cworth.org Git - notmuch/commitdiff
test: Add a new test_emacs function to test-lib.sh
authorCarl Worth <cworth@cworth.org>
Fri, 22 Oct 2010 19:05:17 +0000 (12:05 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 22 Oct 2010 19:09:56 +0000 (12:09 -0700)
This should be quite handy for doing automated testing of the
emacs-based functionality in notmuch. This function invokes emacs with
the necessary command-line arguments, (to run in batch mode with no
local initialization, to load the notmuch code from the source
directory, and to ensure an 80-column width).

test/README
test/test-lib.sh

index 86afab5cb91d305e9622330abcadf1a6fc6b53f4..1a5b516721fd24d0f4d28c201667c436a41f553f 100644 (file)
@@ -154,6 +154,14 @@ library for your script to use.
    argument.  This is primarily meant for use during the
    development of a new test script.
 
+ test_emacs <emacs-lisp-expressions>
+
+   This function executes the provided emacs lisp script within
+   emacs. The script can be a sequence of emacs lisp expressions,
+   (that is, they will be evaluated within a progn form). The lisp
+   expressions can call `message' to generate output on stdout to be
+   examined by the calling test script.
+
  test_done
 
    Your test script must have test_done at the end.  Its purpose
index f1b07cc415b85caf7150a6bb9531c323e6936fae..f67fbd1b7c7ebb9e18b99172961363617085d893 100644 (file)
@@ -715,6 +715,12 @@ test_done () {
        fi
 }
 
+test_emacs () {
+    emacs_code="$1"
+    emacs --batch --no-site-file --directory ../../emacs --load notmuch.el --eval "(progn (set-frame-width (window-frame (get-buffer-window)) 80) ${emacs_code})"
+}
+
+
 find_notmuch_path ()
 {
     dir="$1"