minishell/tests/parse_command_lists.c
Khaïs COLIN eb21f00156 command list parsing: handle empty input
This is really not that usefull, it is more to setup the groundwork
2025-03-10 13:22:29 +00:00

36 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_command_lists.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:40:48 by khais #+# #+# */
/* Updated: 2025/02/24 17:47:39 by khais ### ########.fr */
/* */
/* ************************************************************************** */
#include "../src/parser/command_list/command_list.h"
#include "../src/parser/wordsplit/wordsplit.h"
#include <assert.h>
static t_command_list *parse_command_list(char *input)
{
t_wordlist *words = minishell_wordsplit(input);
t_command_list *cmd = command_list_from_wordlist(words);
return (cmd);
}
static void test_parse_command_list_empty(void)
{
t_command_list *cmd = parse_command_list("");
assert(cmd == NULL);
command_list_destroy(cmd);
}
int main(void)
{
test_parse_command_list_empty();
return (0);
}