test/libconfig: save and restore config file

Currently the config file is unusable for further tests requiring a
valid database path.
This commit is contained in:
David Bremner 2021-12-11 08:49:11 -04:00
parent c7c422ded2
commit c62ebcfea9

View file

@ -972,6 +972,7 @@ EOF
test_expect_equal_file EXPECTED OUTPUT test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "open: database parameter overrides implicit config" test_begin_subtest "open: database parameter overrides implicit config"
cp $NOTMUCH_CONFIG ${NOTMUCH_CONFIG}.bak
notmuch config set database.path ${MAIL_DIR}/nonexistent notmuch config set database.path ${MAIL_DIR}/nonexistent
cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
const char *path = NULL; const char *path = NULL;
@ -982,6 +983,7 @@ cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR}
path = notmuch_database_get_path (db); path = notmuch_database_get_path (db);
printf ("path: %s\n", path ? path : "(null)"); printf ("path: %s\n", path ? path : "(null)");
EOF EOF
cp ${NOTMUCH_CONFIG}.bak ${NOTMUCH_CONFIG}
cat <<EOF> EXPECTED cat <<EOF> EXPECTED
== stdout == == stdout ==
status: 0 status: 0