diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-08-15 13:22:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-15 13:22:11 -0700 |
commit | 402f36f33e3970a3e4712d15f7d60820cb5e84ef (patch) | |
tree | 254bd81d9f947e4df7be1b8235fa1abf253a2e8c /t/unit-tests | |
parent | 0ed3dde067a5dc5141e3a31d950972f00a08b35d (diff) | |
parent | 098be29f5b4e40b687529d65166c19e6bb096dcb (diff) |
Merge branch 'rs/t-example-simplify'
Unit test simplification.
* rs/t-example-simplify:
t-example-decorate: remove test messages
Diffstat (limited to 't/unit-tests')
-rw-r--r-- | t/unit-tests/t-example-decorate.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/t/unit-tests/t-example-decorate.c b/t/unit-tests/t-example-decorate.c index a4a75db735..8bf0709c41 100644 --- a/t/unit-tests/t-example-decorate.c +++ b/t/unit-tests/t-example-decorate.c @@ -15,36 +15,29 @@ static void t_add(struct test_vars *vars) { void *ret = add_decoration(&vars->n, vars->one, &vars->decoration_a); - if (!check(ret == NULL)) - test_msg("when adding a brand-new object, NULL should be returned"); + check(ret == NULL); ret = add_decoration(&vars->n, vars->two, NULL); - if (!check(ret == NULL)) - test_msg("when adding a brand-new object, NULL should be returned"); + check(ret == NULL); } static void t_readd(struct test_vars *vars) { void *ret = add_decoration(&vars->n, vars->one, NULL); - if (!check(ret == &vars->decoration_a)) - test_msg("when readding an already existing object, existing decoration should be returned"); + check(ret == &vars->decoration_a); ret = add_decoration(&vars->n, vars->two, &vars->decoration_b); - if (!check(ret == NULL)) - test_msg("when readding an already existing object, existing decoration should be returned"); + check(ret == NULL); } static void t_lookup(struct test_vars *vars) { void *ret = lookup_decoration(&vars->n, vars->one); - if (!check(ret == NULL)) - test_msg("lookup should return added declaration"); + check(ret == NULL); ret = lookup_decoration(&vars->n, vars->two); - if (!check(ret == &vars->decoration_b)) - test_msg("lookup should return added declaration"); + check(ret == &vars->decoration_b); ret = lookup_decoration(&vars->n, vars->three); - if (!check(ret == NULL)) - test_msg("lookup for unknown object should return NULL"); + check(ret == NULL); } static void t_loop(struct test_vars *vars) @@ -55,8 +48,7 @@ static void t_loop(struct test_vars *vars) if (vars->n.entries[i].base) objects_noticed++; } - if (!check_int(objects_noticed, ==, 2)) - test_msg("should have 2 objects"); + check_int(objects_noticed, ==, 2); } int cmd_main(int argc UNUSED, const char **argv UNUSED) |