[1/21] cxx asan '' cpp/fanos.cc _build/obj/cxx-asan/cpp/fanos.o [2/21] cxx asan '' cpp/libc.cc _build/obj/cxx-asan/cpp/libc.o [3/21] cxx asan '' cpp/frontend_pyreadline.cc _build/obj/cxx-asan/cpp/frontend_pyreadline.o [4/21] cxx asan '' cpp/frontend_flag_spec.cc _build/obj/cxx-asan/cpp/frontend_flag_spec.o [5/21] cxx asan '' cpp/osh_tdop.cc _build/obj/cxx-asan/cpp/osh_tdop.o [6/21] cxx asan '' cpp/osh.cc _build/obj/cxx-asan/cpp/osh.o [7/21] cxx asan '' cpp/core.cc _build/obj/cxx-asan/cpp/core.o [8/21] cxx asan '' cpp/frontend_match.cc _build/obj/cxx-asan/cpp/frontend_match.o [9/21] cxx asan '' cpp/pylib.cc _build/obj/cxx-asan/cpp/pylib.o [10/21] cxx asan '' cpp/pgen2.cc _build/obj/cxx-asan/cpp/pgen2.o [11/21] cxx asan '' _gen/frontend/arg_types.cc _build/obj/cxx-asan/_gen/frontend/arg_types.o [12/21] cxx asan '' _gen/frontend/signal.cc _build/obj/cxx-asan/_gen/frontend/signal.o [13/21] cxx asan '' cpp/stdlib.cc _build/obj/cxx-asan/cpp/stdlib.o [14/21] cxx asan '' _gen/data_lang/nil8.asdl.cc _build/obj/cxx-asan/_gen/data_lang/nil8.asdl.o [15/21] cxx asan '' _gen/frontend/consts.cc _build/obj/cxx-asan/_gen/frontend/consts.o [16/21] cxx asan '' _gen/frontend/help_meta.cc _build/obj/cxx-asan/_gen/frontend/help_meta.o [17/21] cxx asan '' _gen/osh/arith_parse.cc _build/obj/cxx-asan/_gen/osh/arith_parse.o [18/21] cxx asan '' _gen/ysh/grammar_tables.cc _build/obj/cxx-asan/_gen/ysh/grammar_tables.o [19/21] cxx asan '' _gen/bin/oils_for_unix.mycpp.cc _build/obj/cxx-asan/_gen/bin/oils_for_unix.mycpp.o [20/21] LINK cxx asan '' _bin/cxx-asan/oils-for-unix _build/obj/cxx-asan/_gen/bin/oils_for_unix.mycpp.o _build/obj/cxx-asan/_gen/bin/text_files.o _build/obj/cxx-asan/_gen/core/runtime.asdl.o _build/obj/cxx-asan/_gen/core/value.asdl.o _build/obj/cxx-asan/_gen/cpp/build_stamp.o _build/obj/cxx-asan/cpp/core.o _build/obj/cxx-asan/cpp/data_lang.o _build/obj/cxx-asan/cpp/fanos.o _build/obj/cxx-asan/cpp/fanos_shared.o _build/obj/cxx-asan/cpp/frontend_flag_spec.o _build/obj/cxx-asan/cpp/frontend_match.o _build/obj/cxx-asan/cpp/frontend_pyreadline.o _build/obj/cxx-asan/cpp/libc.o _build/obj/cxx-asan/cpp/osh.o _build/obj/cxx-asan/cpp/osh_tdop.o _build/obj/cxx-asan/cpp/pgen2.o _build/obj/cxx-asan/cpp/pylib.o _build/obj/cxx-asan/cpp/stdlib.o _build/obj/cxx-asan/_gen/data_lang/nil8.asdl.o _build/obj/cxx-asan/_gen/display/pretty.asdl.o _build/obj/cxx-asan/_gen/frontend/arg_types.o _build/obj/cxx-asan/_gen/frontend/consts.o _build/obj/cxx-asan/_gen/frontend/help_meta.o _build/obj/cxx-asan/_gen/frontend/id_kind.asdl.o _build/obj/cxx-asan/_gen/frontend/signal.o _build/obj/cxx-asan/_gen/frontend/syntax.asdl.o _build/obj/cxx-asan/mycpp/bump_leak_heap.o _build/obj/cxx-asan/mycpp/gc_builtins.o _build/obj/cxx-asan/mycpp/gc_mops.o _build/obj/cxx-asan/mycpp/gc_mylib.o _build/obj/cxx-asan/mycpp/gc_str.o _build/obj/cxx-asan/mycpp/hash.o _build/obj/cxx-asan/mycpp/mark_sweep_heap.o _build/obj/cxx-asan/_gen/osh/arith_parse.o _build/obj/cxx-asan/_gen/ysh/grammar_tables.o [21/21] SYMLINK _bin/cxx-asan oils-for-unix osh 'osh' -> 'oils-for-unix' /// /// 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 <<EOF ^~ test/parse-errors/07-unterminated-here-doc.sh:5: Couldn't find terminator for here doc that starts here /// /// Cases in Functions, with strings /// *** Running test-append ===== CASE: -n -c a[-1]+=(4 5) ===== a[-1]+=(4 5) ^ [ -c flag ]:1: Unexpected left paren (might need a space before it) OK test-append *** Running test-args-parse-builtin ===== CASE: -c read -x ===== read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: -c builtin read -x ===== builtin read -x ^~ [ -c flag ]:1: 'read' doesn't accept flag -x ===== CASE: -c read -n ===== read -n ^~ [ -c flag ]:1: 'read' expected argument to '-n' ===== CASE: -c read -n x ===== read -n x ^ [ -c flag ]:1: 'read' expected integer after -n, got 'x' ===== CASE: -c set -o errexit +o oops ===== set -o errexit +o oops ^~~ [ -c flag ]:1: 'set' got invalid option 'oops' OK test-args-parse-builtin *** Running test-args-parse-more ===== CASE: -c set -z ===== set -z ^~ [ -c flag ]:1: 'set' got invalid flag '-z' ===== CASE: -c shopt -s foo ===== shopt -s foo ^~~~~ [ -c flag ]:1: 'shopt' got invalid option 'foo' ===== CASE: -c shopt -z ===== shopt -z ^~ [ -c flag ]:1: 'shopt' doesn't accept flag -z OK test-args-parse-more *** Running test-arith-context ===== CASE: -n -c a[x+]=1 ===== a[x+]=1 ^ [ array LHS in [ -c flag ] ]:1: Unexpected end of input ===== CASE: -c eval a[x+]=1 ===== a[x+]=1 ^ [ array LHS in [ eval word at line 1 of [ -c flag ] ] ]:1: Unexpected end of input ===== CASE: -n -c a[]=1 ===== a[]=1 ^ [ array LHS in [ -c flag ] ]:1: Unexpected end of input ===== CASE: -n -c a[*]=1 ===== a[*]=1 ^ [ array LHS in [ -c flag ] ]:1: Token can't be used in prefix position ===== CASE: -n -c (( a + { )) ===== (( a + { )) ^ [ -c flag ]:1: Unexpected token while parsing arithmetic: '{' ===== CASE: -n -c (( a + } )) ===== (( a + } )) ^ [ -c flag ]:1: Token can't be used in prefix position OK test-arith-context *** Running test-arith-expr ===== CASE: -n -c $(( 1 + + )) ===== $(( 1 + + )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c $(( 1 2 )) ===== $(( 1 2 )) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c $(( - ; )) ===== $(( - ; )) ^ [ -c flag ]:1: Token can't be used in prefix position ===== CASE: -n -c $(( ` )) ===== $(( ` )) ^ [ -c flag ]:1: Unexpected EOF while looking for closing backtick ===== CASE: -n -c $(( $ )) ===== $(( $ )) ^ [ -c flag ]:1: Unexpected token while parsing arithmetic: '$' ===== CASE: -n -c $(( x+1 = 42 )) ===== $(( x+1 = 42 )) ^ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: -n -c $(( (x+42)++ )) ===== $(( (x+42)++ )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid ===== CASE: -n -c $(( ++(x+42) )) ===== $(( ++(x+42) )) ^~ [ -c flag ]:1: Left-hand side of this assignment is invalid OK test-arith-expr *** Running test-arith-integration ===== CASE: -n -c echo $((a b)) ===== echo $((a b)) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c ((a b)) ===== ((a b)) ^ [ -c flag ]:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) ===== CASE: -n -c for ((x=0; x<5; x++)); do echo $x; done ===== (command.ForExpr keyword: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for ((x=0; x<5; x++)); do echo $x; done" src:(source.CFlag)) ) init: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: (Token id:Id.Lit_ArithVarLike length:1 col:6 line:...0x13fa) right: (CompoundWord parts:[(Token id:Id.Lit_Digits length:1 col:8 line:...0x13fa)]) ) cond: (arith_expr.Binary op: (Token id:Id.Arith_Less length:1 col:12 line:...0x13fa) left: (Token id:Id.Lit_ArithVarLike length:1 col:11 line:...0x13fa) right: (CompoundWord parts:[(Token id:Id.Lit_Digits length:1 col:13 line:...0x13fa)]) ) update: (arith_expr.UnaryAssign op_id: Id.Node_PostDPlus child: (Token id:Id.Lit_ArithVarLike length:1 col:16 line:...0x13fa) ) body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:23 line:...0x13fa) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:26 line:...0x13fa) more_env: [] words: [ (CompoundWord parts:[...0x1372]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:2 col:31 line:...0x13fa) ) ] ) ] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:33 line:...0x13fa) ) ] right: (Token id:Id.KW_Done length:4 col:35 line:...0x13fa) ) ) ===== CASE: -n -c for ((; x<5; x++)); do echo $x; done ===== (command.ForExpr keyword: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for ((; x<5; x++)); do echo $x; done" src:(source.CFlag)) ) init: ...0x3ffffffc cond: (arith_expr.Binary op: (Token id:Id.Arith_Less length:1 col:9 line:...0x13fa) left: (Token id:Id.Lit_ArithVarLike length:1 col:8 line:...0x13fa) right: (CompoundWord parts:[(Token id:Id.Lit_Digits length:1 col:10 line:...0x13fa)]) ) update: (arith_expr.UnaryAssign op_id: Id.Node_PostDPlus child: (Token id:Id.Lit_ArithVarLike length:1 col:13 line:...0x13fa) ) body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:20 line:...0x13fa) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:23 line:...0x13fa) more_env: [] words: [ (CompoundWord parts:[...0x138a]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:2 col:28 line:...0x13fa) ) ] ) ] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:30 line:...0x13fa) ) ] right: (Token id:Id.KW_Done length:4 col:32 line:...0x13fa) ) ) ===== CASE: -n -c for ((; ; x++)); do echo $x; done ===== (command.ForExpr keyword: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for ((; ; x++)); do echo $x; done" src:(source.CFlag)) ) init: ...0x3ffffffc cond: ...0x3ffffffc update: (arith_expr.UnaryAssign op_id: Id.Node_PostDPlus child: (Token id:Id.Lit_ArithVarLike length:1 col:10 line:...0x13fa) ) body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:17 line:...0x13fa) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:20 line:...0x13fa) more_env: [] words: [ (CompoundWord parts:[...0x13a2]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:2 col:25 line:...0x13fa) ) ] ) ] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:27 line:...0x13fa) ) ] right: (Token id:Id.KW_Done length:4 col:29 line:...0x13fa) ) ) ===== CASE: -n -c for ((; ;)); do echo $x; done ===== (command.ForExpr keyword: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for ((; ;)); do echo $x; done" src:(source.CFlag)) ) init: ...0x3ffffffc cond: ...0x3ffffffc update: ...0x3ffffffc body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:13 line:...0x13f6) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:16 line:...0x13f6) more_env: [] words: [ (CompoundWord parts:[...0x13ae]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:2 col:21 line:...0x13f6) ) ] ) ] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:23 line:...0x13f6) ) ] right: (Token id:Id.KW_Done length:4 col:25 line:...0x13f6) ) ) ===== 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: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo $(( ))" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (word_part.ArithSub left: (Token id:Id.Left_DollarDParen length:3 col:5 line:...0x13f2) anode: ...0x3ffffffc right: (Token id:Id.Right_DollarDParen length:1 col:10 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo $(()) ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo $(())" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (word_part.ArithSub left: (Token id:Id.Left_DollarDParen length:3 col:5 line:...0x13f2) anode: ...0x3ffffffc right: (Token id:Id.Right_DollarDParen length:1 col:9 line:...0x13f2) ) ] ) ] do_fork: T ) ===== 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: (Token id: Id.KW_Case length: 4 col: 0 line: (SourceLine line_num:1 content:"case $x in foo) echo\n" src:(source.CFlag)) ) to_match: (case_arg.Word w: (CompoundWord parts: [(SimpleVarSub tok:(Token id:Id.VSub_DollarName length:2 col:5 line:...0x13ee))] ) ) arms_start: (Token id:Id.KW_In length:2 col:8 line:...0x13ee) arms: [ (CaseArm left: (Token id:Id.Lit_Chars length:3 col:11 line:...0x13ee) pattern: (pat.Words words:[(CompoundWord parts:[...0x13be])]) middle: (Token id:Id.Right_CasePat length:1 col:14 line:...0x13ee) action: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:16 line:...0x13ee) more_env: [] words: [(CompoundWord parts:[...0x13a2])] do_fork: T ) ] ) ] arms_end: (Token id: Id.KW_Esac length: 4 col: 0 line: (SourceLine line_num:2 content:esac src:...0x3ffffffc) ) ) bash=0 --- test-case YES case $x in foo) echo ;; esac ===== CASE: -n -c case $x in foo) echo ;; esac ===== (command.Case case_kw: (Token id: Id.KW_Case length: 4 col: 0 line: (SourceLine line_num:1 content:"case $x in foo) echo ;; esac" src:(source.CFlag)) ) to_match: (case_arg.Word w: (CompoundWord parts: [(SimpleVarSub tok:(Token id:Id.VSub_DollarName length:2 col:5 line:...0x13f6))] ) ) arms_start: (Token id:Id.KW_In length:2 col:8 line:...0x13f6) arms: [ (CaseArm left: (Token id:Id.Lit_Chars length:3 col:11 line:...0x13f6) pattern: (pat.Words words:[(CompoundWord parts:[...0x13c6])]) middle: (Token id:Id.Right_CasePat length:1 col:14 line:...0x13f6) action: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:16 line:...0x13f6) more_env: [] words: [(CompoundWord parts:[...0x13aa])] do_fork: T ) ] right: (Token id:Id.Op_DSemi length:2 col:21 line:...0x13f6) ) ] arms_end: (Token id:Id.KW_Esac length:4 col:24 line:...0x13f6) ) bash=0 --- test-case YES case $x in foo) echo ;& esac ===== CASE: -n -c case $x in foo) echo ;& esac ===== (command.Case case_kw: (Token id: Id.KW_Case length: 4 col: 0 line: (SourceLine line_num:1 content:"case $x in foo) echo ;& esac" src:(source.CFlag)) ) to_match: (case_arg.Word w: (CompoundWord parts: [(SimpleVarSub tok:(Token id:Id.VSub_DollarName length:2 col:5 line:...0x13f6))] ) ) arms_start: (Token id:Id.KW_In length:2 col:8 line:...0x13f6) arms: [ (CaseArm left: (Token id:Id.Lit_Chars length:3 col:11 line:...0x13f6) pattern: (pat.Words words:[(CompoundWord parts:[...0x13c6])]) middle: (Token id:Id.Right_CasePat length:1 col:14 line:...0x13f6) action: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:16 line:...0x13f6) more_env: [] words: [(CompoundWord parts:[...0x13aa])] do_fork: T ) ] right: (Token id:Id.Op_SemiAmp length:2 col:21 line:...0x13f6) ) ] arms_end: (Token id:Id.KW_Esac length:4 col:24 line:...0x13f6) ) bash=0 --- test-case YES case $x in foo) echo ;;& esac ===== CASE: -n -c case $x in foo) echo ;;& esac ===== (command.Case case_kw: (Token id: Id.KW_Case length: 4 col: 0 line: (SourceLine line_num:1 content:"case $x in foo) echo ;;& esac" src:(source.CFlag)) ) to_match: (case_arg.Word w: (CompoundWord parts: [(SimpleVarSub tok:(Token id:Id.VSub_DollarName length:2 col:5 line:...0x13f6))] ) ) arms_start: (Token id:Id.KW_In length:2 col:8 line:...0x13f6) arms: [ (CaseArm left: (Token id:Id.Lit_Chars length:3 col:11 line:...0x13f6) pattern: (pat.Words words:[(CompoundWord parts:[...0x13c6])]) middle: (Token id:Id.Right_CasePat length:1 col:14 line:...0x13f6) action: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:16 line:...0x13f6) more_env: [] words: [(CompoundWord parts:[...0x13aa])] do_fork: T ) ] right: (Token id:Id.Op_DSemiAmp length:3 col:21 line:...0x13f6) ) ] arms_end: (Token id:Id.KW_Esac length:4 col:25 line:...0x13f6) ) 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: (Token id: Id.ControlFlow_Break length: 5 col: 0 line: (SourceLine line_num:1 content:"break >out" src:(source.CFlag)) ) ) ===== 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: (Token id:Id.Op_DLeftParen length:2 col:0 line:(SourceLine line_num:1 content:"(())" src:(source.CFlag))) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:3 line:...0x13f6) ) ===== CASE: -n -c (( )) ===== (command.DParen left: (Token id:Id.Op_DLeftParen length:2 col:0 line:(SourceLine line_num:1 content:"(( ))" src:(source.CFlag))) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:4 line:...0x13f6) ) ===== 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: (Token id: Id.Left_DollarParen length: 2 col: 0 line: (SourceLine line_num:1 content:"$(echo $(( 1 + 2 )))" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts: [ (CommandSub left_token: ...0x13ea child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:2 line:...0x13f2) more_env: [] words: [ (CompoundWord parts:[...0x13de]) (CompoundWord parts: [ (word_part.ArithSub left: (Token id:Id.Left_DollarDParen length:3 col:7 line:...0x13f2) anode: (arith_expr.Binary op: (Token id:Id.Arith_Plus length:1 col:13 line:...0x13f2) left: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:11 line:...0x13f2)] ) right: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:15 line:...0x13f2)] ) ) right: (Token id:Id.Right_DollarDParen length:1 col:18 line:...0x13f2) ) ] ) ] do_fork: T ) right: (Token id:Id.Eof_RParen length:1 col:19 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c $( (())) ===== (command.Simple blame_tok: (Token id:Id.Left_DollarParen length:2 col:0 line:(SourceLine line_num:1 content:"$( (()))" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts: [ (CommandSub left_token: ...0x13ea child: (command.DParen left: (Token id:Id.Op_DLeftParen length:2 col:3 line:...0x13f2) child: ...0x3ffffffc right: (Token id:Id.Op_DRightParen length:1 col:6 line:...0x13f2) ) right: (Token id:Id.Eof_RParen length:1 col:7 line:...0x13f2) ) ] ) ] do_fork: T ) ===== 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 word 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: (Token id:Id.KW_If length:2 col:2 line:(SourceLine line_num:2 content:" if\n" src:(source.CFlag))) arms: [ (IfArm keyword: ...0x13e2 cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" true\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x13c2])] do_fork: T ) ] ) then_kw: (Token id: Id.KW_Then length: 4 col: 2 line: (SourceLine line_num:4 content:" then\n" src:...0x3ffffffc) ) action: [] then_tok: ...0x1392 ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 2 line: (SourceLine line_num:5 content:" fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c while false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 2 line: (SourceLine line_num:3 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x13be])] do_fork: T ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:4 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:5 content:" done\n" src:...0x3ffffffc) ) ) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" true;\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x13c2])] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:6 line:...0x13ca) ) (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 2 line: (SourceLine line_num:4 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x138a])] do_fork: T ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:5 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:6 content:" done\n" src:...0x3ffffffc) ) ) ) ===== CASE: -n -c if true then fi ===== (command.If if_kw: (Token id:Id.KW_If length:2 col:2 line:(SourceLine line_num:2 content:" if true\n" src:(source.CFlag))) arms: [ (IfArm keyword: ...0x13da cond: (condition.Shell commands: [ (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:5 line:...0x13e2) more_env: [] words: [(CompoundWord parts:[...0x13c6])] do_fork: T ) ] ) then_kw: (Token id: Id.KW_Then length: 4 col: 2 line: (SourceLine line_num:3 content:" then\n" src:...0x3ffffffc) ) action: [] then_tok: ...0x1392 ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 2 line: (SourceLine line_num:4 content:" fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c while true; false do done ===== (command.WhileUntil keyword: (Token id:Id.KW_While length:5 col:2 line:(SourceLine line_num:2 content:" while true;\n" src:(source.CFlag))) cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:8 line:...0x13ea) more_env: [] words: [(CompoundWord parts:[...0x13d2])] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:12 line:...0x13ea) ) (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 5 col: 8 line: (SourceLine line_num:3 content:" false\n" src:...0x3ffffffc) ) more_env: [] words: [(CompoundWord parts:[...0x1396])] do_fork: T ) ] ) body: (command.DoGroup left: (Token id: Id.KW_Do length: 2 col: 2 line: (SourceLine line_num:4 content:" do\n" src:...0x3ffffffc) ) children: [] right: (Token id: Id.KW_Done length: 4 col: 2 line: (SourceLine line_num:5 content:" done\n" src:...0x3ffffffc) ) ) ) OK test-extra-newlines *** Running test-here-doc ===== CASE: -n -c cat <<EOF $(( 1 * )) EOF ===== $(( 1 * )) ^ [ -c flag ]:2: Token can't be used in prefix position ===== CASE: -n -c cat <<EOF invalid: ${a!} EOF ===== invalid: ${a!} ^ [ -c flag ]:2: Expected } to close ${ ===== CASE: -n -c cat <<EOF $(for x in ) EOF ===== $(for x in ) ^ [ -c flag ]:2: Invalid word in for loop OK test-here-doc *** Running test-here-doc-delimiter ===== CASE: -n -c cat << $(invalid here end) ===== cat << $(invalid here end) ^~ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << $((1+2)) ===== cat << $((1+2)) ^~~ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << a=(1 2 3) ===== cat << a=(1 2 3) ^~ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << \a$(invalid) ===== cat << \a$(invalid) ^~ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << "double"$(invalid) ===== cat << "double"$(invalid) ^ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << ~foo/$(invalid) ===== cat << ~foo/$(invalid) ^ [ -c flag ]:1: Unterminated here doc began here ===== CASE: -n -c cat << $var/$(invalid) ===== cat << $var/$(invalid) ^~~~ [ -c flag ]:1: Unterminated here doc began here OK test-here-doc-delimiter *** Running test-invalid-brace-ranges ===== CASE: -n -c echo {1..3..-1} ===== echo {1..3..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending integer range ===== CASE: -n -c echo {1..3..0} ===== echo {1..3..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {3..1..1} ===== echo {3..1..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending integer range ===== CASE: -n -c echo {3..1..0} ===== echo {3..1..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {a..Z} ===== echo {a..Z} ^~~~ [ -c flag ]:1: Mismatched cases in character range ===== CASE: -n -c echo {a..z..0} ===== echo {a..z..0} ^~~~~~~ [ -c flag ]:1: Step can't be 0 ===== CASE: -n -c echo {a..z..-1} ===== echo {a..z..-1} ^~~~~~~~ [ -c flag ]:1: Invalid step -1 for ascending character range ===== CASE: -n -c echo {z..a..1} ===== echo {z..a..1} ^~~~~~~ [ -c flag ]:1: Invalid step 1 for descending character range OK test-invalid-brace-ranges *** Running test-nested_source_argvword ===== CASE: -c code="printf % x" eval $code ===== % ^ [ printf word at line 1 of [ eval word at line 3 of [ -c flag ] ] ]:1 printf % x ^ [ eval word at line 3 of [ -c flag ] ]:1 eval $code ^~~~ [ -c flag ]:3: Expected a printf format character OK test-nested_source_argvword *** Running test-other-builtins ===== CASE: -c shift 1 2 ===== shift 1 2 ^~~~~ [ -c flag ]:1: 'shift' got too many arguments ===== CASE: -c shift zzz ===== shift zzz ^~~~~ [ -c flag ]:1: 'shift' Invalid shift argument 'zzz' ===== CASE: -c pushd x y ===== pushd x y ^ [ -c flag ]:1: 'pushd' got too many arguments ===== CASE: -c pwd -x ===== pwd -x ^~ [ -c flag ]:1: 'pwd' doesn't accept flag -x ===== CASE: -c pp x foo a-x ===== pp x foo a-x ^ [ -c flag ]:1: 'pp' got invalid action 'x' ===== CASE: -c wait zzz ===== wait zzz ^~~ [ -c flag ]:1: 'wait' expected PID or jobspec, got 'zzz' ===== CASE: -c wait %jobspec-not-supported ===== wait %jobspec-not-supported ^ [ -c flag ]:1: 'wait' expected PID or jobspec, got '%jobspec-not-supported' ===== CASE: -c unset invalid-var-name ===== unset invalid-var-name ^~~~~ [ -c flag ]:1: fatal: Invalid LHS to modify ===== CASE: -c getopts hc: invalid-var-name ===== getopts hc: invalid-var-name ^~ [ -c flag ]:1: 'getopts' got invalid variable name 'invalid-var-name' OK test-other-builtins *** Running test-parse_backticks ===== CASE: -n -c echo `echo hi` ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo `echo hi`" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (CommandSub left_token: (Token id:Id.Left_Backtick length:1 col:5 line:...0x13f2) child: (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 0 line: (SourceLine line_num: 1 content: "echo hi" src: (source.Reparsed what: backticks left_token: ...0x13d2 right_token: (Token id:Id.Backtick_Right length:1 col:13 line:...0x13f2) ) ) ) more_env: [] words: [ (CompoundWord parts:[...0x13a2]) (CompoundWord parts: [(Token id:Id.Lit_Chars length:2 col:5 line:...0x13a6)] ) ] do_fork: T ) right: ...0x13c6 ) ] ) ] do_fork: T ) ===== CASE: -n -c echo "foo = `echo hi`" ===== (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 0 line: (SourceLine line_num:1 content:"echo \"foo = `echo hi`\"" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (DoubleQuoted left: (Token id:Id.Left_DoubleQuote length:1 col:5 line:...0x13f2) parts: [ (Token id:Id.Lit_Chars length:6 col:6 line:...0x13f2) (CommandSub left_token: (Token id:Id.Left_Backtick length:1 col:12 line:...0x13f2) child: (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 0 line: (SourceLine line_num: 1 content: "echo hi" src: (source.Reparsed what: backticks left_token: ...0x13c6 right_token: (Token id: Id.Backtick_Right length: 1 col: 20 line: ...0x13f2 ) ) ) ) more_env: [] words: [ (CompoundWord parts:[...0x1396]) (CompoundWord parts: [(Token id:Id.Lit_Chars length:2 col:5 line:...0x139a)] ) ] do_fork: T ) right: ...0x13ba ) ] right: (Token id:Id.Right_DoubleQuote length:1 col:21 line:...0x13f2) ) ] ) ] do_fork: T ) ===== 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: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x/}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[]) replace: ...0x3ffffffc replace_mode: Id.Undefined_Tok slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:9 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x//} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x//}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[]) replace: ...0x3ffffffc replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:10 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x/foo} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x/foo}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Chars length:3 col:9 line:...0x13f2)]) replace: ...0x3ffffffc replace_mode: Id.Undefined_Tok slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:12 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x//foo} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x//foo}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Chars length:3 col:10 line:...0x13f2)]) replace: ...0x3ffffffc replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:13 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x/%foo} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x/%foo}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Chars length:3 col:10 line:...0x13f2)]) replace: ...0x3ffffffc replace_mode: Id.Lit_Percent slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:13 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x///foo} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x///foo}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts: [ (Token id:Id.Lit_Slash length:1 col:10 line:...0x13f2) (Token id:Id.Lit_Chars length:3 col:11 line:...0x13f2) ] ) replace: ...0x3ffffffc replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:14 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x///} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x///}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Slash length:1 col:10 line:...0x13f2)]) replace: ...0x3ffffffc replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:11 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x/%/} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x/%/}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[]) replace: (CompoundWord parts:[]) replace_mode: Id.Lit_Percent slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:11 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x////} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x////}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Slash length:1 col:10 line:...0x13f2)]) replace: (CompoundWord parts:[]) replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:12 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x/%//} ===== (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:0 line:(SourceLine line_num:1 content:"echo ${x/%//}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[]) replace: (CompoundWord parts:[(Token id:Id.Lit_Slash length:1 col:11 line:...0x13f2)]) replace_mode: Id.Lit_Percent slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:12 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x//foo/replace } ===== (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 0 line: (SourceLine line_num:1 content:"echo ${x//foo/replace\n" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts:[...0x13e6]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13ee) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13ee) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Chars length:3 col:10 line:...0x13ee)]) replace: (CompoundWord parts:[(Token id:Id.Lit_Chars length:8 col:14 line:...0x13ee)]) replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13ee) ) right: (Token id: Id.Right_DollarBrace length: 1 col: 0 line: (SourceLine line_num:2 content:"}" src:...0x3ffffffc) ) ) ] ) ] do_fork: T ) ===== CASE: -n -c echo ${x//foo/replace$foo} ===== (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 0 line: (SourceLine line_num:1 content:"echo ${x//foo/replace$foo}" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts:[...0x13ea]) (CompoundWord parts: [ (BracedVarSub left: (Token id:Id.Left_DollarBrace length:2 col:5 line:...0x13f2) token: (Token id:Id.VSub_Name length:1 col:7 line:...0x13f2) var_name: x suffix_op: (suffix_op.PatSub pat: (CompoundWord parts:[(Token id:Id.Lit_Chars length:3 col:10 line:...0x13f2)]) replace: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:7 col:14 line:...0x13f2) (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:4 col:21 line:...0x13f2) ) ] ) replace_mode: Id.Lit_Slash slash_tok: (Token id:Id.VOp2_Slash length:1 col:8 line:...0x13f2) ) right: (Token id:Id.Right_DollarBrace length:1 col:25 line:...0x13f2) ) ] ) ] do_fork: T ) OK test-patsub *** Running test-printf-builtin ===== CASE: -c printf % ===== % ^ [ printf word at line 1 of [ -c flag ] ]:1 printf % ^ [ -c flag ]:1: Expected a printf format character ===== CASE: -c printf [%Z] ===== [%Z] ^ [ printf word 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 word 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: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num: 2 content: "if [[ ! (\" ${params[*]} \" =~ \" -shared \" || \" ${params[*]} \" =~ \" -static \" ) ]]; then\n" src: (source.CFlag) ) ) arms: [ (IfArm keyword: ...0x13ea cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x13ee) expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 9 line: ...0x13ee ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 10 line: ...0x13ee ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 11 line: ...0x13ee ) token: (Token id: Id.VSub_Name length: 6 col: 13 line: ...0x13ee ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 22 line: ...0x13ee ) ) (Token id: Id.Lit_Chars length: 1 col: 23 line: ...0x13ee ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 24 line: ...0x13ee ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 29 line: ...0x13ee ) parts: [(Token id:Id.Lit_Chars length:9 col:30 line:...0x13ee)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 39 line: ...0x13ee ) ) ] ) ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 44 line: ...0x13ee ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 45 line: ...0x13ee ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 46 line: ...0x13ee ) token: (Token id: Id.VSub_Name length: 6 col: 48 line: ...0x13ee ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 57 line: ...0x13ee ) ) (Token id: Id.Lit_Chars length: 1 col: 58 line: ...0x13ee ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 59 line: ...0x13ee ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 64 line: ...0x13ee ) parts: [(Token id:Id.Lit_Chars length:9 col:65 line:...0x13ee)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 74 line: ...0x13ee ) ) ] ) ) ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:78 line:...0x13ee) ) terminator: (Token id:Id.Op_Semi length:1 col:80 line:...0x13ee) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:82 line:...0x13ee) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x129e]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x12a6)]) ] do_fork: T ) ] then_tok: ...0x12be ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ (foo =~ (x) ) ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num:2 content:"if [[ (foo =~ (x) ) ]]; then\n" src:(source.CFlag)) ) arms: [ (IfArm keyword: ...0x13e6 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x13ea) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [(Token id:Id.Lit_Chars length:3 col:7 line:...0x13ea)] ) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:14 line:...0x13ea) child: (CompoundWord parts: [(Token id:Id.Lit_Chars length:1 col:15 line:...0x13ea)] ) right: (Token id: Id.Right_BashRegexGroup length: 1 col: 16 line: ...0x13ea ) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:20 line:...0x13ea) ) terminator: (Token id:Id.Op_Semi length:1 col:22 line:...0x13ea) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:24 line:...0x13ea) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x1336]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x133e)]) ] do_fork: T ) ] then_tok: ...0x1356 ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ (foo =~ x) ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num:2 content:"if [[ (foo =~ x) ]]; then\n" src:(source.CFlag)) ) arms: [ (IfArm keyword: ...0x13e6 cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x13ea) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [(Token id:Id.Lit_Chars length:3 col:7 line:...0x13ea)] ) right: (CompoundWord parts: [(Token id:Id.Lit_Chars length:1 col:14 line:...0x13ea)] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:17 line:...0x13ea) ) terminator: (Token id:Id.Op_Semi length:1 col:19 line:...0x13ea) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:21 line:...0x13ea) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x134e]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x1356)]) ] do_fork: T ) ] then_tok: ...0x136e ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) ===== CASE: -n -c if [[ ! (" ${params[*]} " =~ " -shared " || " ${params[*]} " =~ " -static ") ]]; then echo hi fi ===== (command.If if_kw: (Token id: Id.KW_If length: 2 col: 0 line: (SourceLine line_num: 2 content: "if [[ ! (\" ${params[*]} \" =~ \" -shared \" || \" ${params[*]} \" =~ \" -static \") ]]; then\n" src: (source.CFlag) ) ) arms: [ (IfArm keyword: ...0x13ea cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: (Token id:Id.KW_DLeftBracket length:2 col:3 line:...0x13ee) expr: (bool_expr.LogicalNot child: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 9 line: ...0x13ee ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 10 line: ...0x13ee ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 11 line: ...0x13ee ) token: (Token id: Id.VSub_Name length: 6 col: 13 line: ...0x13ee ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 22 line: ...0x13ee ) ) (Token id: Id.Lit_Chars length: 1 col: 23 line: ...0x13ee ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 24 line: ...0x13ee ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 29 line: ...0x13ee ) parts: [(Token id:Id.Lit_Chars length:9 col:30 line:...0x13ee)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 39 line: ...0x13ee ) ) ] ) ) right: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 44 line: ...0x13ee ) parts: [ (Token id: Id.Lit_Chars length: 1 col: 45 line: ...0x13ee ) (BracedVarSub left: (Token id: Id.Left_DollarBrace length: 2 col: 46 line: ...0x13ee ) token: (Token id: Id.VSub_Name length: 6 col: 48 line: ...0x13ee ) var_name: params bracket_op: (bracket_op.WholeArray op_id:Id.Arith_Star) right: (Token id: Id.Right_DollarBrace length: 1 col: 57 line: ...0x13ee ) ) (Token id: Id.Lit_Chars length: 1 col: 58 line: ...0x13ee ) ] right: (Token id: Id.Right_DoubleQuote length: 1 col: 59 line: ...0x13ee ) ) ] ) right: (CompoundWord parts: [ (DoubleQuoted left: (Token id: Id.Left_DoubleQuote length: 1 col: 64 line: ...0x13ee ) parts: [(Token id:Id.Lit_Chars length:9 col:65 line:...0x13ee)] right: (Token id: Id.Right_DoubleQuote length: 1 col: 74 line: ...0x13ee ) ) ] ) ) ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:77 line:...0x13ee) ) terminator: (Token id:Id.Op_Semi length:1 col:79 line:...0x13ee) ) ] ) then_kw: (Token id:Id.KW_Then length:4 col:81 line:...0x13ee) action: [ (command.Simple blame_tok: (Token id: Id.Lit_Chars length: 4 col: 2 line: (SourceLine line_num:3 content:" echo hi\n" src:...0x3ffffffc) ) more_env: [] words: [ (CompoundWord parts:[...0x129e]) (CompoundWord parts:[(Token id:Id.Lit_Chars length:2 col:7 line:...0x12a6)]) ] do_fork: T ) ] then_tok: ...0x12be ) ] else_action: [] fi_kw: (Token id: Id.KW_Fi length: 2 col: 0 line: (SourceLine line_num:4 content:"fi\n" src:...0x3ffffffc) ) ) OK test-regex-nix *** Running test-regex-pipe ===== CASE: -n -c [[ a =~ b|c ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ b|c ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:8 line:...0x13f2) (Token id:Id.Lit_Other length:1 col:9 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:10 line:...0x13f2) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x13f2) ) OK test-regex-pipe *** Running test-regex-right-paren ===== CASE: -n -c [[ a =~ b ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ b ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:8 line:...0x13f2)]) ) right: (Token id:Id.Lit_DRightBracket length:2 col:10 line:...0x13f2) ) ===== CASE: -n -c [[ a =~ (b) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x13f2) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x13f2)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:10 line:...0x13f2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x13f2) ) ===== CASE: -n -c [[ (a =~ b) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ (a =~ b) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:4 line:...0x13f2)]) right: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x13f2)]) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x13f2) ) ===== CASE: -n -c [[ (a =~ (b)) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ (a =~ (b)) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:4 line:...0x13f2)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:9 line:...0x13f2) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:10 line:...0x13f2)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:11 line:...0x13f2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:14 line:...0x13f2) ) ===== 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: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ ( ) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x13f2) child: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:9 line:...0x13f2)]) right: (Token id:Id.Right_BashRegexGroup length:1 col:10 line:...0x13f2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:12 line:...0x13f2) ) ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b c) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x13f2) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:10 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:11 line:...0x13f2) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:12 line:...0x13f2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:14 line:...0x13f2) ) ===== CASE: -n -c [[ a =~ (a b)(c d) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (a b)(c d) ]]" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13f2)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x13f2) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:10 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:11 line:...0x13f2) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:12 line:...0x13f2) ) (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:13 line:...0x13f2) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:14 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:15 line:...0x13f2) (Token id:Id.Lit_Chars length:1 col:16 line:...0x13f2) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:17 line:...0x13f2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:19 line:...0x13f2) ) bash=0 ===== CASE: -n -c [[ a =~ (b c) ]] ===== (command.DBracket left: (Token id: Id.KW_DLeftBracket length: 2 col: 0 line: (SourceLine line_num:1 content:"[[ a =~ (b\n" src:(source.CFlag)) ) expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: (CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:3 line:...0x13ee)]) right: (CompoundWord parts: [ (word_part.BashRegexGroup left: (Token id:Id.BashRegex_LParen length:1 col:8 line:...0x13ee) child: (CompoundWord parts: [ (Token id:Id.Lit_Chars length:1 col:9 line:...0x13ee) (Token id:Id.Lit_Chars length:1 col:10 line:...0x13ee) (Token id: Id.Lit_Chars length: 1 col: 0 line: (SourceLine line_num:2 content:"c) ]]" src:...0x3ffffffc) ) ] ) right: (Token id:Id.Right_BashRegexGroup length:1 col:1 line:...0x13a2) ) ] ) ) right: (Token id:Id.Lit_DRightBracket length:2 col:3 line:...0x13a2) ) 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: (Token id: Id.KW_For length: 3 col: 0 line: (SourceLine line_num:1 content:"for var in x; do echo $var; done" src:(source.CFlag)) ) iter_names: [var] iterable: (for_iter.Words words: [(CompoundWord parts:[(Token id:Id.Lit_Chars length:1 col:11 line:...0x13fa)])] ) semi_tok: (Token id:Id.Op_Semi length:1 col:12 line:...0x13fa) body: (command.DoGroup left: (Token id:Id.KW_Do length:2 col:14 line:...0x13fa) children: [ (command.Sentence child: (command.Simple blame_tok: (Token id:Id.Lit_Chars length:4 col:17 line:...0x13fa) more_env: [] words: [ (CompoundWord parts:[...0x1396]) (CompoundWord parts: [ (SimpleVarSub tok: (Token id:Id.VSub_DollarName length:4 col:22 line:...0x13fa) ) ] ) ] do_fork: T ) terminator: (Token id:Id.Op_Semi length:1 col:26 line:...0x13fa) ) ] right: (Token id:Id.KW_Done length:4 col:28 line:...0x13fa) ) ) 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: (Token id:Id.Left_DollarBrace length:2 col:0 line:(SourceLine line_num:1 content:"${foo:42}" src:(source.CFlag))) more_env: [] words: [ (CompoundWord parts: [ (BracedVarSub left: ...0x13ea token: (Token id:Id.VSub_Name length:3 col:2 line:...0x13f2) var_name: foo suffix_op: (suffix_op.Slice begin: (CompoundWord parts:[(Token id:Id.Lit_Digits length:2 col:6 line:...0x13f2)]) ) right: (Token id:Id.Arith_RBrace length:1 col:8 line:...0x13f2) ) ] ) ] do_fork: T ) ===== CASE: -n -c ${foo:42+1} ===== (command.Simple blame_tok: (Token id: Id.Left_DollarBrace length: 2 col: 0 line: (SourceLine line_num:1 content:"${foo:42+1}" src:(source.CFlag)) ) more_env: [] words: [ (CompoundWord parts: [ (BracedVarSub left: ...0x13ea token: (Token id:Id.VSub_Name length:3 col:2 line:...0x13f2) var_name: foo suffix_op: (suffix_op.Slice begin: (arith_expr.Binary op: (Token id:Id.Arith_Plus length:1 col:8 line:...0x13f2) left: (CompoundWord parts:[(Token id:Id.Lit_Digits length:2 col:6 line:...0x13f2)]) right: (CompoundWord parts: [(Token id:Id.Lit_Digits length:1 col:9 line:...0x13f2)] ) ) ) right: (Token id:Id.Arith_RBrace length:1 col:10 line:...0x13f2) ) ] ) ] do_fork: T ) ===== 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.