libpurple/tests/test_purplepath.c

Wed, 14 Aug 2024 19:26:26 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 14 Aug 2024 19:26:26 -0500
changeset 42874
c53e5e1ff6b1
parent 42497
d00acd029d0d
permissions
-rw-r--r--

Remove uri handling from libpurple

Testing Done:
Called in the turtles.

Reviewed at https://reviews.imfreedom.org/r/3387/

41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
1 #include <glib.h>
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
2
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
3 #include <purple.h>
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
4
41735
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
5 #include "test_ui.h"
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
6
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
7 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
8 test_purplepath_cache_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
9 gchar *cache_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
10
41735
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
11 cache_dir = g_build_filename(g_get_user_cache_dir(), "test", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
12 g_assert_cmpstr(cache_dir, ==, purple_cache_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
13 g_free(cache_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
14 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
15
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
16 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
17 test_purplepath_config_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
18 gchar *config_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
19
41735
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
20 config_dir = g_build_filename(g_get_user_config_dir(), "test", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
21 g_assert_cmpstr(config_dir, ==, purple_config_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
22 g_free(config_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
23 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
24
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
25 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
26 test_purplepath_data_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
27 gchar *data_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
28
41735
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
29 data_dir = g_build_filename(g_get_user_data_dir(), "test", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
30 g_assert_cmpstr(data_dir, ==, purple_data_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
31 g_free(data_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
32 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
33
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
34 gint
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
35 main(gint argc, gchar **argv) {
42184
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
36 gint ret = 0;
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
37
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
38 g_test_init(&argc, &argv, NULL);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
39
41735
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
40 test_ui_purple_init();
c9b476c9c9d2 Fix the purplepath unit tests by setting up the test ui and fixing the paths we validate
Gary Kramlich <grim@reaperworld.com>
parents: 41243
diff changeset
41
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
42 g_test_add_func("/purplepath/cachedir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
43 test_purplepath_cache_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
44 g_test_add_func("/purplepath/configdir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
45 test_purplepath_config_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
46 g_test_add_func("/purplepath/datadir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
47 test_purplepath_data_dir);
42184
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
48
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
49 ret = g_test_run();
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
50
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
51 test_ui_purple_uninit();
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
52
4e1bf25f5575 Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41735
diff changeset
53 return ret;
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
54 }

mercurial