]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.sh
lib: Add two functions: notmuch_query_get_query_string and _get_sort
[notmuch] / test / test-lib.sh
index f67fbd1b7c7ebb9e18b99172961363617085d893..28d14ef96aaa6965c5bbc8eedd963ad2928d5401 100644 (file)
@@ -414,6 +414,24 @@ test_expect_equal ()
     fi
 }
 
+test_expect_equal_failure ()
+{
+       test "$#" = 3 && { prereq=$1; shift; } || prereq=
+       test "$#" = 2 ||
+       error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
+
+       output="$1"
+       expected="$2"
+       if ! test_skip "$@"
+       then
+               if [ "$output" = "$expected" ]; then
+                       test_known_broken_ok_ "$test_subtest_name"
+               else
+                       test_known_broken_failure_ "$test_subtest_name"
+               fi
+    fi
+}
+
 NOTMUCH_NEW ()
 {
     notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
@@ -717,7 +735,11 @@ test_done () {
 
 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})"
+    emacs --batch --no-site-file --directory ../../emacs --load notmuch.el \
+       --eval "(defun notmuch-test-wait ()
+                       (while (get-buffer-process (current-buffer))
+                               (sleep-for 0.1)))" \
+       --eval "(progn (set-frame-width (window-frame (get-buffer-window)) 80) ${emacs_code})"
 }
 
 
@@ -822,7 +844,8 @@ rm -fr "$test" || {
 }
 
 MAIL_DIR="${TMP_DIRECTORY}/mail"
-export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
+export HOME="${TMP_DIRECTORY}"
+export NOTMUCH_CONFIG="${HOME}/notmuch-config"
 
 mkdir -p "${test}"
 mkdir -p "${MAIL_DIR}"