test: move backup_database and restore_database to library
authorDavid Bremner <david@tethera.net>
Sun, 7 Jun 2015 15:01:59 +0000 (17:01 +0200)
committerDavid Bremner <david@tethera.net>
Fri, 4 Sep 2015 11:22:42 +0000 (08:22 -0300)
The plan is to re-use them in testing the same errors from the CLI

test/T560-lib-error.sh
test/test-lib-common.sh

index 1ef4ff23a37f1e30a69c878d8d81b67e01339e97..c280939c54fab4cc83e5aa29a09dbaf0342bdc41 100755 (executable)
@@ -3,16 +3,6 @@ test_description="error reporting for library"
 
 . ./test-lib.sh || exit 1
 
-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"
index b1fc33d4044d45a2cc248508604094174b0efaf2..5eb618c1f51aabffb562d4b2ac9dc6e646b668f7 100644 (file)
@@ -34,6 +34,18 @@ 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)