Skip to content

Commit b89aea3

Browse files
committed
test-options-parse needs a DB to connect to
1 parent 4f5838a commit b89aea3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test-options-parse.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <boost/format.hpp>
1515
#include <boost/algorithm/string/predicate.hpp>
1616

17+
#include "tests/common-pg.hpp"
18+
1719
namespace alg = boost::algorithm;
1820

1921
#define len(x) sizeof(x)/sizeof(x[0])
@@ -83,7 +85,8 @@ void test_middles()
8385

8486
void test_outputs()
8587
{
86-
const char* a1[] = {"osm2pgsql", "-O", "pgsql", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
88+
pg::tempdb db;
89+
const char* a1[] = {"osm2pgsql", "-d", db.database_options.db->c_str(), "-O", "pgsql", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
8790
options_t options = options_t(len(a1), const_cast<char **>(a1));
8891
auto middle_ram = std::make_shared<middle_ram_t>(&options);
8992
auto mid = middle_ram->get_query_instance(middle_ram);
@@ -94,7 +97,7 @@ void test_outputs()
9497
throw std::logic_error("Expected a pgsql output");
9598
}
9699

97-
const char* a2[] = {"osm2pgsql", "-O", "gazetteer", "--style", "tests/gazetteer-test.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
100+
const char* a2[] = {"osm2pgsql", "-d", db.database_options.db->c_str(), "-O", "gazetteer", "--style", "tests/gazetteer-test.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
98101
options = options_t(len(a2), const_cast<char **>(a2));
99102
outs = output_t::create_outputs(mid, options);
100103
out = outs.front().get();
@@ -103,7 +106,7 @@ void test_outputs()
103106
throw std::logic_error("Expected a gazetteer output");
104107
}
105108

106-
const char* a3[] = {"osm2pgsql", "-O", "null", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
109+
const char* a3[] = {"osm2pgsql", "-d", db.database_options.db->c_str(), "-O", "null", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
107110
options = options_t(len(a3), const_cast<char **>(a3));
108111
outs = output_t::create_outputs(mid, options);
109112
out = outs.front().get();
@@ -112,7 +115,7 @@ void test_outputs()
112115
throw std::logic_error("Expected a null output");
113116
}
114117

115-
const char* a4[] = {"osm2pgsql", "-O", "keine_richtige_ausgabe", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
118+
const char* a4[] = {"osm2pgsql", "-d", db.database_options.db->c_str(), "-O", "keine_richtige_ausgabe", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
116119
options = options_t(len(a4), const_cast<char **>(a4));
117120
try
118121
{

0 commit comments

Comments
 (0)