[gnome-logs/wip/test: 22/44] Update mock files and Makefile.am
- From: Rashi Aswani <aswanirashi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/test: 22/44] Update mock files and Makefile.am
- Date: Sun, 16 Aug 2015 20:49:13 +0000 (UTC)
commit 924d3cc6e3e22d40fd979e2222efad013e874bf1
Author: Rashi Aswani <aswanirashi19 gmail com>
Date: Fri Jun 12 20:00:46 2015 +0530
Update mock files and Makefile.am
Makefile.am | 16 ++++++----------
tests/gl-journal-mock.c | 28 ++++++++++++----------------
tests/gl-journal-mock.h | 12 ++++++------
3 files changed, 24 insertions(+), 32 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 3759fe6..28b1065 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
DISTCHECK_CONFIGURE_FLAGS = \
--enable-appstream-util \
- --enable-tests
+ --enable-tests=yes
SUBDIRS = help po
@@ -107,8 +107,6 @@ endif
if LOGS_ENABLE_TESTS
tests/basic.py: gnome-logs
-tests/gl-journal-mock.c: gnome-logs
-tests/gl-journal-mock.h: gnome-logs
test-desktop-file-validate.sh: Makefile
$(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
@@ -147,15 +145,15 @@ tests_test_gl_util_SOURCES = \
tests/test-gl-util.c \
src/gl-util.c
-tests_test_gl_journal_CFLAGS = \
+tests_gl_journal_mock_CFLAGS = \
$(LOGS_CFLAGS)
-tests_test_gl_journal_SOURCES = \
- tests/gl-journal-mock.c
+tests_gl_journal_mock_SOURCES = \
+ tests/gl-journal-mock.c \
src/gl-journal.c
check_PROGRAMS = \
- tests/test-gl-util
+ tests/test-gl-util \
tests/gl-journal-mock
TESTS = \
@@ -242,9 +240,7 @@ dist_noinst_DATA = \
dist_noinst_SCRIPTS = \
autogen.sh \
- tests/basic.py \
- tests/gl-journal-mock.c \
- tests/gl-journal-mock.h
+ tests/basic.py
dist-hook: git-changelog-hook
diff --git a/tests/gl-journal-mock.c b/tests/gl-journal-mock.c
index f0fa533..7b16c7c 100644
--- a/tests/gl-journal-mock.c
+++ b/tests/gl-journal-mock.c
@@ -38,7 +38,7 @@ struct MockGlJournalEntry
guint priority;
};
-G_DEFINE_TYPE (MockGlJournalEntry, gl_journal_entry, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MockGlJournalEntry, mock_gl_journal_entry, G_TYPE_OBJECT);
typedef struct
{
@@ -47,7 +47,7 @@ typedef struct
gchar **mandatory_fields;
} MockGlJournalPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (MockGlJournal, gl_journal, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (MockGlJournal, mock_gl_journal, G_TYPE_OBJECT)
GQuark
mock_gl_journal_error_quark (void)
@@ -66,15 +66,15 @@ mock_gl_journal_finalize (GObject *object)
}
static void
-mock_gl_journal_class_init (GlJournalClass *klass)
+mock_gl_journal_class_init (MockGlJournalClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = gl_journal_finalize;
+ gobject_class->finalize = mock_gl_journal_finalize;
}
static void
-mock_gl_journal_init (GlJournal *self)
+mock_gl_journal_init (MockGlJournal *self)
{
}
@@ -98,7 +98,7 @@ gl_journal_mock_get_data (MockGlJournal *self,
}
static MockGlJournalEntry *
-gl_journal_mock_query_entry (GlJournal *self)
+gl_journal_mock_query_entry (MockGlJournal *self)
{
MockGlJournalPrivate *priv;
MockGlJournalEntry *entry;
@@ -116,8 +116,6 @@ gl_journal_mock_query_entry (GlJournal *self)
{
g_warning ("%s", error->message);
g_clear_error (&error);
- free (entry->cursor);
- free (entry->catalog);
goto out;
}
@@ -127,8 +125,6 @@ gl_journal_mock_query_entry (GlJournal *self)
{
g_warning ("%s", error->message);
g_clear_error (&error);
- free (entry->cursor);
- free (entry->catalog);
g_free (entry->message);
goto out;
}
@@ -171,8 +167,8 @@ out:
* beginning.
*/
void
-gl_journal_mock_set_matches (GlJournal *journal,
- const gchar * const *matches)
+gl_journal_mock_set_matches (MockGlJournal *journal,
+ const gchar * const *matches)
{
MockGlJournalPrivate *priv = gl_journal_get_instance_private (journal);
GPtrArray *mandatory_fields;
@@ -211,10 +207,10 @@ gl_journal_mock_set_matches (GlJournal *journal,
MockGlJournalEntry *
_gl_journal_mock_previous (MockGlJournal *journal)
{
- return _gl_journal_query_entry (journal);
+ return gl_journal_mock_query_entry (journal);
}
-GlJournal *
+MockGlJournal *
gl_journal_mock_new (void)
{
return g_object_new (GL_TYPE_JOURNAL, NULL);
@@ -237,7 +233,7 @@ gl_journal_mock_entry_finalize (GObject *object)
g_free (entry->kernel_device);
g_free (entry->audit_session);
- G_OBJECT_CLASS (gl_journal_entry_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gl_journal_mock_entry_parent_class)->finalize (object);
}
static void
@@ -245,7 +241,7 @@ gl_journal_mock_entry_class_init (MockGlJournalEntryClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = gl_journal_entry_finalize;
+ object_class->finalize = gl_journal_mock_entry_finalize;
}
guint64
diff --git a/tests/gl-journal-mock.h b/tests/gl-journal-mock.h
index f41554b..4754466 100644
--- a/tests/gl-journal-mock.h
+++ b/tests/gl-journal-mock.h
@@ -39,12 +39,12 @@ typedef enum
GL_JOURNAL_ERROR_FAILED
} MockGlJournalError;
-#define GL_JOURNAL_ERROR gl_journal_error_quark ()
+#define MOCK_GL_JOURNAL_ERROR mock_gl_journal_error_quark ()
GQuark mock_gl_journal_error_quark (void);
-#define GL_TYPE_JOURNAL_ENTRY gl_journal_entry_get_type()
-G_DECLARE_FINAL_TYPE (MockGlJournalEntry, gl_journal_entry, GL, JOURNAL_ENTRY, GObject)
+#define MOCK_GL_TYPE_JOURNAL_ENTRY mock_gl_journal_entry_get_type()
+G_DECLARE_FINAL_TYPE (MockGlJournalEntry, mock_gl_journal_entry, GL, JOURNAL_ENTRY, GObject)
typedef struct
{
@@ -58,14 +58,14 @@ typedef struct
GObjectClass parent_class;
} MockGlJournalClass;
-#define GL_TYPE_JOURNAL (gl_journal_get_type ())
-#define GL_JOURNAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GL_TYPE_JOURNAL, GlJournal))
+#define MOCK_GL_TYPE_JOURNAL (mock_gl_journal_get_type ())
+#define MOCK_GL_JOURNAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GL_TYPE_JOURNAL, MockGlJournal))
GType gl_journal_mock_result_get_type (void);
GType gl_journal_mock_get_type (void);
void gl_journal_mock_set_matches (MockGlJournal *journal, const gchar * const *matches);
MockGlJournalEntry * gl_journal_mock_previous (MockGlJournal *journal);
-GlJournal * gl_journal_mock_new (void);
+MockGlJournal * gl_journal_mock_new (void);
guint64 gl_journal_mock_entry_get_timestamp (MockGlJournalEntry *entry);
const gchar * gl_journal_mock_entry_get_message (MockGlJournalEntry *entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]