blob: fad34f272fa63d2733f8b61a32f56dab83e13329 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#define CATCH_CONFIG_MAIN
#include "plugin/plugin.h"
#include <QFile>
#include <catch2/catch.hpp>
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));
}
|