minishell/report.txt

136 lines
6.8 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

++++++++++++++++++++++++++++++++++++++++++++++++++++
redirections are parsed
++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ Failed test:
echo hello < in hi > out
++++ Got output:
╰─ t_cmdgroup
├─ t_cmdlist
│ ├─ num_cmds = 1
│ ╰─ cmd[0]
│ ├─ t_cmdlist_item
│ │ ╰─ t_pipeline
│ │ ├─ num_cmd = 1
│ │ ╰─ cmd[0]
│ │ ╰─ t_simple_cmd
│ │ ├─ words = [echo][hello][hi]
│ │ ╰─ t_redir_list
│ │ ├─ redirection[0]
│ │ │ ╰─ t_redirection
│ │ │ ├─ t_redir_type = REDIR_INPUT
│ │ │ ╰─ marker = [in]
│ │ ╰─ redirection[1]
│ │ ╰─ t_redirection
│ │ ├─ t_redir_type = REDIR_OUTPUT
│ │ ╰─ marker = [out]
│ ╰─ t_operator = END
╰─ (no redirections)
++++ But expected:
╰─ t_cmdgroup
├─ t_cmdlist
│ ├─ num_cmds = 1
│ ╰─ cmd[0]
│ ├─ t_cmdlist_item
│ │ ╰─ t_pipeline
│ │ ├─ num_cmd = 1
│ │ ╰─ cmd[0]
│ │ ╰─ t_simple_cmd
│ │ ├─ words = [echo][hello][hi]
│ │ ╰─ t_redir_list
│ │ ├─ redirection[0]
│ │ │ ╰─ t_redirection
│ │ ╰─ redirection[1]
│ │ ╰─ t_redirection
│ ╰─ t_operator = END
╰─ (no redirections)
++++ Diff:
(red is got, green is expected)
14,15d13
< │ │ │ ├─ t_redir_type = REDIR_INPUT
< │ │ │ ╰─ marker = [in]
18,19d15
< │ │ ├─ t_redir_type = REDIR_OUTPUT
< │ │ ╰─ marker = [out]
++++ Run this to debug:
echo 'echo hello < in hi > out' | ./minishell
++++++++++++++++++++++++++++++++++++++++++++++++++++
multiple redirections are parsed
++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ Failed test:
echo << HERE_DOC hello>outfile < infile < infile2 >> append
++++ Got output:
╰─ t_cmdgroup
├─ t_cmdlist
│ ├─ num_cmds = 1
│ ╰─ cmd[0]
│ ├─ t_cmdlist_item
│ │ ╰─ t_pipeline
│ │ ├─ num_cmd = 1
│ │ ╰─ cmd[0]
│ │ ╰─ t_simple_cmd
│ │ ├─ words = [echo][hello]
│ │ ╰─ t_redir_list
│ │ ├─ redirection[0]
│ │ │ ╰─ t_redirection
│ │ │ ├─ t_redir_type = REDIR_HERE_DOC
│ │ │ ╰─ marker = [HERE_DOC]
│ │ ├─ redirection[1]
│ │ │ ╰─ t_redirection
│ │ │ ├─ t_redir_type = REDIR_OUTPUT
│ │ │ ╰─ marker = [outfile]
│ │ ├─ redirection[2]
│ │ │ ╰─ t_redirection
│ │ │ ├─ t_redir_type = REDIR_INPUT
│ │ │ ╰─ marker = [infile]
│ │ ├─ redirection[3]
│ │ │ ╰─ t_redirection
│ │ │ ├─ t_redir_type = REDIR_INPUT
│ │ │ ╰─ marker = [infile2]
│ │ ╰─ redirection[4]
│ │ ╰─ t_redirection
│ │ ├─ t_redir_type = REDIR_APPEND
│ │ ╰─ marker = [append]
│ ╰─ t_operator = END
╰─ (no redirections)
++++ But expected:
++++ Diff:
(red is got, green is expected)
1,33c1
< ╰─ t_cmdgroup
< ├─ t_cmdlist
< │ ├─ num_cmds = 1
< │ ╰─ cmd[0]
< │ ├─ t_cmdlist_item
< │ │ ╰─ t_pipeline
< │ │ ├─ num_cmd = 1
< │ │ ╰─ cmd[0]
< │ │ ╰─ t_simple_cmd
< │ │ ├─ words = [echo][hello]
< │ │ ╰─ t_redir_list
< │ │ ├─ redirection[0]
< │ │ │ ╰─ t_redirection
< │ │ │ ├─ t_redir_type = REDIR_HERE_DOC
< │ │ │ ╰─ marker = [HERE_DOC]
< │ │ ├─ redirection[1]
< │ │ │ ╰─ t_redirection
< │ │ │ ├─ t_redir_type = REDIR_OUTPUT
< │ │ │ ╰─ marker = [outfile]
< │ │ ├─ redirection[2]
< │ │ │ ╰─ t_redirection
< │ │ │ ├─ t_redir_type = REDIR_INPUT
< │ │ │ ╰─ marker = [infile]
< │ │ ├─ redirection[3]
< │ │ │ ╰─ t_redirection
< │ │ │ ├─ t_redir_type = REDIR_INPUT
< │ │ │ ╰─ marker = [infile2]
< │ │ ╰─ redirection[4]
< │ │ ╰─ t_redirection
< │ │ ├─ t_redir_type = REDIR_APPEND
< │ │ ╰─ marker = [append]
< │ ╰─ t_operator = END
< ╰─ (no redirections)
---
> 
++++ Run this to debug:
echo 'echo << HERE_DOC hello>outfile < infile < infile2 >> append' | ./minishell