Skip to content

Commit 164cffa

Browse files
committed
Merge branch 'rs/t-example-simplify' into maint-2.46
Unit test simplification. * rs/t-example-simplify: t-example-decorate: remove test messages
2 parents c93649f + 098be29 commit 164cffa

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

t/unit-tests/t-example-decorate.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,29 @@ static void t_add(struct test_vars *vars)
1515
{
1616
void *ret = add_decoration(&vars->n, vars->one, &vars->decoration_a);
1717

18-
if (!check(ret == NULL))
19-
test_msg("when adding a brand-new object, NULL should be returned");
18+
check(ret == NULL);
2019
ret = add_decoration(&vars->n, vars->two, NULL);
21-
if (!check(ret == NULL))
22-
test_msg("when adding a brand-new object, NULL should be returned");
20+
check(ret == NULL);
2321
}
2422

2523
static void t_readd(struct test_vars *vars)
2624
{
2725
void *ret = add_decoration(&vars->n, vars->one, NULL);
2826

29-
if (!check(ret == &vars->decoration_a))
30-
test_msg("when readding an already existing object, existing decoration should be returned");
27+
check(ret == &vars->decoration_a);
3128
ret = add_decoration(&vars->n, vars->two, &vars->decoration_b);
32-
if (!check(ret == NULL))
33-
test_msg("when readding an already existing object, existing decoration should be returned");
29+
check(ret == NULL);
3430
}
3531

3632
static void t_lookup(struct test_vars *vars)
3733
{
3834
void *ret = lookup_decoration(&vars->n, vars->one);
3935

40-
if (!check(ret == NULL))
41-
test_msg("lookup should return added declaration");
36+
check(ret == NULL);
4237
ret = lookup_decoration(&vars->n, vars->two);
43-
if (!check(ret == &vars->decoration_b))
44-
test_msg("lookup should return added declaration");
38+
check(ret == &vars->decoration_b);
4539
ret = lookup_decoration(&vars->n, vars->three);
46-
if (!check(ret == NULL))
47-
test_msg("lookup for unknown object should return NULL");
40+
check(ret == NULL);
4841
}
4942

5043
static void t_loop(struct test_vars *vars)
@@ -55,8 +48,7 @@ static void t_loop(struct test_vars *vars)
5548
if (vars->n.entries[i].base)
5649
objects_noticed++;
5750
}
58-
if (!check_int(objects_noticed, ==, 2))
59-
test_msg("should have 2 objects");
51+
check_int(objects_noticed, ==, 2);
6052
}
6153

6254
int cmd_main(int argc UNUSED, const char **argv UNUSED)

0 commit comments

Comments
 (0)