aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/symbol-test.cc
diff options
context:
space:
mode:
authorGravatar David Bremner <bremner@debian.org>2011-06-22 08:58:01 -0300
committerGravatar David Bremner <bremner@debian.org>2011-06-23 07:05:25 -0300
commitfba968dbfa806dc517fc55d1f28cf208f0316863 (patch)
treeb9a7fd4934b680498e7853b97ad46aa070f14c44 /test/symbol-test.cc
parentcdf1c70ab359772c1e89678e23614489596ba9eb (diff)
tests: add a test for symbol hiding side effects
The worry here is that a binary linking with libnotmuch might lose access to Xapian::Error symbols because libnotmuch hides them. We are careful here to create ./fakedb/.notmuch in order to trigger a Xapian exception, and not just a missing file check. Thanks to jrollins and amddragon for suggestions. (cherry picked from commit 66f37f5f6864a988f94ddb893e3a176af57f6c8e)
Diffstat (limited to 'test/symbol-test.cc')
-rw-r--r--test/symbol-test.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
new file mode 100644
index 00000000..1de06eae
--- /dev/null
+++ b/test/symbol-test.cc
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <xapian.h>
+#include <notmuch.h>
+main (int argc, char **argv){
+
+ notmuch_database_t *notmuch
+ = notmuch_database_open ("fakedb",
+ NOTMUCH_DATABASE_MODE_READ_ONLY);
+
+ 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;
+}