/// /// 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: Id.Arith_Equal left: right: {} ) cond: (arith_expr.Binary op: left: right: {} ) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] is_last_cmd: F ) 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: {} ) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] is_last_cmd: F ) terminator: ) ] right: ) ) ===== CASE: -n -c for ((; ; x++)); do echo $x; done ===== (command.ForExpr keyword: init: (arith_expr__EmptyZero) cond: (arith_expr__EmptyOne) update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] is_last_cmd: F ) terminator: ) ] right: ) ) ===== CASE: -n -c for ((; ;)); do echo $x; done ===== (command.ForExpr keyword: init: (arith_expr__EmptyZero) cond: (arith_expr__EmptyOne) update: ...0x7fcdafc5f6d0 body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] is_last_cmd: F ) 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 $(( )) ===== (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ArithSub left: anode: (arith_expr__EmptyZero) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo $(()) ===== (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ArithSub left: anode: (arith_expr__EmptyZero) right: ) } ] is_last_cmd: F ) ===== 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:{($ x)}) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) ] 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:{($ x)}) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] 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:{($ x)}) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] 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:{($ x)}) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] 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 ))) ===== (command.Simple blame_tok: more_env: [] words: [ { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ArithSub left: anode: (arith_expr.Binary op: left: {} right: {} ) right: ) } ] is_last_cmd: F ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c $( (())) ===== (command.Simple blame_tok: more_env: [] words: [ { (CommandSub left_token: child: (command.DParen left: child: (arith_expr__EmptyZero) right: ) right: ) } ] is_last_cmd: F ) ===== 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: cond: (condition.Shell commands: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) then_kw: action: [] then_tok: ) ] else_action: [] fi_kw: ) ===== CASE: -n -c while false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) body: (command.DoGroup left: children:[] right:) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) terminator: ) (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) body: (command.DoGroup left: children:[] right:) ) ===== CASE: -n -c if true then fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) then_kw: action: [] then_tok: ) ] else_action: [] fi_kw: ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) terminator: ) (command.Simple blame_tok: more_env: [] words: [{}] is_last_cmd: F ) ] ) body: (command.DoGroup left: children:[] right:) ) OK test-extra-newlines *** Running test-here-doc ===== CASE: -n -c cat < more_env: [] words: [ {} { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo "foo = `echo hi`" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ child: (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) right: ) ) } ] is_last_cmd: F ) ===== 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/} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Undefined_Tok slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x//} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x/foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Undefined_Tok slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x//foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x/%foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x///foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: { } replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x///} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: (rhs_word__Empty) replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x/%/} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x////} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x/%//} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Percent slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x//foo/replace } ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: {} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c echo ${x//foo/replace$foo} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.PatSub pat: {} replace: { ($ foo)} replace_mode: Id.Lit_Slash slash_tok: ) right: ) } ] is_last_cmd: F ) 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: cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: { (DQ (BracedVarSub left: token: var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: ) ) } right: {(DQ )} ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: { (DQ (BracedVarSub left: token: var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: ) ) } right: {(DQ )} ) ) ) right: ) terminator: ) ] ) then_kw: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) ] then_tok: ) ] else_action: [] fi_kw: ) ===== CASE: -n -c if [[ (foo =~ (x) ) ]]; then echo hi fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: {} right: ) } ) right: ) terminator: ) ] ) then_kw: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) ] then_tok: ) ] else_action: [] fi_kw: ) ===== CASE: -n -c if [[ (foo =~ x) ]]; then echo hi fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: {} ) right: ) terminator: ) ] ) then_kw: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) ] then_tok: ) ] else_action: [] fi_kw: ) ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static ") ]]; then echo hi fi ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: { (DQ (BracedVarSub left: token: var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: ) ) } right: {(DQ )} ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: { (DQ (BracedVarSub left: token: var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: ) ) } right: {(DQ )} ) ) ) right: ) terminator: ) ] ) then_kw: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] is_last_cmd: F ) ] then_tok: ) ] 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: Id.BoolBinary_EqualTilde left: {} right: { } ) right: ) OK test-regex-pipe *** Running test-regex-right-paren ===== CASE: -n -c [[ a =~ b ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: {} ) right: ) ===== CASE: -n -c [[ a =~ (b) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: {} right: ) } ) right: ) ===== CASE: -n -c [[ (a =~ b) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: {} ) right: ) ===== CASE: -n -c [[ (a =~ (b)) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: {} 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: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: {} right: ) } ) right: ) ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: { } right: ) } ) right: ) ===== CASE: -n -c [[ a =~ (a b)(c d) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: { } right: ) (word_part.BashRegexGroup left: child: { } right: ) } ) right: ) bash=0 ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {} right: { (word_part.BashRegexGroup left: child: { } 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:[{}]) semi_tok: body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ var)}] is_last_cmd: F ) 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} ===== (command.Simple blame_tok: more_env: [] words: [ { (BracedVarSub left: token: var_name: foo suffix_op: (suffix_op.Slice begin:{}) right: ) } ] is_last_cmd: F ) ===== CASE: -n -c ${foo:42+1} ===== (command.Simple blame_tok: more_env: [] words: [ { (BracedVarSub left: token: var_name: foo suffix_op: (suffix_op.Slice begin: (arith_expr.Binary op: left: {} right: {} ) ) right: ) } ] is_last_cmd: F ) ===== 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-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: 36 tests passed.