Commit e1d94030 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.3.1'

parents b6ec0135 548589be
...@@ -286,7 +286,7 @@ girara_list_iterator_remove(girara_list_iterator_t* iter) { ...@@ -286,7 +286,7 @@ girara_list_iterator_remove(girara_list_iterator_t* iter) {
} }
GList* el = iter->element; GList* el = iter->element;
if (iter->list != NULL && iter->list->free != NULL) { if (iter->list->free != NULL) {
(iter->list->free)(iter->element->data); (iter->list->free)(iter->element->data);
} }
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
#include "input-history.h" #include "input-history.h"
#include "datastructures.h" #include "datastructures.h"
G_DEFINE_TYPE(GiraraInputHistory, girara_input_history, G_TYPE_OBJECT)
/** /**
* Private data of the settings manager * Private data of the input history
*/ */
typedef struct ih_private_s { typedef struct ih_private_s {
girara_list_t* history; /**< List of stored inputs */ girara_list_t* history; /**< List of stored inputs */
...@@ -15,11 +13,9 @@ typedef struct ih_private_s { ...@@ -15,11 +13,9 @@ typedef struct ih_private_s {
size_t current_match; size_t current_match;
GiraraInputHistoryIO* io; GiraraInputHistoryIO* io;
char* command_line; char* command_line;
} ih_private_t; } GiraraInputHistoryPrivate;
#define GIRARA_INPUT_HISTORY_GET_PRIVATE(obj) \ G_DEFINE_TYPE_WITH_CODE(GiraraInputHistory, girara_input_history, G_TYPE_OBJECT, G_ADD_PRIVATE(GiraraInputHistory))
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIRARA_TYPE_INPUT_HISTORY, \
ih_private_t))
/* Methods */ /* Methods */
static void ih_dispose(GObject* object); static void ih_dispose(GObject* object);
...@@ -46,9 +42,6 @@ enum { ...@@ -46,9 +42,6 @@ enum {
static void static void
girara_input_history_class_init(GiraraInputHistoryClass* class) girara_input_history_class_init(GiraraInputHistoryClass* class)
{ {
/* add private members */
g_type_class_add_private(class, sizeof(ih_private_t));
/* overwrite methods */ /* overwrite methods */
GObjectClass* object_class = G_OBJECT_CLASS(class); GObjectClass* object_class = G_OBJECT_CLASS(class);
object_class->dispose = ih_dispose; object_class->dispose = ih_dispose;
...@@ -74,7 +67,7 @@ girara_input_history_class_init(GiraraInputHistoryClass* class) ...@@ -74,7 +67,7 @@ girara_input_history_class_init(GiraraInputHistoryClass* class)
static void static void
girara_input_history_init(GiraraInputHistory* history) girara_input_history_init(GiraraInputHistory* history)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(history); GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(history);
priv->history = girara_list_new2((girara_free_function_t) g_free); priv->history = girara_list_new2((girara_free_function_t) g_free);
priv->reset = true; priv->reset = true;
priv->io = NULL; priv->io = NULL;
...@@ -84,7 +77,8 @@ girara_input_history_init(GiraraInputHistory* history) ...@@ -84,7 +77,8 @@ girara_input_history_init(GiraraInputHistory* history)
static void static void
ih_dispose(GObject* object) ih_dispose(GObject* object)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(object); GiraraInputHistory* ih = GIRARA_INPUT_HISTORY(object);
GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(ih);
g_clear_object(&priv->io); g_clear_object(&priv->io);
...@@ -95,7 +89,8 @@ ih_dispose(GObject* object) ...@@ -95,7 +89,8 @@ ih_dispose(GObject* object)
static void static void
ih_finalize(GObject* object) ih_finalize(GObject* object)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(object); GiraraInputHistory* ih = GIRARA_INPUT_HISTORY(object);
GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(ih);
girara_list_free(priv->history); girara_list_free(priv->history);
g_free(priv->command_line); g_free(priv->command_line);
...@@ -107,7 +102,8 @@ static void ...@@ -107,7 +102,8 @@ static void
ih_set_property(GObject* object, guint prop_id, const GValue* value, ih_set_property(GObject* object, guint prop_id, const GValue* value,
GParamSpec* pspec) GParamSpec* pspec)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(object); GiraraInputHistory* ih = GIRARA_INPUT_HISTORY(object);
GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(ih);
switch (prop_id) { switch (prop_id) {
case PROP_IO: { case PROP_IO: {
...@@ -130,7 +126,8 @@ static void ...@@ -130,7 +126,8 @@ static void
ih_get_property(GObject* object, guint prop_id, GValue* value, ih_get_property(GObject* object, guint prop_id, GValue* value,
GParamSpec* pspec) GParamSpec* pspec)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(object); GiraraInputHistory* ih = GIRARA_INPUT_HISTORY(object);
GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(ih);
switch (prop_id) { switch (prop_id) {
case PROP_IO: case PROP_IO:
...@@ -170,7 +167,7 @@ ih_append(GiraraInputHistory* history, const char* input) ...@@ -170,7 +167,7 @@ ih_append(GiraraInputHistory* history, const char* input)
girara_list_append(list, g_strdup(input)); girara_list_append(list, g_strdup(input));
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(history); GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(history);
if (priv->io != NULL) { if (priv->io != NULL) {
girara_input_history_io_append(priv->io, input); girara_input_history_io_append(priv->io, input);
} }
...@@ -182,14 +179,14 @@ ih_append(GiraraInputHistory* history, const char* input) ...@@ -182,14 +179,14 @@ ih_append(GiraraInputHistory* history, const char* input)
static girara_list_t* static girara_list_t*
ih_list(GiraraInputHistory* history) ih_list(GiraraInputHistory* history)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(history); GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(history);
return priv->history; return priv->history;
} }
static const char* static const char*
find_next(GiraraInputHistory* history, const char* current_input, bool next) find_next(GiraraInputHistory* history, const char* current_input, bool next)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(history); GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(history);
girara_list_t* list = girara_input_history_list(history); girara_list_t* list = girara_input_history_list(history);
if (list == NULL) { if (list == NULL) {
...@@ -232,8 +229,6 @@ find_next(GiraraInputHistory* history, const char* current_input, bool next) ...@@ -232,8 +229,6 @@ find_next(GiraraInputHistory* history, const char* current_input, bool next)
} else { } else {
++priv->current; ++priv->current;
} }
} else {
return NULL;
} }
command = girara_list_nth(list, priv->current); command = girara_list_nth(list, priv->current);
...@@ -271,7 +266,7 @@ ih_previous(GiraraInputHistory* history, const char* current_input) ...@@ -271,7 +266,7 @@ ih_previous(GiraraInputHistory* history, const char* current_input)
static void static void
ih_reset(GiraraInputHistory* history) ih_reset(GiraraInputHistory* history)
{ {
ih_private_t* priv = GIRARA_INPUT_HISTORY_GET_PRIVATE(history); GiraraInputHistoryPrivate* priv = girara_input_history_get_instance_private(history);
priv->reset = true; priv->reset = true;
if (priv->io != NULL) { if (priv->io != NULL) {
......
...@@ -449,12 +449,12 @@ girara_session_init(girara_session_t* session, const char* sessionname) ...@@ -449,12 +449,12 @@ girara_session_init(girara_session_t* session, const char* sessionname)
char* guioptions = NULL; char* guioptions = NULL;
girara_setting_get(session, "guioptions", &guioptions); girara_setting_get(session, "guioptions", &guioptions);
const bool show_hscrollbar = strchr(guioptions, 'h') != NULL; const bool show_hscrollbar = guioptions != NULL && strchr(guioptions, 'h') != NULL;
const bool show_vscrollbar = strchr(guioptions, 'v') != NULL; const bool show_vscrollbar = guioptions != NULL && strchr(guioptions, 'v') != NULL;
g_free(guioptions);
scrolled_window_set_scrollbar_visibility( scrolled_window_set_scrollbar_visibility(
GTK_SCROLLED_WINDOW(session->gtk.view), show_hscrollbar, show_vscrollbar); GTK_SCROLLED_WINDOW(session->gtk.view), show_hscrollbar, show_vscrollbar);
g_free(guioptions);
/* viewport */ /* viewport */
gtk_container_add(GTK_CONTAINER(session->gtk.view), session->gtk.viewport); gtk_container_add(GTK_CONTAINER(session->gtk.view), session->gtk.viewport);
...@@ -562,10 +562,10 @@ girara_session_init(girara_session_t* session, const char* sessionname) ...@@ -562,10 +562,10 @@ girara_session_init(girara_session_t* session, const char* sessionname)
char* window_icon = NULL; char* window_icon = NULL;
girara_setting_get(session, "window-icon", &window_icon); girara_setting_get(session, "window-icon", &window_icon);
if (window_icon != NULL) { if (window_icon != NULL && strlen(window_icon) != 0) {
girara_set_window_icon(session, window_icon); girara_set_window_icon(session, window_icon);
g_free(window_icon);
} }
g_free(window_icon);
gtk_widget_grab_focus(GTK_WIDGET(session->gtk.view)); gtk_widget_grab_focus(GTK_WIDGET(session->gtk.view));
...@@ -888,6 +888,11 @@ girara_set_window_icon(girara_session_t* session, const char* name) ...@@ -888,6 +888,11 @@ girara_set_window_icon(girara_session_t* session, const char* name)
return false; return false;
} }
if (strlen(name) == 0) {
girara_warning("Empty icon name.");
return false;
}
GtkWindow* window = GTK_WINDOW(session->gtk.window); GtkWindow* window = GTK_WINDOW(session->gtk.window);
char* path = girara_fix_path(name); char* path = girara_fix_path(name);
bool success = true; bool success = true;
......
...@@ -218,7 +218,7 @@ girara_isc_string_manipulation(girara_session_t* session, girara_argument_t* arg ...@@ -218,7 +218,7 @@ girara_isc_string_manipulation(girara_session_t* session, girara_argument_t* arg
} }
/* find the beginning of the word */ /* find the beginning of the word */
while ((i == (pos - 1)) || ((i > 0) && !strchr(separator, input[i]))) { while ((i == (pos - 1)) || ((i > 0) && separator != NULL && !strchr(separator, input[i]))) {
i--; i--;
} }
...@@ -554,7 +554,7 @@ girara_sc_feedkeys(girara_session_t* session, girara_argument_t* argument, ...@@ -554,7 +554,7 @@ girara_sc_feedkeys(girara_session_t* session, girara_argument_t* argument,
} }
/* Possible special key */ /* Possible special key */
} else { } else {
for (unsigned int j = 0; i < LENGTH(gdk_keyboard_buttons); ++j) { for (unsigned int j = 0; j < LENGTH(gdk_keyboard_buttons); ++j) {
if (g_strcmp0(tmp, gdk_keyboard_buttons[j].identifier) == 0) { if (g_strcmp0(tmp, gdk_keyboard_buttons[j].identifier) == 0) {
keyval = gdk_keyboard_buttons[j].keyval; keyval = gdk_keyboard_buttons[j].keyval;
found = true; found = true;
...@@ -743,15 +743,13 @@ simulate_key_press(girara_session_t* session, int state, int key) ...@@ -743,15 +743,13 @@ simulate_key_press(girara_session_t* session, int state, int key)
GdkEvent* event = gdk_event_new(GDK_KEY_PRESS); GdkEvent* event = gdk_event_new(GDK_KEY_PRESS);
event->key.type = GDK_KEY_PRESS; event->any.type = GDK_KEY_PRESS;
event->key.window = gtk_widget_get_parent_window(GTK_WIDGET(session->gtk.box)); event->key.window = g_object_ref(gtk_widget_get_parent_window(GTK_WIDGET(session->gtk.box)));
event->key.send_event = false; event->key.send_event = false;
event->key.time = GDK_CURRENT_TIME; event->key.time = GDK_CURRENT_TIME;
event->key.state = state; event->key.state = state;
event->key.keyval = key; event->key.keyval = key;
g_object_ref(event->key.window);
GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(session->gtk.box)); GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(session->gtk.box));
GdkKeymapKey* keys = NULL; GdkKeymapKey* keys = NULL;
gint number_of_keys = 0; gint number_of_keys = 0;
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include <glib.h> #include <glib.h>
G_DEFINE_TYPE(GiraraTemplate, girara_template, G_TYPE_OBJECT)
/** /**
* Private data of the template * Private data of the template
*/ */
...@@ -18,12 +16,9 @@ typedef struct private_s { ...@@ -18,12 +16,9 @@ typedef struct private_s {
girara_list_t* variables_in_base; girara_list_t* variables_in_base;
girara_list_t* variables; girara_list_t* variables;
bool valid; bool valid;
} private_t; } GiraraTemplatePrivate;
typedef struct private_s GiraraTemplatePrivate;
#define GET_PRIVATE(obj) \ G_DEFINE_TYPE_WITH_CODE(GiraraTemplate, girara_template, G_TYPE_OBJECT, G_ADD_PRIVATE(GiraraTemplate))
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GIRARA_TYPE_TEMPLATE, private_t))
/** /**
* Internal variables * Internal variables
...@@ -109,9 +104,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; ...@@ -109,9 +104,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void static void
girara_template_class_init(GiraraTemplateClass* class) girara_template_class_init(GiraraTemplateClass* class)
{ {
/* add private members */
g_type_class_add_private(class, sizeof(private_t));
/* overwrite methods */ /* overwrite methods */
GObjectClass* object_class = G_OBJECT_CLASS(class); GObjectClass* object_class = G_OBJECT_CLASS(class);
object_class->dispose = dispose; object_class->dispose = dispose;
...@@ -184,7 +176,7 @@ girara_template_init(GiraraTemplate* history) ...@@ -184,7 +176,7 @@ girara_template_init(GiraraTemplate* history)
g_error_free(error); g_error_free(error);
} }
private_t* priv = GET_PRIVATE(history); GiraraTemplatePrivate* priv = girara_template_get_instance_private(history);
priv->base = g_strdup(""); priv->base = g_strdup("");
priv->variable_regex = regex; priv->variable_regex = regex;
priv->variable_check_regex = check_regex; priv->variable_check_regex = check_regex;
...@@ -197,7 +189,8 @@ girara_template_init(GiraraTemplate* history) ...@@ -197,7 +189,8 @@ girara_template_init(GiraraTemplate* history)
static void static void
dispose(GObject* object) dispose(GObject* object)
{ {
private_t* priv = GET_PRIVATE(object); GiraraTemplate* obj = GIRARA_TEMPLATE(object);
GiraraTemplatePrivate* priv = girara_template_get_instance_private(obj);
g_regex_unref(priv->variable_regex); g_regex_unref(priv->variable_regex);
g_regex_unref(priv->variable_check_regex); g_regex_unref(priv->variable_check_regex);
...@@ -212,7 +205,8 @@ dispose(GObject* object) ...@@ -212,7 +205,8 @@ dispose(GObject* object)
static void static void
finalize(GObject* object) finalize(GObject* object)
{ {
private_t* priv = GET_PRIVATE(object); GiraraTemplate* obj = GIRARA_TEMPLATE(object);
GiraraTemplatePrivate* priv = girara_template_get_instance_private(obj);
g_free(priv->base); g_free(priv->base);
girara_list_free(priv->variables_in_base); girara_list_free(priv->variables_in_base);
...@@ -264,9 +258,6 @@ girara_template_new(const char* base) ...@@ -264,9 +258,6 @@ girara_template_new(const char* base)
{ {
GObject* obj = g_object_new(GIRARA_TYPE_TEMPLATE, NULL); GObject* obj = g_object_new(GIRARA_TYPE_TEMPLATE, NULL);
g_return_val_if_fail(obj, NULL); g_return_val_if_fail(obj, NULL);
if (obj == NULL) {
return NULL;
}
GiraraTemplate* object = GIRARA_TEMPLATE(obj); GiraraTemplate* object = GIRARA_TEMPLATE(obj);
if (base != NULL) { if (base != NULL) {
...@@ -280,7 +271,7 @@ girara_template_set_base(GiraraTemplate* object, const char* base) ...@@ -280,7 +271,7 @@ girara_template_set_base(GiraraTemplate* object, const char* base)
{ {
g_return_if_fail(GIRARA_IS_TEMPLATE(object)); g_return_if_fail(GIRARA_IS_TEMPLATE(object));
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
if (g_strcmp0(base, priv->base) != 0) { if (g_strcmp0(base, priv->base) != 0) {
g_free(priv->base); g_free(priv->base);
priv->base = g_strdup(base != NULL ? base : ""); priv->base = g_strdup(base != NULL ? base : "");
...@@ -295,14 +286,14 @@ girara_template_get_base(GiraraTemplate* object) ...@@ -295,14 +286,14 @@ girara_template_get_base(GiraraTemplate* object)
{ {
g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL); g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL);
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
return priv->base; return priv->base;
} }
static void static void
base_changed(GiraraTemplate* object) base_changed(GiraraTemplate* object)
{ {
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
girara_list_clear(priv->variables_in_base); girara_list_clear(priv->variables_in_base);
priv->valid = true; priv->valid = true;
...@@ -336,7 +327,7 @@ base_changed(GiraraTemplate* object) ...@@ -336,7 +327,7 @@ base_changed(GiraraTemplate* object)
static void static void
variable_changed(GiraraTemplate* object, const char* GIRARA_UNUSED(name)) variable_changed(GiraraTemplate* object, const char* GIRARA_UNUSED(name))
{ {
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
priv->valid = true; priv->valid = true;
GIRARA_LIST_FOREACH_BODY(priv->variables_in_base, char*, variable, GIRARA_LIST_FOREACH_BODY(priv->variables_in_base, char*, variable,
...@@ -358,7 +349,7 @@ girara_template_referenced_variables(GiraraTemplate* object) ...@@ -358,7 +349,7 @@ girara_template_referenced_variables(GiraraTemplate* object)
{ {
g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL); g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL);
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
return priv->variables_in_base; return priv->variables_in_base;
} }
...@@ -368,7 +359,7 @@ girara_template_add_variable(GiraraTemplate* object, const char* name) ...@@ -368,7 +359,7 @@ girara_template_add_variable(GiraraTemplate* object, const char* name)
g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), false); g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), false);
g_return_val_if_fail(name != NULL, false); g_return_val_if_fail(name != NULL, false);
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
if (g_regex_match(priv->variable_check_regex, name, 0, NULL) == FALSE) { if (g_regex_match(priv->variable_check_regex, name, 0, NULL) == FALSE) {
girara_debug("'%s' is not a valid variable name.", name); girara_debug("'%s' is not a valid variable name.", name);
...@@ -403,7 +394,7 @@ girara_template_set_variable_value(GiraraTemplate* object, const char* name, ...@@ -403,7 +394,7 @@ girara_template_set_variable_value(GiraraTemplate* object, const char* name,
g_return_if_fail(name != NULL); g_return_if_fail(name != NULL);
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
variable_t* variable = girara_list_find(priv->variables, compare_variable_name, variable_t* variable = girara_list_find(priv->variables, compare_variable_name,
name); name);
...@@ -442,7 +433,7 @@ girara_template_evaluate(GiraraTemplate* object) ...@@ -442,7 +433,7 @@ girara_template_evaluate(GiraraTemplate* object)
{ {
g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL); g_return_val_if_fail(GIRARA_IS_TEMPLATE(object), NULL);
private_t* priv = GET_PRIVATE(object); GiraraTemplatePrivate* priv = girara_template_get_instance_private(object);
if (priv->valid == false) { if (priv->valid == false) {
girara_error("Base contains variables that do not have a value assigned."); girara_error("Base contains variables that do not have a value assigned.");
return NULL; return NULL;
......
project('girara', 'c', project('girara', 'c',
version: '0.3.0', version: '0.3.1',
meson_version: '>=0.43', meson_version: '>=0.43',
default_options: 'c_std=c11', default_options: 'c_std=c11',
) )
...@@ -24,7 +24,7 @@ conf_data.set('GVMINOR', version_array[1]) ...@@ -24,7 +24,7 @@ conf_data.set('GVMINOR', version_array[1])
conf_data.set('GVREV', version_array[2]) conf_data.set('GVREV', version_array[2])
conf_data.set('version', version) conf_data.set('version', version)
cc = meson.get_compiler('c', required: false) cc = meson.get_compiler('c')
prefix = get_option('prefix') prefix = get_option('prefix')
localedir = get_option('localedir') localedir = get_option('localedir')
......
option('enable-notify', option('enable-notify',
type: 'boolean', type: 'boolean',
value: true, value: false,
description: 'Enable libnotify support if available.' description: 'Enable libnotify support if available.'
) )
option('enable-json', option('enable-json',
......
...@@ -7,23 +7,61 @@ if check.found() ...@@ -7,23 +7,61 @@ if check.found()
include_directories += [ include_directories('../girara') ] include_directories += [ include_directories('../girara') ]
test_sources = [
'tests.c',
'test_config.c',
'test_datastructures.c',
'test_session.c',
'test_setting.c',
'test_template.c',
'test_utils.c'
]
xdg_test_helper = executable('xdg_test_helper', 'xdg_test_helper.c', xdg_test_helper = executable('xdg_test_helper', 'xdg_test_helper.c',
dependencies: [ glib, declare_dependency(link_with: girara) ], dependencies: [ glib, declare_dependency(link_with: girara) ],
include_directories: include_directories, include_directories: include_directories,
c_args: defines + flags c_args: defines + flags
) )
tests = executable('tests', test_sources, config = executable('test_config', ['test_config.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('config', config,
timeout: 60*60,
is_parallel: false
)
datastructures = executable('test_datastructures', ['test_datastructures.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('datastructures', datastructures,
timeout: 60*60
)
session = executable('test_session', ['test_session.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('session', session,
timeout: 60*60,
is_parallel: false
)
setting = executable('test_setting', ['test_setting.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('setting', setting,
timeout: 60*60,
is_parallel: false
)
template = executable('test_template', ['test_template.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('template', template,
timeout: 60*60
)
utils = executable('test_utils', ['test_utils.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies, dependencies: build_dependencies + test_dependencies,
include_directories: include_directories, include_directories: include_directories,
c_args: defines + flags c_args: defines + flags
...@@ -32,10 +70,9 @@ if check.found() ...@@ -32,10 +70,9 @@ if check.found()
env = environment() env = environment()
env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir()) env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
env.set('HOME', '/home/test') env.set('HOME', '/home/test')
test('tests-with-home', tests, test('utils-with-home', utils,
env: env, env: env,
timeout: 60*60, timeout: 60*60
is_parallel: false
) )
env_bin = find_program('env', required: false) env_bin = find_program('env', required: false)
...@@ -43,11 +80,10 @@ if check.found() ...@@ -43,11 +80,10 @@ if check.found()
env = environment() env = environment()
env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir()) env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
test('tests-without-home', env_bin, test('utils-without-home', env_bin,
args: ['-u', 'HOME', tests], args: ['-u', 'HOME', utils],
env: env, env: env,
timeout: 60*60, timeout: 60*60
is_parallel: false
) )
endif endif
endif endif
...@@ -49,7 +49,7 @@ START_TEST(test_config_parse) { ...@@ -49,7 +49,7 @@ START_TEST(test_config_parse) {
girara_session_destroy(session); girara_session_destroy(session);
} END_TEST } END_TEST
Suite* suite_config(void) static Suite* suite_config(void)
{ {
TCase* tcase = NULL; TCase* tcase = NULL;
Suite* suite = suite_create("Config"); Suite* suite = suite_create("Config");
...@@ -62,3 +62,8 @@ Suite* suite_config(void) ...@@ -62,3 +62,8 @@ Suite* suite_config(void)
return suite; return suite;
} }
int main()
{
return run_suite(suite_config());
}
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <glib.h> #include <glib.h>
#include <stdint.h> #include <stdint.h>
#include <datastructures.h> #include <datastructures.h>
#include <macros.h>
#include <log.h>
#include "tests.h" #include "tests.h"
...@@ -361,13 +363,28 @@ START_TEST(test_datastructures_list_prepend) { ...@@ -361,13 +363,28 @@ START_TEST(test_datastructures_list_prepend) {
girara_list_free(list); girara_list_free(list);
} END_TEST } END_TEST
Suite* suite_datastructures(void) static void
critical_print(const gchar* GIRARA_UNUSED(log_domain), GLogLevelFlags GIRARA_UNUSED(log_level),
const gchar* message, gpointer GIRARA_UNUSED(user_data))
{
girara_debug("expected glib critical: %s", message);
}
static void
setup_logger(void)
{
g_log_set_handler(NULL, G_LOG_LEVEL_CRITICAL, critical_print, NULL);
}
static Suite*
suite_datastructures(void)