WIP: parse command list tests: assert that invalid pipeline returns null

This commit is contained in:
Khaïs COLIN 2025-02-26 14:07:55 +01:00 committed by Khaïs COLIN
parent bccd68b11f
commit c57a4a69a7
4 changed files with 54 additions and 6 deletions

View file

@ -6,13 +6,14 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:40:48 by khais #+# #+# */
/* Updated: 2025/02/25 15:25:14 by khais ### ########.fr */
/* Updated: 2025/02/26 17:29:15 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
#include "../src/parser/command_list/command_list.h"
#include "../src/parser/wordsplit/wordsplit.h"
#include "ft_printf.h"
#include "testutil.h"
#include "unistd.h"
#include <assert.h>
@ -159,8 +160,16 @@ static void test_parse_command_list_quad_both_operators(void)
cmdlist_destroy(cmd);
}
static void test_parse_command_list_invalid_pipeline(void)
{
t_cmdlist *cmd = parse_command_list("echo this | | cat -e || echo does not work");
assert(cmd == NULL);
}
int main(void)
{
test_parse_command_list_invalid_pipeline();
test_parse_command_list_empty();
test_parse_command_list_single_pipeline();
test_parse_command_list_simple_and();