C++: Fix test_cpp.cpp to work with VPATH builds
authorPetri Lehtinen <petri@digip.org>
Thu, 4 Feb 2010 19:10:04 +0000 (21:10 +0200)
committerPetri Lehtinen <petri@digip.org>
Thu, 4 Feb 2010 19:10:04 +0000 (21:10 +0200)
It reads an input file, and the file location is different with VPATH
builds. Read top_srcdir from environment and use it to find the file.

test/suites/api/test_cpp.cpp

index b8626ea..1215e4e 100644 (file)
@@ -22,7 +22,8 @@
 #define ASSERT_FALSE(p, m) ASSERT_OP(p, true, !=, m)
 
 int main() {
-    json::Value e1(json::load_file("suites/api/test_cpp.json"));
+    std::string top_srcdir = getenv("top_srcdir");
+    json::Value e1(json::load_file(top_srcdir + "/test/suites/api/test_cpp.json"));
     json::Value e2(e1);
     json::Value e3;
     json::Value e4(json::loads("{\"foo\": true, \"bar\": \"test\"}"));