[PATCH 06/10] test: move backup_database and restore_database to library
David Bremner
david at tethera.net
Sun Jun 7 08:01:59 PDT 2015
The plan is to re-use them in testing the same errors from the CLI
---
test/T560-lib-error.sh | 10 ----------
test/test-lib-common.sh | 14 ++++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index c99b17e..36607c3 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -3,16 +3,6 @@ test_description="error reporting for library"
. ./test-lib.sh
-backup_database () {
- rm -rf notmuch-dir-backup
- cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup
-}
-restore_database () {
- rm -rf ${MAIL_DIR}/.notmuch
- cp -pR notmuch-dir-backup ${MAIL_DIR}/.notmuch
-}
-
-
add_email_corpus
test_expect_success "building database" "NOTMUCH_NEW"
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index f99ed11..0d9c839 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -34,6 +34,20 @@ find_notmuch_path ()
done
}
+backup_database () {
+ test_name=$(basename $0 .sh)
+ rm -rf notmuch-dir-backup."$test_name"
+ cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup."${test_name}"
+}
+
+restore_database () {
+ test_name=$(basename $0 .sh)
+ rm -rf ${MAIL_DIR}/.notmuch
+ cp -pR notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
+}
+
+
+
# Test the binaries we have just built. The tests are kept in
# test/ subdirectory and are run in 'trash directory' subdirectory.
TEST_DIRECTORY=$(pwd)
--
2.1.4
More information about the notmuch
mailing list