Work around quote change in assertion messages

glib-2.38 changed the leading quote from ` to ', e.g.
"assertion `foo' failed" to "assertion 'foo' failed".

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23207 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2013-10-03 21:39:59 +00:00
parent 413aa58c40
commit 44af452d48
7 changed files with 73 additions and 30 deletions

View File

@ -255,23 +255,31 @@ fi
# We first check for other versions due to deprecations.
# 2.36 deprecated g_type_init
# 2.32 deprecated some gthread functions
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.36 gthread-2.0 gobject-2.0 gmodule-2.0,
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.38 gthread-2.0 gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= 2.32 gthread-2.0 gobject-2.0 gmodule-2.0,
glib-2.0 >= 2.36 gthread-2.0 gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= 2.32 gthread-2.0 gobject-2.0 gmodule-2.0,
[
AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
],
[
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= 2.28 gthread-2.0 gobject-2.0 gmodule-2.0)
])
])
])
AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
# I'm sure we (used to?) require this in various places, so don't remove

View File

@ -32,6 +32,11 @@
#include "../Transaction.h"
#include "../gnc-lot.h"
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "" _Q ""
#endif
static const gchar *suitename = "/engine/Account";
void test_suite_account (void);
@ -457,7 +462,7 @@ test_gnc_account_list_name_violations (Fixture *fixture, gconstpointer pData)
{
guint log_level = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
gchar *log_domain = "gnc.engine";
gchar *msg = "gnc_account_list_name_violations: assertion `separator != NULL' failed";
gchar *msg = "gnc_account_list_name_violations: assertion " _Q "separator != NULL' failed";
TestErrorStruct check = { log_level, log_domain, msg, 0 };
GList *results, *res_iter;
gchar *sep = ":";
@ -738,8 +743,8 @@ test_xaccCloneAccount (Fixture *fixture, gconstpointer pData)
Account *clone;
QofBook *book = gnc_account_get_book (fixture->acct);
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
gchar *msg1 = "xaccCloneAccount: assertion `GNC_IS_ACCOUNT(from)' failed";
gchar *msg2 = "xaccCloneAccount: assertion `QOF_IS_BOOK(book)' failed";
gchar *msg1 = "xaccCloneAccount: assertion " _Q "GNC_IS_ACCOUNT(from)' failed";
gchar *msg2 = "xaccCloneAccount: assertion " _Q "QOF_IS_BOOK(book)' failed";
TestErrorStruct check = { loglevel, "gnc.engine", msg1, 0 };
GLogFunc oldlogger;
AccountPrivate *acct_p, *clone_p;
@ -835,7 +840,7 @@ test_xaccFreeAccount (Fixture *fixture, gconstpointer pData)
{
gchar *msg1 = "[xaccFreeAccount()] instead of calling xaccFreeAccount(), please call \n"
" xaccAccountBeginEdit(); xaccAccountDestroy(); \n";
gchar *msg2 = "xaccTransGetSplitIndex: assertion `trans && split' failed";
gchar *msg2 = "xaccTransGetSplitIndex: assertion " _Q "trans && split' failed";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct check1 = { loglevel, "gnc.account", msg1, 0 };
TestErrorStruct check2 = { loglevel, "gnc.engine", msg2, 0 };
@ -943,7 +948,7 @@ test_xaccAccountCommitEdit (Fixture *fixture, gconstpointer pData)
{
gchar *msg1 = "[xaccFreeAccount()] instead of calling xaccFreeAccount(), please call \n"
" xaccAccountBeginEdit(); xaccAccountDestroy(); \n";
gchar *msg2 = "xaccTransGetSplitIndex: assertion `trans && split' failed";
gchar *msg2 = "xaccTransGetSplitIndex: assertion " _Q "trans && split' failed";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct check1 = { loglevel, "gnc.account", msg1, 0 };
TestErrorStruct check2 = { loglevel, "gnc.engine", msg2, 0 };
@ -1054,8 +1059,8 @@ test_gnc_account_insert_remove_split (Fixture *fixture, gconstpointer pData)
Split *split3 = xaccMallocSplit (book);
TestSignal sig1, sig2, sig3;
AccountPrivate *priv = fixture->func->get_private (fixture->acct);
gchar *msg1 = "gnc_account_insert_split: assertion `GNC_IS_ACCOUNT(acc)' failed";
gchar *msg2 = "gnc_account_insert_split: assertion `GNC_IS_SPLIT(s)' failed";
gchar *msg1 = "gnc_account_insert_split: assertion " _Q "GNC_IS_ACCOUNT(acc)' failed";
gchar *msg2 = "gnc_account_insert_split: assertion " _Q "GNC_IS_SPLIT(s)' failed";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
// gchar *log_domain = "gnc.engine";
TestErrorStruct check1 = { loglevel, "gnc.engine", msg1, 0 };

View File

@ -35,6 +35,12 @@
#include <gnc-event.h>
#include <qofbookslots.h>
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "" _Q ""
#endif
static const gchar *suitename = "/engine/Split";
void test_suite_split ( void );
@ -1262,7 +1268,7 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData)
Account *acc1 = xaccMallocAccount (book);
Account *acc2 = xaccMallocAccount (book);
Account *acc3 = xaccMallocAccount (book);
gchar *msg = "get_corr_account_split: assertion `sa' failed";
gchar *msg = "get_corr_account_split: assertion " _Q "sa' failed";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct *check = test_error_struct_new ("gnc.engine",
loglevel, msg);

View File

@ -36,6 +36,12 @@
#include <qofbookslots.h>
#include <qofbackend-p.h>
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "" _Q ""
#endif
static const gchar *suitename = "/engine/Transaction";
void test_suite_transaction ( void );
@ -406,7 +412,7 @@ test_gnc_transaction_set_get_property (Fixture *fixture, gconstpointer pData)
"GNR", "", 240), *t_curr = NULL;
Timespec now = timespec_now (), *t_entered = NULL, *t_posted = NULL;
time_t secs = (time_t)now.tv_sec;
gchar *msg1 = "g_object_set_valist: object class `Transaction' has no property named `bogus'";
gchar *msg1 = "g_object_set_valist: object class " _Q "Transaction' has no property named " _Q "bogus'";
gchar *msg2 = g_strdup_printf ("[xaccTransSetDateInternal] addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s",
txn, now.tv_sec, now.tv_nsec, ctime (&secs));
GLogLevelFlags loglevel1 = G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL;
@ -447,7 +453,7 @@ test_gnc_transaction_set_get_property (Fixture *fixture, gconstpointer pData)
g_assert_cmpint (check2->hits, ==, 2);
g_free (check1->msg);
check1->msg = g_strdup ("g_object_get_valist: object class `Transaction' has no property named `bogus'");
check1->msg = g_strdup ("g_object_get_valist: object class " _Q "Transaction' has no property named " _Q "bogus'");
g_object_get (G_OBJECT (txn),
"num", &t_num,
"description", &t_desc,
@ -480,7 +486,7 @@ test_xaccMallocTransaction (Fixture *fixture, gconstpointer pData)
QofBook *book = qof_book_new ();
TestSignal sig1 = test_signal_new (NULL, QOF_EVENT_CREATE,NULL);
Transaction *txn;
gchar *msg = "xaccMallocTransaction: assertion `book' failed";
gchar *msg = "xaccMallocTransaction: assertion " _Q "book' failed";
gchar *logdomain = "gnc.engine";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct *check = test_error_struct_new ("gnc.engine", loglevel,
@ -1259,7 +1265,7 @@ xaccTransGetAccountBalance (const Transaction *trans,// C: 1 Local: 0:0:0
static void
test_xaccTransGetAccountBalance (Fixture *fixture, gconstpointer pData)
{
gchar *msg1 = "xaccTransGetAccountBalance: assertion `account && trans' failed";
gchar *msg1 = "xaccTransGetAccountBalance: assertion " _Q "account && trans' failed";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
TestErrorStruct *check = test_error_struct_new ("gnc.engine", loglevel,
msg1);

View File

@ -35,6 +35,12 @@
# include "strptime.h"
#endif
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "" _Q ""
#endif
static const gchar *suitename = "/qof/gnc-date";
void test_suite_gnc_date ( void );
@ -63,7 +69,7 @@ test_gnc_localtime (void)
// difference between g_date_time and tm->tm_wday)
};
guint ind;
gchar *msg = "gnc_localtime_r: assertion `gdt != NULL' failed";
gchar *msg = "gnc_localtime_r: assertion " _Q "gdt != NULL' failed";
gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
gchar *logdomain = "qof";
TestErrorStruct check = {loglevel, logdomain, msg, 0};
@ -126,7 +132,7 @@ test_gnc_gmtime (void)
#endif
};
guint ind;
gchar *msg = "gnc_gmtime: assertion `gdt != NULL' failed";
gchar *msg = "gnc_gmtime: assertion " _Q "gdt != NULL' failed";
gint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
gchar *logdomain = "qof";
TestErrorStruct check = {loglevel, logdomain, msg, 0};
@ -1689,7 +1695,7 @@ test_gnc_timespec_to_iso8601_buff (void)
gchar *end;
gchar *logdomain = "qof";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
gchar *msg = "gnc_timespec_to_iso8601_buff: assertion `buff != NULL' failed";
gchar *msg = "gnc_timespec_to_iso8601_buff: assertion " _Q "buff != NULL' failed";
TestErrorStruct check = { loglevel, logdomain, msg, 0 };
GLogFunc oldlogger = g_log_set_default_handler ((GLogFunc)test_null_handler,
&check);

View File

@ -27,6 +27,12 @@
#include "../qofbook-p.h"
#include "../qofbookslots.h"
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
static const gchar *suitename = "/qof/qofbook";
void test_suite_qofbook ( void );
@ -604,8 +610,8 @@ test_book_foreach_collection( Fixture *fixture, gconstpointer pData )
G_GNUC_UNUSED QofCollection *m_col, *m_col2;
QofIdType my_type = "my_type", my_type2 = "my_type2";
guint param = (guint) g_test_rand_int();
gchar *msg1 = "qof_book_foreach_collection: assertion `book' failed";
gchar *msg2 = "qof_book_foreach_collection: assertion `cb' failed";
gchar *msg1 = "qof_book_foreach_collection: assertion " _Q "book' failed";
gchar *msg2 = "qof_book_foreach_collection: assertion " _Q "cb' failed";
gchar *log_domain = "qof";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL, hdlr;
TestErrorStruct check1 = { loglevel, log_domain, msg1 };
@ -628,7 +634,7 @@ test_book_foreach_collection( Fixture *fixture, gconstpointer pData )
qof_book_foreach_collection( NULL, mock_foreach_collection, (gpointer)(&param) );
g_assert( !col_struct.col1_called );
g_assert( !col_struct.col2_called );
g_assert_cmpstr( test_struct.msg, == , "qof_book_foreach_collection: assertion `book' failed" );
g_assert_cmpstr( test_struct.msg, == , "qof_book_foreach_collection: assertion " _Q "book' failed" );
g_free( test_struct.msg );
g_test_message( "Testing when cb is null" );
@ -636,7 +642,7 @@ test_book_foreach_collection( Fixture *fixture, gconstpointer pData )
qof_book_foreach_collection( fixture->book, NULL, (gpointer)(&param) );
g_assert( !col_struct.col1_called );
g_assert( !col_struct.col2_called );
g_assert_cmpstr( test_struct.msg, == , "qof_book_foreach_collection: assertion `cb' failed" );
g_assert_cmpstr( test_struct.msg, == , "qof_book_foreach_collection: assertion " _Q "cb' failed" );
g_free( test_struct.msg );
g_log_remove_handler (log_domain, hdlr);
test_clear_error_list ();

View File

@ -30,6 +30,12 @@ void test_suite_qofinstance ( void );
static gchar* error_message;
static gboolean is_called;
#ifdef HAVE_GLIB_2_38
#define _Q "'"
#else
#define _Q "`"
#endif
typedef struct
{
QofInstance *inst;
@ -116,10 +122,10 @@ test_instance_new_destroy( void )
QofInstanceClass *klass;
/* test var */
Timespec *timespec_priv;
gchar *msg1 = "qof_instance_get_collection: assertion `QOF_IS_INSTANCE(ptr)' failed";
gchar *msg2 = "qof_instance_get_editlevel: assertion `QOF_IS_INSTANCE(ptr)' failed";
gchar *msg3 = "qof_instance_get_destroying: assertion `QOF_IS_INSTANCE(ptr)' failed";
gchar *msg4 = "qof_instance_get_dirty_flag: assertion `QOF_IS_INSTANCE(ptr)' failed";
gchar *msg1 = "qof_instance_get_collection: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed";
gchar *msg2 = "qof_instance_get_editlevel: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed";
gchar *msg3 = "qof_instance_get_destroying: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed";
gchar *msg4 = "qof_instance_get_dirty_flag: assertion " _Q "QOF_IS_INSTANCE(ptr)' failed";
gchar *log_domain = "qof";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL, hdlr;
TestErrorStruct check = { loglevel, log_domain, msg1 };
@ -159,22 +165,22 @@ test_instance_new_destroy( void )
hdlr = g_log_set_handler (log_domain, loglevel,
(GLogFunc)test_checked_handler, &check);
g_assert( qof_instance_get_collection( inst ) == NULL );
g_assert( g_strrstr( error_message, "assertion `QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message );
check.msg = msg2;
g_assert_cmpint( qof_instance_get_editlevel( inst ), == , 0 );
g_assert( g_strrstr( error_message, "assertion `QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message );
check.msg = msg3;
g_assert( !qof_instance_get_destroying( inst ) );
g_assert( g_strrstr( error_message, "assertion `QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message );
check.msg = msg4;
g_assert( !qof_instance_get_dirty_flag( inst ) );
g_assert( g_strrstr( error_message, "assertion `QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_assert( g_strrstr( error_message, "assertion " _Q "QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
g_free( error_message );
g_log_remove_handler (log_domain, hdlr);
}