aboutsummaryrefslogtreecommitdiff
path: root/plugin/test/plugin_test.c
blob: d31bab6aafd5c0cc983e7416b3b6f0e603ad325b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "plugin.h"

#include "test.h"

#include <stdio.h>

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; }