tests: update tests to reflect new parser

This commit is contained in:
Khaïs COLIN 2025-04-15 15:46:52 +02:00
parent 81ba53237c
commit 942217a45a

185
test.sh
View file

@ -587,6 +587,11 @@ expecting <<EOF
[dbg: 1] [dbg: 1]
[exec: 0] [exec: 0]
parsed command parsed command
╰─ t_cmd
├─ t_cmd_type = FT_SIMPLE
├─ flags = 0
├─ line = 0
╰─ value
╰─ t_simple_cmd ╰─ t_simple_cmd
├─ line = 0 ├─ line = 0
├─ t_wordlist ├─ t_wordlist
@ -608,184 +613,4 @@ parsed command
╰─ redirections = (empty redir list) ╰─ redirections = (empty redir list)
EOF 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)
EOF
finalize finalize