aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-06-07 17:01:59 +0200
committerDavid Bremner <david@tethera.net>2015-09-04 08:22:42 -0300
commit9ee29ad6f0805dc55e63f8a04a68a1f55d0c382b (patch)
tree7185b65f84ca51b4cb37e6c768372f63781d097b
parent110694b00b79793b3c09a0349c0ff7608df551d6 (diff)
test: move backup_database and restore_database to library
The plan is to re-use them in testing the same errors from the CLI
-rwxr-xr-xtest/T560-lib-error.sh10
-rw-r--r--test/test-lib-common.sh12
2 files changed, 12 insertions, 10 deletions
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 1ef4ff23..c280939c 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 || 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"
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index b1fc33d4..5eb618c1 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -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)