mirror of
https://github.com/osm2pgsql-dev/osm2pgsql.git
synced 2025-08-19 16:28:16 +00:00
Split command line parser code from options
Removes all code from the options_t class and makes it into a simple struct. All code parsing and checking the command line is now in command-line-parser.hpp/cpp.
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "options.hpp"
|
||||
#include "command-line-parser.hpp"
|
||||
#include "taginfo-impl.hpp"
|
||||
#include "tagtransform.hpp"
|
||||
|
||||
@ -21,22 +21,27 @@ static void bad_opt(std::vector<char const *> opts, char const *msg)
|
||||
{
|
||||
opts.insert(opts.begin(), "osm2pgsql");
|
||||
opts.push_back(TEST_PBF);
|
||||
REQUIRE_THROWS_WITH(options_t((int)opts.size(), (char **)opts.data()),
|
||||
Catch::Matchers::Contains(msg));
|
||||
|
||||
REQUIRE_THROWS_WITH(
|
||||
parse_command_line((int)opts.size(), (char **)opts.data()),
|
||||
Catch::Matchers::Contains(msg));
|
||||
}
|
||||
|
||||
static options_t opt(std::vector<char const *> opts)
|
||||
{
|
||||
opts.insert(opts.begin(), "osm2pgsql");
|
||||
opts.push_back(TEST_PBF);
|
||||
return {(int)opts.size(), (char **)opts.data()};
|
||||
|
||||
return parse_command_line((int)opts.size(), (char **)opts.data());
|
||||
}
|
||||
|
||||
TEST_CASE("Insufficient arguments", "[NoDB]")
|
||||
{
|
||||
std::vector<char const *> opts = {"osm2pgsql", "-a", "-c", "--slim"};
|
||||
REQUIRE_THROWS_WITH(options_t((int)opts.size(), (char **)opts.data()),
|
||||
Catch::Matchers::Contains("Missing input"));
|
||||
|
||||
REQUIRE_THROWS_WITH(
|
||||
parse_command_line((int)opts.size(), (char **)opts.data()),
|
||||
Catch::Matchers::Contains("Missing input"));
|
||||
}
|
||||
|
||||
TEST_CASE("Incompatible arguments", "[NoDB]")
|
||||
|
Reference in New Issue
Block a user