#define CATCH_CONFIG_MAIN #include "plugin/plugin.h" #include #include TEST_CASE("Hostlist") { HostlistFilterPlugin plugin; const QString filename(qgetenv("HOSTLIST_TXT")); REQUIRE(!filename.isEmpty()); QFile f(filename); // shouldn't be able to load an unopened QIODevice REQUIRE(plugin.load(f) == nullptr); REQUIRE(f.open(QIODevice::ReadOnly | QIODevice::Text)); auto *list = plugin.load(f); REQUIRE(list != nullptr); f.seek(0); REQUIRE_FALSE(plugin.parse(nullptr, f)); REQUIRE(plugin.parse(list, f)); f.close(); REQUIRE_FALSE(plugin.parse(list, f)); }