1 parent
4fca5523f6
commit
fa30098129
5 files changed
+59
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#include <Void/Plugin/Manager.hpp>
|
||||
#include <Void/Plugin/Loader.hpp>
|
||||
#include <Void/System/TempDir.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
@@ -92,4 +93,24 @@ Void::Testing::Test activation_failure_keeps_current_instance()
|
||||
std::string_view{"accepted"});
|
||||
}
|
||||
|
||||
Void::Testing::Test host_validation_failure_keeps_current_instance()
|
||||
{
|
||||
Void::FileSystem::TempDir tmp{"void_cfg_validator"};
|
||||
const auto so = tmp.path() / "plugin.so";
|
||||
std::filesystem::copy_file(VOID_CONFIGURABLE_PATH, so);
|
||||
|
||||
bool accepted = true;
|
||||
PluginManager mgr{{.instance_validator = [&accepted](IPlugin&,
|
||||
const PluginInfo&) { return accepted; }}};
|
||||
Void::Testing::expect(mgr.load(so).has_value());
|
||||
auto before = mgr.acquire("ConfigurablePlugin");
|
||||
|
||||
accepted = false;
|
||||
const auto result = mgr.reload("ConfigurablePlugin");
|
||||
Void::Testing::expect(!result.has_value());
|
||||
Void::Testing::expect(result.error() == LoadError::ActivationFailed);
|
||||
auto after = mgr.acquire("ConfigurablePlugin");
|
||||
Void::Testing::expect(after.get() == before.get());
|
||||
}
|
||||
|
||||
#endif // configurable plugin available
|
||||
Reference in new issue
Block a user