X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Fsymbol-test.cc;h=9d73a571a71e5f733ca09c0cca57725a4dda7de3;hb=d9a2b900b6525874b913276af91840983d81b3f1;hp=ec250b2de34aa3aa12663430ed87b194ca1f32f6;hpb=071456e5e6c513e99e2f2d7b770c760de92f681f;p=notmuch diff --git a/test/symbol-test.cc b/test/symbol-test.cc index ec250b2d..9d73a571 100644 --- a/test/symbol-test.cc +++ b/test/symbol-test.cc @@ -1,16 +1,31 @@ #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_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, + ¬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; }