add simple I/O error test when file does not exist
This commit is contained in:
parent
b0bcf86aaa
commit
69829e028d
2 changed files with 46 additions and 0 deletions
|
@ -223,6 +223,27 @@ TEST_CASE("csv") {
|
||||||
const bool have_csv_plugin =
|
const bool have_csv_plugin =
|
||||||
std::find(plugin_names.begin(), plugin_names.end(), "csv") != plugin_names.end();
|
std::find(plugin_names.begin(), plugin_names.end(), "csv") != plugin_names.end();
|
||||||
|
|
||||||
|
SECTION("CSV I/O errors")
|
||||||
|
{
|
||||||
|
std::string filename = "does_not_exist.csv";
|
||||||
|
for (auto create_index : { true, false })
|
||||||
|
{
|
||||||
|
if (create_index)
|
||||||
|
{
|
||||||
|
int ret = create_disk_index(filename);
|
||||||
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
||||||
|
INFO(ret);
|
||||||
|
INFO(ret_posix);
|
||||||
|
// index wont be created
|
||||||
|
CHECK(!mapnik::util::exists(filename + ".index"));
|
||||||
|
}
|
||||||
|
mapnik::parameters params;
|
||||||
|
params["type"] = "csv";
|
||||||
|
params["file"] = filename;
|
||||||
|
REQUIRE_THROWS(mapnik::datasource_cache::instance().create(params));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("broken files")
|
SECTION("broken files")
|
||||||
{
|
{
|
||||||
for (auto create_index : { false, true })
|
for (auto create_index : { false, true })
|
||||||
|
|
|
@ -80,6 +80,31 @@ TEST_CASE("geojson") {
|
||||||
std::string geojson_plugin("./plugins/input/geojson.input");
|
std::string geojson_plugin("./plugins/input/geojson.input");
|
||||||
if (mapnik::util::exists(geojson_plugin))
|
if (mapnik::util::exists(geojson_plugin))
|
||||||
{
|
{
|
||||||
|
SECTION("GeoJSON I/O errors")
|
||||||
|
{
|
||||||
|
std::string filename = "does_not_exist.geojson";
|
||||||
|
for (auto create_index : { true, false })
|
||||||
|
{
|
||||||
|
if (create_index)
|
||||||
|
{
|
||||||
|
int ret = create_disk_index(filename);
|
||||||
|
int ret_posix = (ret >> 8) & 0x000000ff;
|
||||||
|
INFO(ret);
|
||||||
|
INFO(ret_posix);
|
||||||
|
// index wont be created
|
||||||
|
CHECK(!mapnik::util::exists(filename + ".index"));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto cache_features : {true, false})
|
||||||
|
{
|
||||||
|
mapnik::parameters params;
|
||||||
|
params["type"] = "geojson";
|
||||||
|
params["file"] = filename;
|
||||||
|
params["cache_features"] = cache_features;
|
||||||
|
REQUIRE_THROWS(mapnik::datasource_cache::instance().create(params));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
SECTION("GeoJSON Point")
|
SECTION("GeoJSON Point")
|
||||||
{
|
{
|
||||||
for (auto cache_features : {true, false})
|
for (auto cache_features : {true, false})
|
||||||
|
|
Loading…
Reference in a new issue