blob: 744c48e4987cac7175e6a267208855ab81486d40 (
plain) (
blame)
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
32
33
34
35
36
37
38
39
40
|
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <cmocka.h>
#include <glib.h>
#include <stdio.h>
#include <unistd.h>
#include "common.h"
#include "config/preferences.h"
void create_config_file(void **state)
{
setenv("XDG_CONFIG_HOME", "./tests/files/xdg_config_home", 1);
gchar *xdg_config = xdg_get_config_home();
GString *profanity_dir = g_string_new(xdg_config);
g_string_append(profanity_dir, "/profanity");
if (!mkdir_recursive(profanity_dir->str)) {
assert_true(FALSE);
}
g_string_free(profanity_dir, TRUE);
FILE *f = fopen("./tests/files/xdg_config_home/profanity/profrc", "ab+");
if (f) {
g_free(xdg_config);
prefs_load();
}
}
void delete_config_file(void **state)
{
prefs_close();
remove("./tests/files/xdg_config_home/profanity/profrc");
rmdir("./tests/files/xdg_config_home/profanity");
rmdir("./tests/files/xdg_config_home");
rmdir("./tests/files");
}
|