return error code when no feature can be read from shapefile + update unit test.
This commit is contained in:
parent
dfa8f100b2
commit
82a7d07b7f
2 changed files with 9 additions and 4 deletions
|
@ -162,9 +162,13 @@ TEST_CASE("shapeindex")
|
||||||
// count features
|
// count features
|
||||||
std::size_t feature_count = count_shapefile_features(path);
|
std::size_t feature_count = count_shapefile_features(path);
|
||||||
// create *.index
|
// create *.index
|
||||||
REQUIRE(create_shapefile_index(path, index_parts) == 0);
|
if (feature_count > 0)
|
||||||
if (feature_count == 0)
|
|
||||||
{
|
{
|
||||||
|
REQUIRE(create_shapefile_index(path, index_parts) == EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
REQUIRE(create_shapefile_index(path, index_parts) != EXIT_SUCCESS);
|
||||||
REQUIRE(!mapnik::util::exists(index_path)); // index won't be created if there's no features
|
REQUIRE(!mapnik::util::exists(index_path)); // index won't be created if there's no features
|
||||||
}
|
}
|
||||||
// count features
|
// count features
|
||||||
|
|
|
@ -281,7 +281,8 @@ int main (int argc,char** argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::clog << "No non-empty geometries in shapefile" << std::endl;
|
std::clog << "Failed to read any features from \"" << filename << "\"" << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue