Disable deprecations where appropriate in tests

This commit is contained in:
Matthias Clasen 2011-10-12 00:37:02 -04:00
parent 7455dd370e
commit bcdb865c59
16 changed files with 78 additions and 8 deletions

View File

@ -16,6 +16,9 @@
* Boston, MA 02111-1307, USA.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
static gint value_create_count = 0;

View File

@ -20,6 +20,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
static GCond cond;

View File

@ -1,6 +1,9 @@
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "glib.h"
#include <stdio.h>

View File

@ -21,6 +21,10 @@
#include <string.h>
#include <errno.h>
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
#include <glib/gstdio.h>

38
glib/tests/mainloop.c Normal file
View File

@ -0,0 +1,38 @@
/* Unit tests for GMainLoop
* Copyright (C) 2011 Red Hat, Inc
* Author: Matthias Clasen
*
* This work is provided "as is"; redistribution and modification
* in whole or in part, in any medium, physical or electronic is
* permitted without restriction.
*
* This work is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* In no event shall the authors or contributors be liable for any
* direct, indirect, incidental, special, exemplary, or consequential
* damages (including, but not limited to, procurement of substitute
* goods or services; loss of use, data, or profits; or business
* interruption) however caused and on any theory of liability, whether
* in contract, strict liability, or tort (including negligence or
* otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage.
*/
#include <glib.h>
static void
test_unref (void)
{
}
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/mainloop/unref", test_unref);
return g_test_run ();
}

View File

@ -1,3 +1,5 @@
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <config.h>
#include <glib.h>
#include <string.h>

View File

@ -20,6 +20,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
#include <stdio.h>

View File

@ -104,7 +104,7 @@ test_once3 (void)
shared = 0;
for (i = 0; i < THREADS; i++)
threads[i] = g_thread_create (thread_func, NULL, TRUE, NULL);
threads[i] = g_thread_new ("once3", thread_func, NULL, TRUE, NULL);
for (i = 0; i < THREADS; i++)
g_thread_join (threads[i]);

View File

@ -20,6 +20,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
/* test basics:
@ -374,8 +377,6 @@ main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_assert (g_thread_get_initialized ());
g_test_add_func ("/thread/private1", test_private1);
g_test_add_func ("/thread/private2", test_private2);
g_test_add_func ("/thread/private3", test_private3);

View File

@ -20,6 +20,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
#include <stdio.h>

View File

@ -20,6 +20,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib.h>
static void

View File

@ -1077,8 +1077,8 @@ test_bounds (void)
file = g_mapped_file_new ("4096-random-bytes", TRUE, NULL);
after = g_mapped_file_new ("4096-random-bytes", TRUE, NULL);
g_mapped_file_free (before);
g_mapped_file_free (after);
g_mapped_file_unref (before);
g_mapped_file_unref (after);
g_assert (file != NULL);
g_assert_cmpint (g_mapped_file_get_length (file), ==, 4096);
@ -1212,7 +1212,7 @@ test_bounds (void)
g_free (tmp2);
g_free (tmp);
g_mapped_file_free (file);
g_mapped_file_unref (file);
}
static void

View File

@ -19,6 +19,9 @@
* if advised of the possibility of such damage.
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <stdio.h>
#include <string.h>
#include "glib.h"

View File

@ -146,8 +146,6 @@ main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_assert (g_thread_get_initialized ());
g_test_add_func ("/thread/thread1", test_thread1);
g_test_add_func ("/thread/thread2", test_thread2);
g_test_add_func ("/thread/thread3", test_thread3);

View File

@ -27,6 +27,9 @@
#undef G_DISABLE_ASSERT
#undef G_LOG_DOMAIN
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <stdio.h>
#include <string.h>
#include "glib.h"

View File

@ -22,6 +22,9 @@
* Author: Matthias Clasen, Behdad Esfahbod
*/
/* We are testing some deprecated APIs here */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "glib.h"
static void