diff options
author | 11:43:22 Tim Janik <timj@imendio.com> | 2007-12-05 10:42:09 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2007-12-05 10:42:09 +0000 |
commit | 510d4ec6340492660bc2dd20f566fb4c8f0a78af (patch) | |
tree | 283fa2fa02e57437670f62a12c58d681ded3c46e /glib/gtester.c | |
parent | 2c362b7f9eb7cc81f37970e24c5b5dcdc56ea6d5 (diff) | |
download | glib-510d4ec6340492660bc2dd20f566fb4c8f0a78af.tar.gz |
added g_test_add_data_func() to pass data into tests. allow data arguments
2007-12-05 11:43:22 Tim Janik <timj@imendio.com>
* glib/gtestutils.[hc]: added g_test_add_data_func() to pass data
into tests. allow data arguments for fixture tests.
* glib/gtestutils.c: fixed fatal log flag setup, so tests really abort
upon criticals/warnings/errors.
* glib/tests/testing.c: test test_data arguments.
* glib/gtester.c: some prototype fixups.
svn path=/trunk/; revision=6049
Diffstat (limited to 'glib/gtester.c')
-rw-r--r-- | glib/gtester.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/glib/gtester.c b/glib/gtester.c index 395970e2e..5a035d72f 100644 --- a/glib/gtester.c +++ b/glib/gtester.c @@ -610,13 +610,15 @@ main (int argc, } static void -fixture_setup (guint *fix) +fixture_setup (guint *fix, + gconstpointer test_data) { g_assert_cmphex (*fix, ==, 0); *fix = 0xdeadbeef; } static void -fixture_test (guint *fix) +fixture_test (guint *fix, + gconstpointer test_data) { g_assert_cmphex (*fix, ==, 0xdeadbeef); g_test_message ("This is a test message API test message."); @@ -626,7 +628,8 @@ fixture_test (guint *fix) g_test_bug ("456"); } static void -fixture_teardown (guint *fix) +fixture_teardown (guint *fix, + gconstpointer test_data) { g_assert_cmphex (*fix, ==, 0xdeadbeef); } @@ -637,6 +640,6 @@ main_selftest (int argc, { /* gtester main() for --gtester-selftest invokations */ g_test_init (&argc, &argv, NULL); - g_test_add ("/gtester/fixture-test", guint, fixture_setup, fixture_test, fixture_teardown); + g_test_add ("/gtester/fixture-test", guint, NULL, fixture_setup, fixture_test, fixture_teardown); return g_test_run(); } |