mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
tests: update tests to reflect new parser
This commit is contained in:
parent
81ba53237c
commit
942217a45a
1 changed files with 23 additions and 198 deletions
221
test.sh
221
test.sh
|
|
@ -587,205 +587,30 @@ expecting <<EOF
|
|||
[dbg: 1]
|
||||
[exec: 0]
|
||||
parsed command
|
||||
╰─ t_simple_cmd
|
||||
╰─ t_cmd
|
||||
├─ t_cmd_type = FT_SIMPLE
|
||||
├─ flags = 0
|
||||
├─ line = 0
|
||||
├─ t_wordlist
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [echo]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [unclosed]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ╰─ t_worddesc
|
||||
│ ├─ word = ['(']
|
||||
│ ├─ marker = [ ' ]
|
||||
│ ├─ flags = 2
|
||||
│ ╰─ t_token_type = WORD_TOKEN
|
||||
╰─ redirections = (empty redir list)
|
||||
EOF
|
||||
|
||||
when_run <<EOF "token type attribution is correct"
|
||||
.debug
|
||||
.exec
|
||||
()|||&&>>><<<
|
||||
EOF
|
||||
expecting <<EOF
|
||||
[dbg: 1]
|
||||
[exec: 0]
|
||||
parsed command
|
||||
╰─ t_simple_cmd
|
||||
├─ line = 0
|
||||
├─ t_wordlist
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [(]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = OPEN_PARENTH_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [)]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = CLOSE_PARENTH_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [||]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = OR_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [|]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = PIPE_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [&&]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = AND_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [>>]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = OUT_APPEND_REDIR_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [>]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = OUT_TRUNC_REDIR_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [<<]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = HERE_DOC_REDIR_TOKEN
|
||||
│ ╰─ t_worddesc
|
||||
│ ├─ word = [<]
|
||||
│ ├─ marker = [ ]
|
||||
│ ├─ flags = 0
|
||||
│ ╰─ t_token_type = IN_REDIR_TOKEN
|
||||
╰─ redirections = (empty redir list)
|
||||
EOF
|
||||
|
||||
when_run <<EOF "token type attribution is correct when tokens are double-quoted"
|
||||
.debug
|
||||
.exec
|
||||
"(" ")" "|" "||" "&&" ">" ">>" "<" "<<"
|
||||
EOF
|
||||
expecting <<EOF
|
||||
[dbg: 1]
|
||||
[exec: 0]
|
||||
parsed command
|
||||
╰─ t_simple_cmd
|
||||
├─ line = 0
|
||||
├─ t_wordlist
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ["("]
|
||||
│ │ ├─ marker = [ " ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [")"]
|
||||
│ │ ├─ marker = [ " ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ["|"]
|
||||
│ │ ├─ marker = [ " ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ["||"]
|
||||
│ │ ├─ marker = [ "" ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ["&&"]
|
||||
│ │ ├─ marker = [ "" ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [">"]
|
||||
│ │ ├─ marker = [ " ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [">>"]
|
||||
│ │ ├─ marker = [ "" ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ["<"]
|
||||
│ │ ├─ marker = [ " ]
|
||||
│ │ ├─ flags = 34
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ╰─ t_worddesc
|
||||
│ ├─ word = ["<<"]
|
||||
│ ├─ marker = [ "" ]
|
||||
│ ├─ flags = 34
|
||||
│ ╰─ t_token_type = WORD_TOKEN
|
||||
╰─ redirections = (empty redir list)
|
||||
EOF
|
||||
|
||||
when_run <<EOF "token type attribution is correct when tokens are single-quoted"
|
||||
.debug
|
||||
.exec
|
||||
'(' ')' '|' '||' '&&' '>' '>>' '<' '<<'
|
||||
EOF
|
||||
expecting <<EOF
|
||||
[dbg: 1]
|
||||
[exec: 0]
|
||||
parsed command
|
||||
╰─ t_simple_cmd
|
||||
├─ line = 0
|
||||
├─ t_wordlist
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['(']
|
||||
│ │ ├─ marker = [ ' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [')']
|
||||
│ │ ├─ marker = [ ' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['|']
|
||||
│ │ ├─ marker = [ ' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['||']
|
||||
│ │ ├─ marker = [ '' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['&&']
|
||||
│ │ ├─ marker = [ '' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['>']
|
||||
│ │ ├─ marker = [ ' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['>>']
|
||||
│ │ ├─ marker = [ '' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = ['<']
|
||||
│ │ ├─ marker = [ ' ]
|
||||
│ │ ├─ flags = 2
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ╰─ t_worddesc
|
||||
│ ├─ word = ['<<']
|
||||
│ ├─ marker = [ '' ]
|
||||
│ ├─ flags = 2
|
||||
│ ╰─ t_token_type = WORD_TOKEN
|
||||
╰─ redirections = (empty redir list)
|
||||
╰─ value
|
||||
╰─ t_simple_cmd
|
||||
├─ line = 0
|
||||
├─ t_wordlist
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [echo]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ├─ t_worddesc
|
||||
│ │ ├─ word = [unclosed]
|
||||
│ │ ├─ marker = [ ]
|
||||
│ │ ├─ flags = 0
|
||||
│ │ ╰─ t_token_type = WORD_TOKEN
|
||||
│ ╰─ t_worddesc
|
||||
│ ├─ word = ['(']
|
||||
│ ├─ marker = [ ' ]
|
||||
│ ├─ flags = 2
|
||||
│ ╰─ t_token_type = WORD_TOKEN
|
||||
╰─ redirections = (empty redir list)
|
||||
EOF
|
||||
|
||||
finalize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue