From 0171de26e9e8eac8de940b985db7e8213748f379 Mon Sep 17 00:00:00 2001 From: hugogogo Date: Sun, 5 Dec 2021 11:08:49 +0100 Subject: [PATCH] debug de heredoc --- srcs/exec/exec_cmd_line.c | 3 +- srcs/parsing/parsing.c | 2 +- srcs/parsing/redirections/here_doc.c | 2 +- srcs/parsing/redirections/redirections.c | 2 +- srcs/shell_loop.c | 2 +- tests/unit_tests/file.log | 27 ++++++++++++ tests/unit_tests/logs/bash_log.txt | 54 +---------------------- tests/unit_tests/logs/minishell_log.txt | 55 +----------------------- tests/unit_tests/unitests.sh | 4 +- tests/unit_tests/ut_heredocs.sh | 10 ++--- 10 files changed, 44 insertions(+), 117 deletions(-) create mode 100644 tests/unit_tests/file.log diff --git a/srcs/exec/exec_cmd_line.c b/srcs/exec/exec_cmd_line.c index 3becd61..1c91c93 100644 --- a/srcs/exec/exec_cmd_line.c +++ b/srcs/exec/exec_cmd_line.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */ -/* Updated: 2021/12/01 16:07:48 by lperrey ### ########.fr */ +/* Updated: 2021/12/05 09:28:00 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ int exec_cmd_line(t_all *c) free_pipeline(&c->pipeline); return (0); } +//write(1, "here\n", 5); return (1); } diff --git a/srcs/parsing/parsing.c b/srcs/parsing/parsing.c index 0963848..6ee4969 100644 --- a/srcs/parsing/parsing.c +++ b/srcs/parsing/parsing.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/24 10:52:40 by lperrey #+# #+# */ -/* Updated: 2021/12/02 15:55:32 by hulamy ### ########.fr */ +/* Updated: 2021/12/04 16:06:48 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/parsing/redirections/here_doc.c b/srcs/parsing/redirections/here_doc.c index 76dfa49..0684da2 100644 --- a/srcs/parsing/redirections/here_doc.c +++ b/srcs/parsing/redirections/here_doc.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */ -/* Updated: 2021/12/02 15:32:56 by hulamy ### ########.fr */ +/* Updated: 2021/12/05 10:58:56 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/parsing/redirections/redirections.c b/srcs/parsing/redirections/redirections.c index 5b3bea9..1b6e9bf 100644 --- a/srcs/parsing/redirections/redirections.c +++ b/srcs/parsing/redirections/redirections.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */ -/* Updated: 2021/11/29 12:39:05 by lperrey ### ########.fr */ +/* Updated: 2021/12/04 16:05:46 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/shell_loop.c b/srcs/shell_loop.c index 4c16075..c19bcca 100644 --- a/srcs/shell_loop.c +++ b/srcs/shell_loop.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */ -/* Updated: 2021/12/03 07:06:35 by hulamy ### ########.fr */ +/* Updated: 2021/12/04 16:08:48 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/tests/unit_tests/file.log b/tests/unit_tests/file.log new file mode 100644 index 0000000..e1e3896 --- /dev/null +++ b/tests/unit_tests/file.log @@ -0,0 +1,27 @@ +simplonco@simplonco-Latitude-E6320:~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tes sts$ echo "hugo" +hugo +simplonco@simplonco-Latitude-E6320:~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tes sts$ cat << EOF +>  +file.log unitests.sh ut_expensions.sh ut_to_do_manually.sh +logs/ ut_bonus.sh ut_heredocs.sh ut_vrac.sh +minishell ut_builtins.sh ut_pipes.sh wip/ +tests_discord.md ut_exit_status.sh ut_redirections.sh +> +file.log unitests.sh ut_expensions.sh ut_to_do_manually.sh +logs/ ut_bonus.sh ut_heredocs.sh ut_vrac.sh +minishell ut_builtins.sh ut_pipes.sh wip/ +tests_discord.md ut_exit_status.sh ut_redirections.sh +> hello you +>  +file.log unitests.sh ut_expensions.sh ut_to_do_manually.sh +logs/ ut_bonus.sh ut_heredocs.sh ut_vrac.sh +minishell ut_builtins.sh ut_pipes.sh wip/ +tests_discord.md ut_exit_status.sh ut_redirections.sh +> +file.log unitests.sh ut_expensions.sh ut_to_do_manually.sh +logs/ ut_bonus.sh ut_heredocs.sh ut_vrac.sh +minishell ut_builtins.sh ut_pipes.sh wip/ +tests_discord.md ut_exit_status.sh ut_redirections.sh +> EOF +hello you +simplonco@simplonco-Latitude-E6320:~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tes sts$ exit diff --git a/tests/unit_tests/logs/bash_log.txt b/tests/unit_tests/logs/bash_log.txt index a6b1212..d3834fe 100644 --- a/tests/unit_tests/logs/bash_log.txt +++ b/tests/unit_tests/logs/bash_log.txt @@ -2,59 +2,9 @@  -file: ut_vrac.sh +file: ut_heredocs.sh  -$ ------------ - - - -file_name_in_current_dir ------------ - - - -/bin/echo bonjour ------------ -bonjour - - -not_cmd ------------ - - - -echo bonjour > $test w/ t -ls -rm '$test' ------------ -logs -minishell -tests_discord.md -unitests.sh -ut_bonus.sh -ut_builtins.sh -ut_exit_status.sh -ut_expensions.sh -ut_heredocs.sh -ut_pipes.sh -ut_redirections.sh -ut_to_do_manually.sh -ut_vrac.sh -wip - - -"exit retour a la ligne" ------------ - - - -minishell ------------ - - - -l^Ds +COMMANDE=' echo "hugo"' ----------- diff --git a/tests/unit_tests/logs/minishell_log.txt b/tests/unit_tests/logs/minishell_log.txt index edfa877..d3834fe 100644 --- a/tests/unit_tests/logs/minishell_log.txt +++ b/tests/unit_tests/logs/minishell_log.txt @@ -2,60 +2,9 @@  -file: ut_vrac.sh +file: ut_heredocs.sh  -$ ------------ - - - -file_name_in_current_dir ------------ - - - -/bin/echo bonjour ------------ -bonjour - - -not_cmd ------------ - - - -echo bonjour > $test w/ t -ls -rm '$test' ------------ -logs -minishell -$test -tests_discord.md -unitests.sh -ut_bonus.sh -ut_builtins.sh -ut_exit_status.sh -ut_expensions.sh -ut_heredocs.sh -ut_pipes.sh -ut_redirections.sh -ut_to_do_manually.sh -ut_vrac.sh -wip - - -"exit retour a la ligne" ------------ - - - -minishell ------------ - - - -l^Ds +COMMANDE=' echo "hugo"' ----------- diff --git a/tests/unit_tests/unitests.sh b/tests/unit_tests/unitests.sh index 6ae2e79..74879c3 100644 --- a/tests/unit_tests/unitests.sh +++ b/tests/unit_tests/unitests.sh @@ -87,8 +87,8 @@ echo "" } -# check for argments, like options or files list -# if no file list, default file list is used +# check for arguments, like options or files list +# if no file in arguments, default file list is used list_files="$default_files" if [ $# -gt 0 ] then diff --git a/tests/unit_tests/ut_heredocs.sh b/tests/unit_tests/ut_heredocs.sh index 08de63d..4191f90 100644 --- a/tests/unit_tests/ut_heredocs.sh +++ b/tests/unit_tests/ut_heredocs.sh @@ -1,11 +1,11 @@ #!/bin/bash -COMMANDE=' echo "hugo"' -# cat << EOF -# hello you -# EOF' +COMMANDE=' echo "hugo" + cat << EOF + hello you + EOF' -#echo "$COMMANDE" | bash -i &>file.log +echo "$COMMANDE" | bash -i &>file.log #echo "$COMMANDE" | ./minishell &>file.log #cat << EOF