Merge branch 'rs/t-example-simplify' into maint-2.46
Unit test simplification. * rs/t-example-simplify: t-example-decorate: remove test messagesmaint
						commit
						164cffa35c
					
				|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano