From 48a08272bfcc0153887b850b4ea82e8fb7d8f1ae Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 9 Jun 2011 09:42:55 +0200 Subject: Store last failure message per thread. * Add p11_kit_message() function to get last message. --- tests/conf-test.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tests/conf-test.c') diff --git a/tests/conf-test.c b/tests/conf-test.c index 2ef4e5c..4b2f820 100644 --- a/tests/conf-test.c +++ b/tests/conf-test.c @@ -40,8 +40,7 @@ #include #include "conf.h" - -static int n_errors = 0; +#include "p11-kit.h" static void test_parse_conf_1 (CuTest *tc) @@ -72,12 +71,11 @@ test_parse_ignore_missing (CuTest *tc) { hash_t *ht; - n_errors = 0; ht = _p11_conf_parse_file (SRCDIR "/files/non-existant.conf", CONF_IGNORE_MISSING); CuAssertPtrNotNull (tc, ht); CuAssertIntEquals (tc, 0, hash_count (ht)); - CuAssertIntEquals (tc, 0, n_errors); + CuAssertPtrEquals (tc, NULL, (void*)p11_kit_message ()); hash_free (ht); } @@ -86,10 +84,9 @@ test_parse_fail_missing (CuTest *tc) { hash_t *ht; - n_errors = 0; ht = _p11_conf_parse_file (SRCDIR "/files/non-existant.conf", 0); CuAssertPtrEquals (tc, ht, NULL); - CuAssertIntEquals (tc, 1, n_errors); + CuAssertPtrNotNull (tc, p11_kit_message ()); } static void @@ -107,7 +104,7 @@ test_merge_defaults (CuTest *tc) hash_set (defaults, strdup ("two"), strdup ("default2")); hash_set (defaults, strdup ("three"), strdup ("default3")); - if (!_p11_conf_merge_defaults (values, defaults)) + if (_p11_conf_merge_defaults (values, defaults) < 0) CuFail (tc, "should not be reached"); hash_free (defaults); @@ -131,6 +128,8 @@ main (void) SUITE_ADD_TEST (suite, test_parse_fail_missing); SUITE_ADD_TEST (suite, test_merge_defaults); + p11_kit_be_quiet (); + CuSuiteRun (suite); CuSuiteSummary (suite, output); CuSuiteDetails (suite, output); -- cgit v1.1