diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-12-15 11:20:19 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-12-15 11:50:00 -0500 |
commit | c34cc2348cfd3c461974dea4419001dbd9610202 (patch) | |
tree | 8b8783b5058da3a8785678e125bd1a7765b8276a /glib/tests/scannerapi.c | |
parent | cd2204bb65114e5ac62b014e6167a659aa254361 (diff) | |
download | glib-c34cc2348cfd3c461974dea4419001dbd9610202.tar.gz |
Simplify subprocesses in tests
Use the new way of running tests in a subprocess without
registering extra 'subprocess' test cases where appropriate.
Diffstat (limited to 'glib/tests/scannerapi.c')
-rw-r--r-- | glib/tests/scannerapi.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/glib/tests/scannerapi.c b/glib/tests/scannerapi.c index 3b8e2ece8..85d8a0250 100644 --- a/glib/tests/scannerapi.c +++ b/glib/tests/scannerapi.c @@ -59,20 +59,18 @@ test_scanner_warn (ScannerFixture *fix, } static void -test_scanner_error_subprocess (ScannerFixture *fix, - gconstpointer test_data) -{ - int pe = fix->scanner->parse_errors; - g_scanner_error (fix->scanner, "scanner-error-message-test"); - g_assert_cmpint (fix->scanner->parse_errors, ==, pe + 1); - exit (0); -} - -static void test_scanner_error (ScannerFixture *fix, gconstpointer test_data) { - g_test_trap_subprocess ("/scanner/error/subprocess", 0, 0); + if (g_test_subprocess ()) + { + int pe = fix->scanner->parse_errors; + g_scanner_error (fix->scanner, "scanner-error-message-test"); + g_assert_cmpint (fix->scanner->parse_errors, ==, pe + 1); + exit (0); + } + + g_test_trap_subprocess (NULL, 0, 0); g_test_trap_assert_passed (); g_test_trap_assert_stderr ("*scanner-error-message-test*"); } @@ -139,7 +137,6 @@ main (int argc, g_test_add ("/scanner/warn", ScannerFixture, 0, scanner_fixture_setup, test_scanner_warn, scanner_fixture_teardown); g_test_add ("/scanner/error", ScannerFixture, 0, scanner_fixture_setup, test_scanner_error, scanner_fixture_teardown); - g_test_add ("/scanner/error/subprocess", ScannerFixture, 0, scanner_fixture_setup, test_scanner_error_subprocess, scanner_fixture_teardown); g_test_add ("/scanner/symbols", ScannerFixture, 0, scanner_fixture_setup, test_scanner_symbols, scanner_fixture_teardown); g_test_add ("/scanner/tokens", ScannerFixture, 0, scanner_fixture_setup, test_scanner_tokens, scanner_fixture_teardown); |