From d6113123b8666c32d4b718f089806a968aabe2d2 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 30 Sep 2024 18:37:16 -0700 Subject: Add plugin test. --- plugin/test/plugin_test.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 plugin/test/plugin_test.c (limited to 'plugin/test/plugin_test.c') diff --git a/plugin/test/plugin_test.c b/plugin/test/plugin_test.c new file mode 100644 index 0000000..d31bab6 --- /dev/null +++ b/plugin/test/plugin_test.c @@ -0,0 +1,31 @@ +#include "plugin.h" + +#include "test.h" + +#include + +typedef void (*SayHelloFunc)(void); + +TEST_CASE(test_hello_plugin) { + PluginEngine* eng = + new_plugin_engine(&(PluginEngineDesc){.plugins_dir = "."}); + TEST_TRUE(eng != 0); + + Plugin* plugin = load_plugin(eng, "hello_plugin"); + TEST_TRUE(plugin != 0); + + plugin_call(plugin, SayHelloFunc, "SayHello"); + + printf("Now modify the plugin, build it, and press enter"); + fflush(stdout); + getchar(); + + plugin_engine_update(eng); + + plugin_call(plugin, SayHelloFunc, "SayHello"); + + delete_plugin_engine(&eng); + TEST_TRUE(eng == 0); +} + +int main() { return 0; } -- cgit v1.2.3