test(plugins): cover load failure lifecycle
This commit is contained in:
1 parent
d6cbab6ffb
commit
85271fcf26
1 file changed
+40
@@ -0,0 +1,40 @@
|
||||
#include "zeroerr/assert.h"
|
||||
#include "zeroerr/unittest.h"
|
||||
|
||||
#include "plugins/Plugins.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
using eve::plugins::Plugins;
|
||||
|
||||
TEST_CASE("plugins.load.rejectsEmptyPath") {
|
||||
Plugins plugins;
|
||||
CHECK_THROWS((plugins.load(""), false));
|
||||
CHECK_EQ(plugins.isLoaded(""), false);
|
||||
}
|
||||
|
||||
TEST_CASE("plugins.load.rejectsMissingLibrary") {
|
||||
Plugins plugins;
|
||||
const std::string missing = "evengine-plugin-that-does-not-exist.dll";
|
||||
CHECK_THROWS((plugins.load(missing), false));
|
||||
CHECK_EQ(plugins.isLoaded(missing), false);
|
||||
}
|
||||
|
||||
TEST_CASE("plugins.load.closesLibraryWithoutEntrypoint") {
|
||||
Plugins plugins;
|
||||
#if defined(_WIN32)
|
||||
const std::string library = "kernel32.dll";
|
||||
#elif defined(__APPLE__)
|
||||
const std::string library = "/usr/lib/libSystem.B.dylib";
|
||||
#else
|
||||
const std::string library = "libm.so.6";
|
||||
#endif
|
||||
CHECK_THROWS((plugins.load(library), false));
|
||||
CHECK_EQ(plugins.isLoaded(library), false);
|
||||
CHECK_EQ(plugins.unload(library), false);
|
||||
}
|
||||
|
||||
TEST_CASE("plugins.unload.unknownPathIsNoop") {
|
||||
Plugins plugins;
|
||||
CHECK_EQ(plugins.unload("not-loaded"), false);
|
||||
}
|
||||
Reference in new issue
Block a user