C++: Fix test_cpp.cpp to work with VPATH builds

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.
This commit is contained in:
Petri Lehtinen 2010-02-04 21:10:04 +02:00
parent adb1b58627
commit f021ba00a2

View File

@ -22,7 +22,8 @@
#define ASSERT_FALSE(p, m) ASSERT_OP(p, true, !=, m) #define ASSERT_FALSE(p, m) ASSERT_OP(p, true, !=, m)
int main() { 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 e2(e1);
json::Value e3; json::Value e3;
json::Value e4(json::loads("{\"foo\": true, \"bar\": \"test\"}")); json::Value e4(json::loads("{\"foo\": true, \"bar\": \"test\"}"));