diff options
Diffstat (limited to 'plugin/test')
-rw-r--r-- | plugin/test/hello_plugin.c | 3 | ||||
-rw-r--r-- | plugin/test/plugin_test.c | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/plugin/test/hello_plugin.c b/plugin/test/hello_plugin.c new file mode 100644 index 0000000..1ab290f --- /dev/null +++ b/plugin/test/hello_plugin.c | |||
@@ -0,0 +1,3 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | void SayHello() { printf("Hello!\n"); } | ||
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; } | ||