diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-03-03 13:32:41 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-03-05 09:14:19 +0100 |
commit | 0f721d168da07b3d484c7354d16630f18f06cbf6 (patch) | |
tree | 53e959014df81b4ed132f01d587511f8381b5b73 | |
parent | 77c47de23ff58ff987fed92713546d99720bd099 (diff) |
test-string-input-visitor: Tear down existing test automatically
Call visitor_input_teardown() from visitor_input_test_init(), so you
don't have to call it from the actual tests.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1488544368-30622-22-git-send-email-armbru@redhat.com>
-rw-r--r-- | tests/test-string-input-visitor.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 7f10e2582f..a32828cefb 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -39,6 +39,8 @@ static Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *string) { + visitor_input_teardown(data, NULL); + data->v = string_input_visitor_new(string); g_assert(data->v); return data->v; @@ -57,8 +59,6 @@ static void test_visitor_in_int(TestInputVisitorData *data, g_assert(!err); g_assert_cmpint(res, ==, value); - visitor_input_teardown(data, unused); - v = visitor_input_test_init(data, "not an int"); visit_type_int(v, NULL, &res, &err); @@ -87,8 +87,6 @@ static void test_visitor_in_intList(TestInputVisitorData *data, qapi_free_int16List(res); - visitor_input_teardown(data, unused); - v = visitor_input_test_init(data, "not an int list"); visit_type_int16List(v, NULL, &res, &err); @@ -108,35 +106,30 @@ static void test_visitor_in_bool(TestInputVisitorData *data, visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "yes"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "on"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, true); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "false"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, false); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "no"); visit_type_bool(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(res, ==, false); - visitor_input_teardown(data, unused); v = visitor_input_test_init(data, "off"); @@ -190,8 +183,6 @@ static void test_visitor_in_enum(TestInputVisitorData *data, visit_type_EnumOne(v, NULL, &res, &err); g_assert(!err); g_assert_cmpint(i, ==, res); - - visitor_input_teardown(data, NULL); } } @@ -224,30 +215,24 @@ static void test_visitor_in_fuzz(TestInputVisitorData *data, v = visitor_input_test_init(data, buf); visit_type_int(v, NULL, &ires, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_intList(v, NULL, &ilres, NULL); qapi_free_intList(ilres); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_bool(v, NULL, &bres, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_number(v, NULL, &nres, NULL); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); sres = NULL; visit_type_str(v, NULL, &sres, NULL); g_free(sres); - visitor_input_teardown(data, NULL); v = visitor_input_test_init(data, buf); visit_type_EnumOne(v, NULL, &eres, NULL); - visitor_input_teardown(data, NULL); } } |