Disable deprecations where appropriate in tests
authorMatthias Clasen <mclasen@redhat.com>
Wed, 12 Oct 2011 04:37:02 +0000 (00:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 12 Oct 2011 04:37:02 +0000 (00:37 -0400)
16 files changed:
glib/tests/cache.c
glib/tests/cond.c
glib/tests/date.c
glib/tests/fileutils.c
glib/tests/mainloop.c [new file with mode: 0644]
glib/tests/mappedfile.c
glib/tests/mutex.c
glib/tests/once.c
glib/tests/private.c
glib/tests/rec-mutex.c
glib/tests/rwlock.c
glib/tests/strfuncs.c
glib/tests/string.c
glib/tests/thread.c
glib/tests/tree.c
glib/tests/unicode.c

index 5ece83d..31ea9fa 100644 (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;
index ac9e8dc..26a5dbf 100644 (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;
index 772e965..39b792f 100644 (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>
index f429fd9..544ec60 100644 (file)
 
 #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>
 
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
new file mode 100644 (file)
index 0000000..14034a9
--- /dev/null
@@ -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 ();
+}
index be2e6f6..5387a64 100644 (file)
@@ -1,3 +1,5 @@
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
 #include <config.h>
 #include <glib.h>
 #include <string.h>
index 17959c2..3bd2e2f 100644 (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>
index dcb8e29..c59cb4d 100644 (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]);
index 4cd60ce..c21aacf 100644 (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);
index e587156..4fd6156 100644 (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>
index d3d0f9d..9d51b30 100644 (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
index 38aa16a..d4bac4a 100644 (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
index 1143414..9a5944c 100644 (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"
index ea49129..fe2aca0 100644 (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);
index b2db158..fa74186 100644 (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"
index 00dd0f5..1032601 100644 (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