/* Test that tp_clear_pointer is syntactically OK in C++
*
* Copyright © 2010 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include
#include
#include
typedef struct {
int dummy;
} Fixture;
extern "C" void
setup (Fixture *f,
gconstpointer data)
{
}
extern "C" void
test (Fixture *f,
gconstpointer data)
{
GObject *o;
GHashTable *h;
o = (GObject *) g_file_new_for_path ("/");
tp_clear_object (&o);
h = g_hash_table_new (NULL, NULL);
tp_clear_pointer (&h, (GDestroyNotify) g_hash_table_unref);
h = g_hash_table_new (NULL, NULL);
tp_clear_boxed (G_TYPE_HASH_TABLE, &h);
}
extern "C" void
teardown (Fixture *f,
gconstpointer data)
{
}
int
main (int argc,
char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id=");
g_test_add ("/util/cxx", Fixture, NULL, setup, test, teardown);
return g_test_run ();
}