ninja: no work to do. /// /// Cases in Files /// ===== CASE: FILE test/parse-errors/01-bad-func.sh ===== foo (,) ^ test/parse-errors/01-bad-func.sh:15: Syntax error in expression (near Id.Arith_Comma) ===== CASE: FILE test/parse-errors/02-bad-func.sh ===== foo() ^ test/parse-errors/02-bad-func.sh:3: Unexpected word while parsing compound command (Id.Eof_Real) ===== CASE: FILE test/parse-errors/05-unterminated-single.sh ===== A B echo 'C ^ test/parse-errors/05-unterminated-single.sh:5: Unexpected EOF in single-quoted string that began here ===== CASE: FILE test/parse-errors/06-unterminated-double-long.sh ===== A B echo 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 " ^ test/parse-errors/06-unterminated-double-long.sh:9: Unexpected EOF reading double-quoted string that began here ===== CASE: FILE test/parse-errors/06-unterminated-double.sh ===== A B echo "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 ^ test/parse-errors/06-unterminated-double.sh:6: Unexpected EOF reading double-quoted string that began here ===== CASE: FILE test/parse-errors/07-unterminated-here-doc-2.sh ===== cat << "$@" ^ test/parse-errors/07-unterminated-here-doc-2.sh:2: Invalid here doc delimiter ===== CASE: FILE test/parse-errors/07-unterminated-here-doc.sh ===== cat < init:(arith_expr.BinaryAssign op_id:Arith_Equal left: right:(w ) ) cond:(arith_expr.Binary op: left: right:(w ) ) update:(arith_expr.UnaryAssign op_id:Node_PostDPlus child: ) body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ x))) terminator: ) ] right: ) ) ===== CASE: -n -c for ((; x<5; x++)); do echo $x; done ===== (command.ForExpr keyword: init:(arith_expr.EmptyZero) cond:(arith_expr.Binary op: left: right:(w ) ) update:(arith_expr.UnaryAssign op_id:Node_PostDPlus child: ) body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ x))) terminator: ) ] right: ) ) ===== CASE: -n -c for ((; ; x++)); do echo $x; done ===== (command.ForExpr keyword: init:(arith_expr.EmptyZero) cond:...0x3ffffffc update:(arith_expr.UnaryAssign op_id:Node_PostDPlus child: ) body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ x))) terminator: ) ] right: ) ) ===== CASE: -n -c for ((; ;)); do echo $x; done ===== (command.ForExpr keyword: init:(arith_expr.EmptyZero) cond:...0x3ffffffc update:...0x3ffffffc body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ x))) terminator: ) ] right: ) ) ===== CASE: -n -c for ((x=0; x<5; x++ b)); do echo $x; done ===== for ((x=0; x<5; x++ b)); do echo $x; done ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c for ((x=0 b; x<5; x++)); do echo $x; done ===== for ((x=0 b; x<5; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: -n -c for ((x=0; x<5 b; x++)); do echo $x; done ===== for ((x=0; x<5 b; x++)); do echo $x; done ^ [ -c flag ]:1: Expected ; here ===== CASE: -n -c ${a:1+2 b} ===== ${a:1+2 b} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: -n -c ${a:1+2:3+4 b} ===== ${a:1+2:3+4 b} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBrace) ===== CASE: -n -c ${a[1+2 b]} ===== ${a[1+2 b]} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RBracket) OK test-arith-integration *** Running test-arith-sub ===== CASE: -n -c echo $(( )) ===== (C (w ) (w (word_part.ArithSub left: anode:(arith_expr.EmptyZero) right: ) ) ) ===== CASE: -n -c echo $(()) ===== (C (w ) (w (word_part.ArithSub left: anode:(arith_expr.EmptyZero) right: ) ) ) ===== CASE: -n -c echo $(()x ===== echo $(()x ^ [ -c flag ]:1: Expected second ) to end arith sub ===== CASE: -n -c echo $(() ===== echo $(() ^ [ -c flag ]:1: Expected second ) to end arith sub ===== CASE: -n -c echo $(( 1 + 2 ; ===== echo $(( 1 + 2 ; ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen) ===== CASE: -n -c echo $(( 1 + 2 ); ===== echo $(( 1 + 2 ); ^ [ -c flag ]:1: Expected second ) to end arith sub ===== CASE: -n -c echo $(( ===== echo $(( ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c echo $(( 1 ===== echo $(( 1 ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen) OK test-arith-sub *** Running test-array-literal ===== CASE: -n -c a=(1 & 2) ===== a=(1 & 2) ^ [ -c flag ]:1: Unexpected token in array literal ===== CASE: -n -c a= (1 2) ===== a= (1 2) ^ [ -c flag ]:1: Expected ( after = ===== CASE: -n -c a=(1 2 ===== a=(1 2 ^ [ -c flag ]:1: Unexpected token in array literal ===== CASE: -n -c a=(1 ${2@} ) ===== a=(1 ${2@} ) ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) OK test-array-literal *** Running test-bool-expr ===== CASE: -n -c [[ a b ]] ===== [[ a b ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ a "a"$(echo hi)"b" ]] ===== [[ a "a"$(echo hi)"b" ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ a == ]] ===== [[ a == ]] ^ [ -c flag ]:1: Expected ]] ===== CASE: -n -c [[ ( 1 == 2 - ]] ===== [[ ( 1 == 2 - ]] ^ [ -c flag ]:1: Expected ), got word.Compound ===== CASE: -n -c [[ == ]] ===== [[ == ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.BoolBinary_GlobDEqual) ===== CASE: -n -c [[ ) ]] ===== [[ ) ]] ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_RParen) ===== CASE: -n -c [[ ( ]] ===== [[ ( ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Lit_DRightBracket) ===== CASE: -n -c [[ ;;; ]] ===== [[ ;;; ]] ^~ [ -c flag ]:1: Unexpected token in boolean expression (Id.Op_DSemi) ===== CASE: -n -c [[ ===== [[ ^ [ -c flag ]:1: Unexpected token in boolean expression (Id.Eof_Real) ===== CASE: -n -c [[ ( a == b foo${var} ]] ===== [[ ( a == b foo${var} ]] ^~~ [ -c flag ]:1: Expected ), got word.Compound OK test-bool-expr *** Running test-braced-var-sub ===== CASE: -n -c echo ${x*} ===== echo ${x*} ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c echo ${x@} ===== echo ${x@} ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c echo ${x.} ===== echo ${x.} ^ [ -c flag ]:1: Expected } to close ${ OK test-braced-var-sub *** Running test-case --- test-case YES case $x in foo) echo esac ===== CASE: -n -c case $x in foo) echo esac ===== (command.Case case_kw: to_match:(case_arg.Word w:(w ($ x))) arms_start: arms:[ (CaseArm left: pattern:(pat.Words words:[(w )]) middle: action:[(C (w ))] ) ] arms_end: ) bash=0 --- test-case YES case $x in foo) echo ;; esac ===== CASE: -n -c case $x in foo) echo ;; esac ===== (command.Case case_kw: to_match:(case_arg.Word w:(w ($ x))) arms_start: arms:[ (CaseArm left: pattern:(pat.Words words:[(w )]) middle: action:[(C (w ))] right: ) ] arms_end: ) bash=0 --- test-case YES case $x in foo) echo ;& esac ===== CASE: -n -c case $x in foo) echo ;& esac ===== (command.Case case_kw: to_match:(case_arg.Word w:(w ($ x))) arms_start: arms:[ (CaseArm left: pattern:(pat.Words words:[(w )]) middle: action:[(C (w ))] right: ) ] arms_end: ) bash=0 --- test-case YES case $x in foo) echo ;;& esac ===== CASE: -n -c case $x in foo) echo ;;& esac ===== (command.Case case_kw: to_match:(case_arg.Word w:(w ($ x))) arms_start: arms:[ (CaseArm left: pattern:(pat.Words words:[(w )]) middle: action:[(C (w ))] right: ) ] arms_end: ) bash=0 --- test-case NO ;& ===== CASE: -n -c ;& ===== ;& ^~ [ -c flag ]:1: Invalid word while parsing command bash: -c: line 0: syntax error near unexpected token `;&' bash: -c: line 0: `;&' bash=1 --- test-case NO echo ;& ===== CASE: -n -c echo ;& ===== echo ;& ^~ [ -c flag ]:1: Invalid word while parsing command line (Id.Op_SemiAmp) bash: -c: line 0: syntax error near unexpected token `;&' bash: -c: line 0: `echo ;&' bash=1 --- test-case NO echo ;;& ===== CASE: -n -c echo ;;& ===== echo ;;& ^~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Op_DSemiAmp) bash: -c: line 0: syntax error near unexpected token `;;&' bash: -c: line 0: `echo ;;&' bash=1 OK test-case *** Running test-cmd-parse ===== CASE: -n -c FOO=1 break ===== FOO=1 break ^~~~ [ -c flag ]:1: Control flow shouldn't have environment bindings ===== CASE: -n -c break 1 2 ===== break 1 2 ^ [ -c flag ]:1: Unexpected argument to 'break' ===== CASE: -n -c x"y"() { echo hi; } ===== x"y"() { echo hi; } ^ [ -c flag ]:1: Invalid function name ===== CASE: -n -c function x"y" { echo hi; } ===== function x"y" { echo hi; } ^ [ -c flag ]:1: Invalid KSH-style function name ===== CASE: -n -c } ===== } ^ [ -c flag ]:1: Unexpected right brace ===== CASE: -n -c case foo in *) echo ===== case foo in *) echo ^ [ -c flag ]:1: Expected ;; or esac ===== CASE: -n -c case foo in x|) echo ===== case foo in x|) echo ^ [ -c flag ]:1: Expected case pattern ===== CASE: -n -c ls foo| ===== ls foo| ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: -n -c ls foo&& ===== ls foo&& ^ [ -c flag ]:1: Unexpected EOF while parsing command ===== CASE: -n -c foo() ===== foo() ^ [ -c flag ]:1: Unexpected word while parsing compound command (Id.Eof_Real) ===== CASE: -n -c break >out ===== (command.ControlFlow keyword:) ===== CASE: -n -c break >out ===== break >out ^~~~~ [ -c flag ]:1: Control flow shouldn't have redirects ===== CASE: -n -c [ ( x ] ===== [ ( x ] ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_RBracket) OK test-cmd-parse *** Running test-command-sub ===== CASE: -n -c echo line 2 echo $( echo ===== echo $( echo ^ [ -c flag ]:3: Invalid word while parsing command list ===== CASE: -n -c echo line 2 echo ` echo ===== echo ` echo ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \` ===== echo ` echo \` ^ [ -c flag ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo line 2 echo ` echo \`unclosed ` ===== echo ` echo \`unclosed ` ^ [ backticks in [ -c flag ] ]:3: Unexpected EOF while looking for closing backtick ===== CASE: -n -c echo `for x in` ===== echo `for x in` ^ [ backticks in [ -c flag ] ]:1: Invalid word in for loop OK test-command-sub *** Running test-dparen ===== CASE: -n -c (()) ===== (command.DParen left: child:(arith_expr.EmptyZero) right: ) ===== CASE: -n -c (( )) ===== (command.DParen left: child:(arith_expr.EmptyZero) right: ) ===== CASE: -n -c (( ) ===== (( ) ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c (( )x ===== (( )x ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c $(echo $(( 1 + 2 ))) ===== (C (w (CommandSub left_token: child:(C (w ) (w (word_part.ArithSub left: anode:(arith_expr.Binary op: left:(w ) right:(w ) ) right: ) ) ) right: ) ) ) ===== CASE: -n -c $( (())) ===== (C (w (CommandSub left_token: child:(command.DParen left: child:(arith_expr.EmptyZero) right: ) right: ) ) ) ===== CASE: -n -c (( 1 + 2 / ===== (( 1 + 2 / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c (( 1 + 2 )/ ===== (( 1 + 2 )/ ^ [ -c flag ]:1: Expected second ) to end arith statement ===== CASE: -n -c (( 1 ===== (( 1 ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Eof_Real != Id.Arith_RParen) ===== CASE: -n -c (( ===== (( ^ [ -c flag ]:1: Unexpected end of input OK test-dparen *** Running test-eval_parse_error ===== CASE: -c x="echo )" eval $x ===== echo ) ^ [ eval arg at line 3 of [ -c flag ] ]:1 eval $x ^~~~ [ -c flag ]:3: Invalid word while parsing command line (Id.Op_RParen) OK test-eval_parse_error *** Running test-extra-newlines ===== CASE: -n -c for do done ===== for ^ [ -c flag ]:2: Expected loop variable (a constant word) ===== CASE: -n -c case in esac ===== case ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c while do done ===== do ^~ [ -c flag ]:3: Expected a condition ===== CASE: -n -c if then fi ===== then ^~~~ [ -c flag ]:3: Expected a condition ===== CASE: -n -c if true then elif then fi ===== then ^~~~ [ -c flag ]:5: Expected a condition ===== CASE: -n -c case | in esac ===== case | ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c case ; in esac ===== case ; ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c if true then fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12e6 cond:[(C (w ))] then_kw: action:[] then_tok:...0x1296 ) ] else_action:[] fi_kw: ) ===== CASE: -n -c while false do done ===== (command.WhileUntil keyword: cond:[(C (w ))] body:(command.DoGroup left: children:[] right:) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond:[ (command.Sentence child:(C (w )) terminator:) (C (w )) ] body:(command.DoGroup left: children:[] right:) ) ===== CASE: -n -c if true then fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12de cond:[(C (w ))] then_kw: action:[] then_tok:...0x1296 ) ] else_action:[] fi_kw: ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond:[ (command.Sentence child:(C (w )) terminator:) (C (w )) ] body:(command.DoGroup left: children:[] right:) ) OK test-extra-newlines *** Running test-here-doc ===== CASE: -n -c cat <) (w (CommandSub left_token: child:(C (w ) (w )) right: ) ) ) ===== CASE: -n -c echo "foo = `echo hi`" ===== (C (w ) (w (DQ child:(C (w ) (w )) right: ) ) ) ) ===== CASE: +O test-parse_backticks -n -c echo `echo hi` ===== oils: got invalid option 'test-parse_backticks' ===== CASE: +O test-parse_backticks -n -c echo "foo = `echo hi`" ===== oils: got invalid option 'test-parse_backticks' OK test-parse_backticks *** Running test-patsub ===== CASE: -n -c echo ${x/} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w) replace:(rhs_word.Empty) replace_mode:Undefined_Tok slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x//} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w) replace:(rhs_word.Empty) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x/foo} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Undefined_Tok slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x//foo} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x/%foo} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Lit_Percent slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x///foo} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x///} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(rhs_word.Empty) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x/%/} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w) replace:(w) replace_mode:Lit_Percent slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x////} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(w) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x/%//} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w) replace:(w ) replace_mode:Lit_Percent slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x//foo/replace } ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) ===== CASE: -n -c echo ${x//foo/replace$foo} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.PatSub pat:(w ) replace:(w ($ foo)) replace_mode:Lit_Slash slash_tok: ) right: ) ) ) OK test-patsub *** Running test-printf-builtin ===== CASE: -c printf % ===== % ^ [ printf arg at line 1 of [ -c flag ] ]:1 printf % ^ [ -c flag ]:1: Expected a printf format character ===== CASE: -c printf [%Z] ===== [%Z] ^ [ printf arg at line 1 of [ -c flag ] ]:1 printf [%Z] ^ [ -c flag ]:1: Invalid printf format character ===== CASE: -c printf -v "-invalid-" %s foo ===== -invalid- ^ [ dynamic LHS at ? ]:1 [??? no location ???] Unexpected end of input printf -v "-invalid-" %s foo ^~~~~~ [ -c flag ]:1: 'printf' got invalid LHS expression OK test-printf-builtin *** Running test-proc_func_reserved ===== CASE: -n -c proc p (x) { echo hi } ===== proc p (x) { echo hi } ^~~~ [ -c flag ]:1: proc is a YSH keyword, but this is OSH. ===== CASE: -n -c func f (x) { return (x) } ===== func f (x) { return (x) } ^~~~ [ -c flag ]:1: func is a YSH keyword, but this is OSH. OK test-proc_func_reserved *** Running test-quoted-strings ===== CASE: -n -c "unterminated double ===== "unterminated double ^ [ -c flag ]:1: Unexpected EOF reading double-quoted string that began here ===== CASE: -n -c 'unterminated single ===== 'unterminated single ^ [ -c flag ]:1: Unexpected EOF in single-quoted string that began here ===== CASE: -n -c "unterminated double multiline line 1 line 2 ===== "unterminated double multiline ^ [ -c flag ]:2: Unexpected EOF reading double-quoted string that began here ===== CASE: -n -c 'unterminated single multiline line 1 line 2 ===== 'unterminated single multiline ^ [ -c flag ]:2: Unexpected EOF in single-quoted string that began here OK test-quoted-strings *** Running test-redirect ===== CASE: -n -c echo < << ===== echo < << ^~ [ -c flag ]:1: Invalid token after redirect operator ===== CASE: -n -c echo $( echo > >> ) ===== echo $( echo > >> ) ^~ [ -c flag ]:1: Invalid token after redirect operator OK test-redirect *** Running test-regex-nix ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static " ) ]]; then echo hi fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12ee cond:[ (command.Sentence child:(command.DBracket left: expr:(bool_expr.LogicalNot child:(bool_expr.LogicalOr left:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w (DQ (BracedVarSub left: name_tok: var_name:params bracket_op:(bracket_op.WholeArray op_id:Arith_Star) right: ) ) ) right:(w (DQ )) ) right:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w (DQ (BracedVarSub left: name_tok: var_name:params bracket_op:(bracket_op.WholeArray op_id:Arith_Star) right: ) ) ) right:(w (DQ )) ) ) ) right: ) terminator: ) ] then_kw: action:[(C (w ) (w ))] then_tok:...0x11c2 ) ] else_action:[] fi_kw: ) ===== CASE: -n -c if [[ (foo =~ (x) ) ]]; then echo hi fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12ea cond:[ (command.Sentence child:(command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) terminator: ) ] then_kw: action:[(C (w ) (w ))] then_tok:...0x125a ) ] else_action:[] fi_kw: ) ===== CASE: -n -c if [[ (foo =~ x) ]]; then echo hi fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12ea cond:[ (command.Sentence child:(command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w ) ) right: ) terminator: ) ] then_kw: action:[(C (w ) (w ))] then_tok:...0x1272 ) ] else_action:[] fi_kw: ) ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static ") ]]; then echo hi fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x12ee cond:[ (command.Sentence child:(command.DBracket left: expr:(bool_expr.LogicalNot child:(bool_expr.LogicalOr left:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w (DQ (BracedVarSub left: name_tok: var_name:params bracket_op:(bracket_op.WholeArray op_id:Arith_Star) right: ) ) ) right:(w (DQ )) ) right:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w (DQ (BracedVarSub left: name_tok: var_name:params bracket_op:(bracket_op.WholeArray op_id:Arith_Star) right: ) ) ) right:(w (DQ )) ) ) ) right: ) terminator: ) ] then_kw: action:[(C (w ) (w ))] then_tok:...0x11c2 ) ] else_action:[] fi_kw: ) OK test-regex-nix *** Running test-regex-pipe ===== CASE: -n -c [[ a =~ b|c ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w ) ) right: ) OK test-regex-pipe *** Running test-regex-right-paren ===== CASE: -n -c [[ a =~ b ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w ) ) right: ) ===== CASE: -n -c [[ a =~ (b) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) ===== CASE: -n -c [[ (a =~ b) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w ) ) right: ) ===== CASE: -n -c [[ (a =~ (b)) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) ===== CASE: -n -c [[ (a =~ ( ===== [[ (a =~ ( ^ [ -c flag ]:1: Expected word after ( opening bash regex group ===== CASE: -n -c [[ (a =~ (b ===== [[ (a =~ (b ^ [ -c flag ]:1: Expected ) to close bash regex group OK test-regex-right-paren *** Running test-regex-space ===== CASE: -n -c [[ a =~ ( ) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) ===== CASE: -n -c [[ a =~ (a b)(c d) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) bash=0 ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: expr:(bool_expr.Binary op_id:BoolBinary_EqualTilde left:(w ) right:(w (word_part.BashRegexGroup left: child:(w ) right: ) ) ) right: ) OK test-regex-space *** Running test-shell_for ===== CASE: -n -c for x in & ===== for x in & ^ [ -c flag ]:1: Invalid word in for loop ===== CASE: -n -c for (( i=0; i<10; i++ )) ls ===== for (( i=0; i<10; i++ )) ls ^~ [ -c flag ]:1: Invalid word after for expression ===== CASE: -n -c for ( i=0; i<10; i++ ) ===== for ( i=0; i<10; i++ ) ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for $x in 1 2 3; do echo $i; done ===== for $x in 1 2 3; do echo $i; done ^~ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for x.y in 1 2 3; do echo $i; done ===== for x.y in 1 2 3; do echo $i; done ^~~ [ -c flag ]:1: Invalid loop variable name 'x.y' ===== CASE: -n -c for x in 1 2 3; & ===== for x in 1 2 3; & ^ [ -c flag ]:1: Expected word type Id.KW_Do, got Id.Op_Amp ===== CASE: -n -c for foo BAD ===== for foo BAD ^ [ -c flag ]:1: Expected loop variable (a constant word) ===== CASE: -n -c for var in x; do echo $var; done ===== (command.ForEach keyword: iter_names:[var] iterable:(for_iter.Words words:[(w )]) semi_tok: body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ var))) terminator: ) ] right: ) ) OK test-shell_for *** Running test-simple-command ===== CASE: -n -c PYTHONPATH=. FOO=(1 2) python ===== PYTHONPATH=. FOO=(1 2) python ^~~~ [ -c flag ]:1: Environment bindings can't contain array literals ===== CASE: -n -c PYTHONPATH+=1 python ===== PYTHONPATH+=1 python ^~~~~~~~~~~~ [ -c flag ]:1: Expected = in environment binding, got += ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =var ===== =var ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c =f(x) ===== =f(x) ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it OK test-simple-command *** Running test-slice ===== CASE: -n -c ${foo:42} ===== (C (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Slice begin:(w )) right: ) ) ) ===== CASE: -n -c ${foo:42+1} ===== (C (w (BracedVarSub left: name_tok: var_name:foo suffix_op:(suffix_op.Slice begin:(arith_expr.Binary op: left:(w ) right:(w ) ) ) right: ) ) ) ===== CASE: -n -c echo ${a:1;} ===== echo ${a:1;} ^ [ -c flag ]:1: Expected : or } in slice ===== CASE: -n -c echo ${a:1:2;} ===== echo ${a:1:2;} ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RBrace) OK test-slice *** Running test-syntax-abbrev ===== CASE: -n -c echo "double $x ${braced}" $(date) ===== (C (w ) (w (DQ ($ x) (${ VSub_Name braced))) (w (CommandSub left_token: child:(C (w )) right: ) ) ) (command.Simple blame_tok:(Token id:Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo \"double $x ${braced}\" $(date)" src:(source.CFlag) ) ) more_env:[] words:[ (CompoundWord parts:[...0x12ee]) (CompoundWord parts:[ (DoubleQuoted left:(Token id:Left_DoubleQuote length:1 col:5 line:...0x12f6) parts:[ (Token id:Lit_Chars length:7 col:6 line:...0x12f6) (SimpleVarSub tok:(Token id:VSub_DollarName length:2 col:13 line:...0x12f6) ) (Token id:Lit_Chars length:1 col:15 line:...0x12f6) (BracedVarSub left:(Token id:Left_DollarBrace length:2 col:16 line:...0x12f6) name_tok:(Token id:VSub_Name length:6 col:18 line:...0x12f6) var_name:braced right:(Token id:Right_DollarBrace length:1 col:24 line:...0x12f6) ) ] right:(Token id:Right_DoubleQuote length:1 col:25 line:...0x12f6) ) ] ) (CompoundWord parts:[ (CommandSub left_token:(Token id:Left_DollarParen length:2 col:27 line:...0x12f6) child:(command.Simple blame_tok:(Token id:Lit_Chars length:4 col:29 line:...0x12f6) more_env:[] words:[(CompoundWord parts:[...0x129a])] is_last_cmd:F ) right:(Token id:Eof_RParen length:1 col:33 line:...0x12f6) ) ] ) ] is_last_cmd:F ) ===== CASE: -n -c echo 'single' ===== (C (w ) (w (SQ single))) (command.Simple blame_tok:(Token id:Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo 'single'" src:(source.CFlag)) ) more_env:[] words:[ (CompoundWord parts:[...0x12e6]) (CompoundWord parts:[ (SingleQuoted left:(Token id:Left_SingleQuote length:1 col:5 line:...0x12ee) sval:single right:(Token id:Right_SingleQuote length:1 col:12 line:...0x12ee) ) ] ) ] is_last_cmd:F ) ===== CASE: -n -c var x = i + 42; ===== (command.Sentence child:(command.VarDecl keyword: lhs:[(NameType left: name:x)] rhs:(expr.Binary op: left:(Var i) right:(Const Expr_DecInt _) ) ) terminator: ) (command.Sentence child:(command.VarDecl keyword:(Token id:KW_Var length:3 col:0 line:(SourceLine line_num:1 content:"var x = i + 42;" src:(source.CFlag)) ) lhs:[ (NameType left:(Token id:Expr_Name length:1 col:4 line:...0x7f23b5273100) name:x ) ] rhs:(expr.Binary op:(Token id:Arith_Plus length:1 col:10 line:...0x7f23b5273100) left:(expr.Var left:(Token id:Expr_Name length:1 col:8 line:...0x7f23b5273100) name:i ) right:(expr.Const c:(Token id:Expr_DecInt length:2 col:12 line:...0x7f23b5273100) val:(value.Int i:42) ) ) ) terminator:(Token id:Op_Semi length:1 col:14 line:...0x7f23b5273100) ) OK test-syntax-abbrev *** Running test-test-builtin ===== CASE: -c [ x -a y f ] ===== [ x -a y f ] ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: -c test x -a y f ===== test x -a y f ^ [ -c flag ]:1: (test) Unexpected trailing word 'f' ===== CASE: -c [ x ===== [ x ^ [ -c flag ]:1: missing closing ] ===== CASE: -c [ x x ] ===== [ x x ] ^ [ -c flag ]:1: (test) Expected unary operator, got 'x' (2 args) ===== CASE: -c [ x x "a b" ] ===== [ x x "a b" ] ^ [ -c flag ]:1: (test) Expected binary operator, got 'x' (3 args) ===== CASE: -c [ -t xxx ] ===== [ -t xxx ] ^~~ [ -c flag ]:1: (test) Invalid file descriptor 'xxx' ===== CASE: -c [ \( x -a -y -a z ] ===== [??? no location ???] (test) Expected ), got EOF OK test-test-builtin *** Running test-word-parse ===== CASE: -n -c echo ${ ===== echo ${ ^ [ -c flag ]:1: Unexpected token in ${} ===== CASE: -n -c echo ${a[@Z ===== echo ${a[@Z ^ [ -c flag ]:1: Expected ] to close subscript ===== CASE: -n -c echo ${x.} ===== echo ${x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${!x.} ===== echo ${!x.} ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c echo ${#a. ===== echo ${#a. ^ [ -c flag ]:1: Expected } after length expression ===== CASE: -n -c for (( i = 0; i < 10; i++ ; ===== for (( i = 0; i < 10; i++ ; ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Arith_Semi != Id.Arith_RParen) ===== CASE: -n -c for (( i = 0; i < 10; i++ / ===== for (( i = 0; i < 10; i++ / ^ [ -c flag ]:1: Unexpected end of input ===== CASE: -n -c echo @(extglob|foo ===== echo @(extglob|foo ^~ [ -c flag ]:1: Unexpected EOF reading extended glob that began here ===== CASE: -n -c ${undef:- ===== ${undef:- ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$ ===== ${undef:-$ ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${undef:-$F ===== ${undef:-$F ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x@ ===== ${x@ ^ [ -c flag ]:1: Unexpected token in ${} (VOp3) ===== CASE: -n -c ${x@Q ===== ${x@Q ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x% ===== ${x% ^ [ -c flag ]:1: Expected } to close ${ ===== CASE: -n -c ${x/ ===== ${x/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/ ===== ${x/a/ ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x/a/b ===== ${x/a/b ^ [ -c flag ]:1: Expected } after replacement string, got Id.Eof_Real ===== CASE: -n -c ${x: ===== ${x: ^ [ -c flag ]:1: Unexpected end of input OK test-word-parse test/parse-errors.sh: 37 tests passed.