diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:10:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-26 11:10:24 -0700 |
| commit | 164cffa35c487f46fa1483ae4a616c45fd3a2bdf (patch) | |
| tree | e4167cc8a09f7c7a713297749dabb1138d49594d /t/unit-tests | |
| parent | c93649f98acbfd02a5dd7f5899b321a7cc130cf8 (diff) | |
| parent | 098be29f5b4e40b687529d65166c19e6bb096dcb (diff) | |
Merge branch 'rs/t-example-simplify' into maint-2.46
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) |
