mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
tests: show test function in output
This commit is contained in:
parent
3778d0a7ee
commit
9ffde46adc
1 changed files with 8 additions and 0 deletions
|
|
@ -82,6 +82,7 @@ static void assert_pipelineequal(char *expected, t_cmdlist *cmd, int idx)
|
|||
|
||||
static void test_parse_command_list_empty(void)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||
t_cmdlist *cmd = parse_command_list("");
|
||||
assert(cmd == NULL);
|
||||
cmdlist_destroy(cmd);
|
||||
|
|
@ -89,6 +90,7 @@ static void test_parse_command_list_empty(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");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||
t_cmdlist *cmd = parse_command_list("echo this | cat -e && echo works | wc -c");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||
t_cmdlist *cmd = parse_command_list("echo this | cat -e || echo works | wc -c");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
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");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
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");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
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");
|
||||
assert(cmd != NULL);
|
||||
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)
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "==> %s <==\n", __FUNCTION__);
|
||||
t_cmdlist *cmd = parse_command_list("echo this | | cat -e || echo does not work");
|
||||
assert(cmd == NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue