tests: show test function in output

This commit is contained in:
Khaïs COLIN 2025-03-04 13:31:22 +01:00 committed by Khaïs COLIN
parent 3778d0a7ee
commit 9ffde46adc

View file

@ -82,6 +82,7 @@ static void assert_pipelineequal(char *expected, t_cmdlist *cmd, int idx)
static void test_parse_command_list_empty(void) static void test_parse_command_list_empty(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list(""); t_cmdlist *cmd = parse_command_list("");
assert(cmd == NULL); assert(cmd == NULL);
cmdlist_destroy(cmd); cmdlist_destroy(cmd);
@ -89,6 +90,7 @@ static void test_parse_command_list_empty(void)
static void test_parse_command_list_single_pipeline(void) static void test_parse_command_list_single_pipeline(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e"); t_cmdlist *cmd = parse_command_list("echo this | cat -e");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -99,6 +101,7 @@ static void test_parse_command_list_single_pipeline(void)
static void test_parse_command_list_simple_and(void) static void test_parse_command_list_simple_and(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e && echo works | wc -c"); t_cmdlist *cmd = parse_command_list("echo this | cat -e && echo works | wc -c");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -110,6 +113,7 @@ static void test_parse_command_list_simple_and(void)
static void test_parse_command_list_simple_or(void) static void test_parse_command_list_simple_or(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c"); t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -121,6 +125,7 @@ static void test_parse_command_list_simple_or(void)
static void test_parse_command_list_triple_or(void) static void test_parse_command_list_triple_or(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c || echo as well | cut -d' ' -f1"); t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c || echo as well | cut -d' ' -f1");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -134,6 +139,7 @@ static void test_parse_command_list_triple_or(void)
static void test_parse_command_list_triple_both_operators(void) static void test_parse_command_list_triple_both_operators(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c && echo as well | cut -d' ' -f1"); t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c && echo as well | cut -d' ' -f1");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -148,6 +154,7 @@ static void test_parse_command_list_triple_both_operators(void)
static void test_parse_command_list_quad_both_operators(void) static void test_parse_command_list_quad_both_operators(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c && echo as well | cut -d' ' -f1 || echo final"); t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c && echo as well | cut -d' ' -f1 || echo final");
assert(cmd != NULL); assert(cmd != NULL);
assert_pipelineequal("echo this | cat -e", cmd, 0); assert_pipelineequal("echo this | cat -e", cmd, 0);
@ -163,6 +170,7 @@ static void test_parse_command_list_quad_both_operators(void)
static void test_parse_command_list_invalid_pipeline(void) static void test_parse_command_list_invalid_pipeline(void)
{ {
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
t_cmdlist *cmd = parse_command_list("echo this | | cat -e || echo does not work"); t_cmdlist *cmd = parse_command_list("echo this | | cat -e || echo does not work");
assert(cmd == NULL); assert(cmd == NULL);
} }