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.
This commit is contained in:
John Ralls 2018-01-16 17:20:31 -08:00
parent 3c1dc14d00
commit 8f96882ead
2 changed files with 2 additions and 36 deletions

View File

@ -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);
}

View File

@ -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