From 8f96882eadc86c788d28cf81ef4fe40cf737eb17 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 16 Jan 2018 17:20:31 -0800 Subject: [PATCH] Remove tests checking members of deleted objects. GLib's scribbling of freed memory is enabled on Arch so attempting to read the deleted members of inst and book crash instead of reaturning invalid results. These weren't really useful tests anyway. --- libgnucash/engine/test/test-qofinstance.cpp | 28 -------------------- libgnucash/engine/test/utest-Transaction.cpp | 10 ++----- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/libgnucash/engine/test/test-qofinstance.cpp b/libgnucash/engine/test/test-qofinstance.cpp index 7ed7d2d400..292e25004f 100644 --- a/libgnucash/engine/test/test-qofinstance.cpp +++ b/libgnucash/engine/test/test-qofinstance.cpp @@ -230,35 +230,7 @@ test_instance_new_destroy( void ) g_test_message( "Testing object destruction" ); g_object_unref( inst ); - /* test fields were deinitialized */ - g_assert( inst ); - g_assert( !QOF_IS_INSTANCE( inst ) ); - /* set fatal handler */ - g_test_log_set_fatal_handler ( ( GTestLogFatalFunc )fatal_handler, NULL ); - auto 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_free( error_message ); - - g_free(check->msg); - check->msg = g_strdup(msg2); - g_assert_cmpint( qof_instance_get_editlevel( inst ), == , 0 ); - g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); - g_free( error_message ); - - g_free(check->msg); - check->msg = g_strdup(msg3); - g_assert( !qof_instance_get_destroying( inst ) ); - g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); g_free( error_message ); - - g_free(check->msg); - check->msg = g_strdup(msg4); - g_assert( !qof_instance_get_dirty_flag( inst ) ); - g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL ); - g_free( error_message ); - g_log_remove_handler (log_domain, hdlr); test_error_struct_free(check); } diff --git a/libgnucash/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp index c322c66f53..e053517b9e 100644 --- a/libgnucash/engine/test/utest-Transaction.cpp +++ b/libgnucash/engine/test/utest-Transaction.cpp @@ -1358,19 +1358,13 @@ test_xaccTransBeginEdit () xaccTransRollbackEdit (txn); g_assert_cmpint (0, ==, qof_instance_get_editlevel (QOF_INSTANCE (txn))); g_assert (txn->orig == NULL); - qof_book_destroy (book); - xaccTransBeginEdit (txn); - g_assert_cmpint (1, ==, qof_instance_get_editlevel (QOF_INSTANCE (txn))); - g_assert (txn->orig == NULL); - g_assert_cmpint (1, ==, check1->hits); - g_assert_cmpint (2, ==, check2->hits); g_log_remove_handler (logdomain, hdlr); test_clear_error_list (); test_error_struct_free (check1); test_error_struct_free (check2); - /* qof_book_destroy has already removed enough of the innards that - trying to unref the txn and book crashes. */ + xaccTransDestroy (txn); + qof_book_destroy (book); } /* xaccTransDestroy void