mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
command list parsing: handle empty input
This is really not that usefull, it is more to setup the groundwork
This commit is contained in:
parent
1c653d9665
commit
eb21f00156
5 changed files with 129 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
rawtests = \
|
||||
quote_removal \
|
||||
metacharacters \
|
||||
parse_command_lists \
|
||||
parse_pipelines \
|
||||
parse_simple_cmds \
|
||||
test_env_manip \
|
||||
|
|
|
|||
36
tests/parse_command_lists.c
Normal file
36
tests/parse_command_lists.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue