diff options
author | 3gg <3gg@shellblade.net> | 2024-09-30 18:37:16 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2024-09-30 18:37:16 -0700 |
commit | d6113123b8666c32d4b718f089806a968aabe2d2 (patch) | |
tree | 52c8434e23d65207259a8fd28385c2beec1f9357 /plugin/test/plugin_test.c | |
parent | da9a6a75acac8c8597d807757bbd9e60f39c31de (diff) |
Add plugin test.
Diffstat (limited to 'plugin/test/plugin_test.c')
-rw-r--r-- | plugin/test/plugin_test.c | 31 |
1 files changed, 31 insertions, 0 deletions
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 @@ | |||
1 | #include "plugin.h" | ||
2 | |||
3 | #include "test.h" | ||
4 | |||
5 | #include <stdio.h> | ||
6 | |||
7 | typedef void (*SayHelloFunc)(void); | ||
8 | |||
9 | TEST_CASE(test_hello_plugin) { | ||
10 | PluginEngine* eng = | ||
11 | new_plugin_engine(&(PluginEngineDesc){.plugins_dir = "."}); | ||
12 | TEST_TRUE(eng != 0); | ||
13 | |||
14 | Plugin* plugin = load_plugin(eng, "hello_plugin"); | ||
15 | TEST_TRUE(plugin != 0); | ||
16 | |||
17 | plugin_call(plugin, SayHelloFunc, "SayHello"); | ||
18 | |||
19 | printf("Now modify the plugin, build it, and press enter"); | ||
20 | fflush(stdout); | ||
21 | getchar(); | ||
22 | |||
23 | plugin_engine_update(eng); | ||
24 | |||
25 | plugin_call(plugin, SayHelloFunc, "SayHello"); | ||
26 | |||
27 | delete_plugin_engine(&eng); | ||
28 | TEST_TRUE(eng == 0); | ||
29 | } | ||
30 | |||
31 | int main() { return 0; } | ||