X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=test%2Fsymbol-test.cc;h=9e956ddf228b6dc87482fa559625deec04a62252;hp=ec250b2de34aa3aa12663430ed87b194ca1f32f6;hb=2707c06a0fc587a68096a3ec6f054ba4f0d7e7c7;hpb=071456e5e6c513e99e2f2d7b770c760de92f681f diff --git a/test/symbol-test.cc b/test/symbol-test.cc index ec250b2d..9e956ddf 100644 --- a/test/symbol-test.cc +++ b/test/symbol-test.cc @@ -1,16 +1,33 @@ #include +#include #include #include -int main (){ - (void)notmuch_database_open ("fakedb", - NOTMUCH_DATABASE_MODE_READ_ONLY); +int +main (int argc, char **argv) +{ + notmuch_database_t *notmuch; + char *message = NULL; - try{ - (void)new Xapian::WritableDatabase ("./nonexistant", Xapian::DB_OPEN); - } catch (const Xapian::Error &error) { - printf("caught %s\n",error.get_msg().c_str()); - return 0; - } - return 1; + if (argc != 3) + return 1; + + if (notmuch_database_open_with_config (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, + "", + NULL, + ¬much, &message)) { + if (message) { + fputs (message, stderr); + free (message); + } + } + + try { + (void) new Xapian::WritableDatabase (argv[2], Xapian::DB_OPEN); + } catch (const Xapian::Error &error) { + printf ("caught %s\n", error.get_msg ().c_str ()); + return 0; + } + + return 1; }