mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: replace deprecated use of notmuch_database_open
This is a bit more involved than replacing the use of notmuch_database_open_verbose, as we have to effectively inline the definition of notmuch_database_open.
This commit is contained in:
parent
f6e7a9dde5
commit
32f299fe13
6 changed files with 63 additions and 12 deletions
|
@ -16,7 +16,11 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open (NULL, 0, 0);
|
char* msg = NULL;
|
||||||
|
stat = notmuch_database_open_with_config (NULL,
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<'EOF' >EXPECTED
|
cat <<'EOF' >EXPECTED
|
||||||
|
@ -34,7 +38,11 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open ("./nonexistent/foo", 0, 0);
|
char *msg = NULL;
|
||||||
|
stat = notmuch_database_open_with_config ("./nonexistent/foo",
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<'EOF' >EXPECTED
|
cat <<'EOF' >EXPECTED
|
||||||
|
@ -70,7 +78,11 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open (argv[1], 0, 0);
|
char* msg = NULL;
|
||||||
|
stat = notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat <<'EOF' >EXPECTED
|
cat <<'EOF' >EXPECTED
|
||||||
|
@ -123,7 +135,11 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db);
|
char* msg = NULL;
|
||||||
|
stat = notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
||||||
fprintf (stderr, "error opening database: %d\n", stat);
|
fprintf (stderr, "error opening database: %d\n", stat);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +164,9 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db);
|
stat = notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_WRITE,
|
||||||
|
"", NULL, &db, NULL);
|
||||||
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
||||||
fprintf (stderr, "error opening database: %d\n", stat);
|
fprintf (stderr, "error opening database: %d\n", stat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,12 @@ int main (int argc, char** argv)
|
||||||
|
|
||||||
unsigned long rev;
|
unsigned long rev;
|
||||||
|
|
||||||
stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db);
|
char* msg = NULL;
|
||||||
|
stat = notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
|
|
||||||
if (stat)
|
if (stat)
|
||||||
fputs ("open failed\n", stderr);
|
fputs ("open failed\n", stderr);
|
||||||
revision = notmuch_database_get_revision (db, &uuid);
|
revision = notmuch_database_get_revision (db, &uuid);
|
||||||
|
|
|
@ -23,8 +23,12 @@ int main (int argc, char** argv)
|
||||||
notmuch_message_t *message = NULL;
|
notmuch_message_t *message = NULL;
|
||||||
const char *val;
|
const char *val;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
|
char* msg = NULL;
|
||||||
|
|
||||||
EXPECT0(notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db));
|
EXPECT0(notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_WRITE,
|
||||||
|
"", NULL, &db, &msg));
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
EXPECT0(notmuch_database_find_message(db, "4EFC743A.3060609@april.org", &message));
|
EXPECT0(notmuch_database_find_message(db, "4EFC743A.3060609@april.org", &message));
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
fprintf (stderr, "unable to find message");
|
fprintf (stderr, "unable to find message");
|
||||||
|
|
|
@ -40,15 +40,25 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
notmuch_database_t *db2;
|
notmuch_database_t *db2;
|
||||||
|
char* msg = NULL;
|
||||||
|
|
||||||
sleep (1);
|
sleep (1);
|
||||||
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db2));
|
|
||||||
|
EXPECT0(notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_WRITE,
|
||||||
|
"", NULL, &db2, &msg));
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
|
|
||||||
taggit (db2, "child");
|
taggit (db2, "child");
|
||||||
EXPECT0 (notmuch_database_close (db2));
|
EXPECT0 (notmuch_database_close (db2));
|
||||||
} else {
|
} else {
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
|
char* msg = NULL;
|
||||||
|
|
||||||
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db));
|
EXPECT0(notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_WRITE,
|
||||||
|
"", NULL, &db, &msg));
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
taggit (db, "parent");
|
taggit (db, "parent");
|
||||||
sleep (2);
|
sleep (2);
|
||||||
EXPECT0 (notmuch_database_close (db));
|
EXPECT0 (notmuch_database_close (db));
|
||||||
|
|
|
@ -23,14 +23,22 @@ main (int argc, char **argv)
|
||||||
notmuch_query_t *query;
|
notmuch_query_t *query;
|
||||||
notmuch_tags_t *tags;
|
notmuch_tags_t *tags;
|
||||||
int i;
|
int i;
|
||||||
|
char* msg = NULL;
|
||||||
|
|
||||||
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_ONLY, &ro_db));
|
EXPECT0(notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &ro_db, &msg));
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
assert(ro_db);
|
assert(ro_db);
|
||||||
|
|
||||||
EXPECT0 (notmuch_database_find_message (ro_db, "${first_id}", &ro_message));
|
EXPECT0 (notmuch_database_find_message (ro_db, "${first_id}", &ro_message));
|
||||||
assert(ro_message);
|
assert(ro_message);
|
||||||
|
|
||||||
EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db));
|
EXPECT0(notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_WRITE,
|
||||||
|
"", NULL, &rw_db, &msg));
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
|
|
||||||
query = notmuch_query_create(rw_db, "");
|
query = notmuch_query_create(rw_db, "");
|
||||||
EXPECT0 (notmuch_query_search_messages (query, &messages));
|
EXPECT0 (notmuch_query_search_messages (query, &messages));
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,13 @@ int main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
notmuch_database_t *db;
|
notmuch_database_t *db;
|
||||||
notmuch_status_t stat;
|
notmuch_status_t stat;
|
||||||
stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db);
|
char* msg = NULL;
|
||||||
|
|
||||||
|
stat = notmuch_database_open_with_config (argv[1],
|
||||||
|
NOTMUCH_DATABASE_MODE_READ_ONLY,
|
||||||
|
"", NULL, &db, &msg);
|
||||||
|
if (msg) fputs (msg, stderr);
|
||||||
|
|
||||||
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
if (stat != NOTMUCH_STATUS_SUCCESS) {
|
||||||
fprintf (stderr, "error opening database: %d\n", stat);
|
fprintf (stderr, "error opening database: %d\n", stat);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
Loading…
Reference in a new issue