*** Running test-blocks ===== CASE: -n -c >out { echo hi } ===== >out { echo hi } ^ [ -c flag ]:1: Unexpected typed args ===== CASE: -n -c a=1 b=2 { echo hi } ===== a=1 b=2 { echo hi } ^ [ -c flag ]:1: Unexpected typed args ===== CASE: -n -c break { echo hi } ===== break { echo hi } ^ [ -c flag ]:1: Unexpected typed args ===== CASE: -n -c cd / { echo hi } cd / ===== cd / { echo hi } cd / ^~ [ -c flag ]:1: Invalid word while parsing command line OK test-blocks *** Running test-func-sig ===== CASE: -n -c func f { echo hi } ===== func f { echo hi } ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_LBrace) ===== CASE: -n -c func f () { echo hi } ===== (command.Func keyword: name: pos_params: [] named_params: [] body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] redirects: [] right: ) ) ===== CASE: -n -c func f (a List[Int] = [3,4]) { echo hi } ===== (command.Func keyword: name: pos_params: [ (Param blame_tok: name: a type: (TypeExpr tok: name: List params: [(TypeExpr tok: name:Int)] ) default_val: (expr.List left: elts: [(expr.Const c:) (expr.Const c:)] ctx: expr_context.Store ) ) ] named_params: [] body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] redirects: [] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c) { echo hi } ===== (command.Func keyword: name: pos_params: [(Param blame_tok: name:a) (Param blame_tok: name:b)] rest_of_pos: (RestParam blame_tok: name:rest) named_params: [(Param blame_tok: name:c)] body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] redirects: [] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c, ...rest) { echo hi } ===== (command.Func keyword: name: pos_params: [(Param blame_tok: name:a) (Param blame_tok: name:b)] rest_of_pos: (RestParam blame_tok: name:rest) named_params: [(Param blame_tok: name:c)] rest_of_named: (RestParam blame_tok: name:rest) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] redirects: [] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c, ...rest;) { echo hi } ===== func f (a, b, ...rest; c, ...rest;) { echo hi } ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_Semi) OK test-func-sig *** Running test-func-var-checker ===== CASE: -n -c func f(x) { setvar x = True } ===== (command.Func keyword: name: pos_params: [(Param blame_tok: name:x)] named_params: [] body: (BraceGroup left: children: [ (command.PlaceMutation keyword: lhs: [(place_expr.Var name:)] op: rhs: (expr.Var name:) ) ] redirects: [] right: ) ) ===== CASE: -n -c func f() { setvar x = True } ===== setvar x = True ^ [ -c flag ]:3: 'x' hasn't been declared OK test-func-var-checker *** Running test-hay-assign ===== CASE: -n -c name = val ===== name = val ^ [ -c flag ]:2: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c rule { x = 42 } ===== x = 42 ^ [ -c flag ]:3: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c RULE { x = 42 } ===== x = 42 ^ [ -c flag ]:3: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c Rule { x = 42 } ===== (command.Simple blame_tok: more_env: [] words: [{}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [(command.VarDecl lhs:[(NameType name:)] rhs:(expr.Const c:))] redirects: [] right: ) lines: [ (SourceLine line_num:2 content:'Rule {\n' src:(source__CFlag)) (SourceLine line_num:3 content:' x = 42\n' src:(source__CFlag)) (SourceLine line_num:4 content:'}\n' src:(source__CFlag)) ] ) do_fork: T ) ===== CASE: -n -c Rule X Y { x = 42 } ===== (command.Simple blame_tok: more_env: [] words: [{} {} {}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [(command.VarDecl lhs:[(NameType name:)] rhs:(expr.Const c:))] redirects: [] right: ) lines: [ (SourceLine line_num:2 content:'Rule X Y {\n' src:(source__CFlag)) (SourceLine line_num:3 content:' x = 42\n' src:(source__CFlag)) (SourceLine line_num:4 content:'}\n' src:(source__CFlag)) ] ) do_fork: T ) ===== CASE: -n -c RULe { # inconsistent but OK x = 42 } ===== (command.Simple blame_tok: more_env: [] words: [{}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [(command.VarDecl lhs:[(NameType name:)] rhs:(expr.Const c:))] redirects: [] right: ) lines: [ (SourceLine line_num:2 content:'RULe { # inconsistent but OK\n' src:(source__CFlag)) (SourceLine line_num:3 content:' x = 42\n' src:(source__CFlag)) (SourceLine line_num:4 content:'}\n' src:(source__CFlag)) ] ) do_fork: T ) ===== CASE: -n -c hay eval :result { Rule { foo = 42 } bar = 43 # parse error here } ===== bar = 43 # parse error here ^ [ -c flag ]:8: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c hay define TASK TASK build { foo = 42 } ===== foo = 42 ^ [ -c flag ]:5: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c hay define Package/TASK Package libc { TASK build { # this is not an attribute, should not be valid foo = 42 } } ===== foo = 42 ^ [ -c flag ]:7: Unexpected = (Hint: use var/setvar, or quote it) ===== CASE: -n -c hay define Rule Rule { return (x) } ===== return (x) ^ [ -c flag ]:5: Typed return is only allowed inside func OK test-hay-assign *** Running test-hay-shell-assign ===== CASE: -n -c hay define Package Package foo { version=1 } ===== version=1 ^~~~~~~~ [ -c flag ]:5: Use var/setvar to assign in YSH ===== CASE: -n -c hay define Package/User Package foo { User bob { sudo=1 } } ===== sudo=1 ^~~~~ [ -c flag ]:6: Use var/setvar to assign in YSH ===== CASE: -n -c hay define Package/SHELL/User Package foo { SHELL bob { sudo=1 User { name = "z" } } } ===== (command.CommandList children: [ (command.Simple blame_tok: more_env: [] words: [{} {} {<'Package/SHELL/User'>}] redirects: [] do_fork: T ) (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [ (command.ShAssignment left: children: [ (command.VarDecl lhs: [(NameType name:)] rhs: (DQ ) ) ] redirects: [] right: ) lines: [ (SourceLine line_num: 7 content: ' User {\n' src: (source__CFlag) ) (SourceLine line_num: 8 content: ' name = "z"\n' src: (source__CFlag) ) (SourceLine line_num: 9 content: ' }\n' src: (source__CFlag) ) ] ) do_fork: T ) ] redirects: [] right: ) lines: [] ) do_fork: T ) ] redirects: [] right: ) lines: [] ) do_fork: T ) ] ) ===== CASE: -n -c hay define Package/SHELL/User Package foo { SHELL bob { # Disallowed # a = b User { x=1 } } } ===== x=1 ^~ [ -c flag ]:9: Use var/setvar to assign in YSH OK test-hay-shell-assign *** Running test-parse-at ===== CASE: -n -c echo @ ===== echo @ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: -n -c echo @@ ===== echo @@ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: -n -c echo @{foo} ===== echo @{foo} ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: -n -c echo @/foo/ ===== echo @/foo/ ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) ===== CASE: -n -c echo @"foo" ===== echo @"foo" ^ [ -c flag ]:1: Literal @ starting a word must be quoted (parse_at_all) OK test-parse-at *** Running test-parse-brace ===== CASE: -n -c if test -f foo{ echo hi } ===== if test -f foo{ echo hi } ^~~ [ -c flag ]:1: Word has unbalanced { }. Maybe add a space or quote it like \{ OK test-parse-brace *** Running test-proc-sig ===== CASE: -n -c proc f[] { echo hi } ===== proc f[] { echo hi } ^~ [ -c flag ]:1: Invalid proc name 'f[' ===== CASE: -n -c proc : { echo hi } ===== proc : { echo hi } ^ [ -c flag ]:1: Invalid proc name ':' ===== CASE: -n -c proc foo::bar { echo hi } ===== proc foo::bar { echo hi } ^~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DColon) OK test-proc-sig *** Running test-regex-literals ===== CASE: -n -c var x = / ! / ===== var x = / ! / ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Slash) ===== CASE: -n -c var x = / ![a-z] / ===== (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.RegexLiteral left: regex: (re.CharClassLiteral negated: T terms: [(class_literal_term.Range start: end:)] ) flags: [] ) ) ===== CASE: -n -c var x = / !d / ===== (command.VarDecl keyword: lhs: [(NameType name:)] rhs: (expr.RegexLiteral left: regex: (PerlClass negated: name:d) flags: [] ) ) ===== CASE: -n -c var x = / !! / ===== var x = / !! / ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Slash) ===== CASE: -n -c var x = /[a-zA-Z]/ ===== var x = /[a-zA-Z]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Minus) ===== CASE: -n -c var x = /[a-z0-9]/ ===== var x = /[a-z0-9]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Minus) ===== CASE: -n -c var x = /[a-zz]/ ===== var x = /[a-zz]/ ^~ [ -c flag ]:1: Range start/end shouldn't have more than one character ===== CASE: -n -c var x = /['ab'-'z']/ ===== var x = /['ab'-'z']/ ^ [ -c flag ]:1: Range start/end shouldn't have more than one character ===== CASE: -n -c var x = /[$a-${z}]/ ===== var x = /[$a-${z}]/ ^~ [ -c flag ]:1: Syntax error in expression (near Id.VSub_DollarName) ===== CASE: -n -c var x = /[abc]/ ===== var x = /[abc]/ ^~~ [ -c flag ]:1: 'abc' isn't a character class ===== CASE: -n -c var x = /[% _]/ ===== var x = /[% _]/ ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Percent) OK test-regex-literals *** Running test-return-args ===== CASE: -n -c func foo(x) { return (x) } ===== (command.Func keyword: name: pos_params: [(Param blame_tok: name:x)] named_params: [] body: (BraceGroup left: children: [ (command.Retval keyword: val: (expr.Var name:) ) ] redirects: [] right: ) ) ===== CASE: -n -c func foo(x) { return () } ===== } ^ [ -c flag ]:4: Unexpected word while parsing compound command ===== CASE: -n -c func foo(x) { return (named=x) } ===== return (named=x) ^ [ -c flag ]:3: Typed return expects one argument ===== CASE: -n -c func foo(x) { return (x, named=x) } ===== return (x, named=x) ^ [ -c flag ]:3: Typed return doesn't take named arguments ===== CASE: -n -c func foo(x) { return (x, x) } ===== return (x, x) ^ [ -c flag ]:3: Typed return expects one argument OK test-return-args *** Running test-sh-assign ===== CASE: -n -c x=y ===== (command.ShAssignment left: children: [ (command.Sentence child: (command.ShAssignment left: ) ) ===== CASE: -n -c func f() { x=y; } ===== func f() { x=y; } ^~ [ -c flag ]:1: Use var/setvar to assign in YSH ===== CASE: -n -c proc p { x=y; } ===== proc p { x=y; } ^~ [ -c flag ]:1: Use var/setvar to assign in YSH ===== CASE: -n -c { x=y; } ===== (BraceGroup left: children: [ (command.Sentence child: (command.ShAssignment left: ) ===== CASE: -n -c ( x=y; ) ===== (command.Subshell left: child: (command.Sentence child: (command.ShAssignment left: more_env: [] words: [ {} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var name:) args: (ArgList left: pos_args: [(expr.Var name:)] named_args: [] right: ) ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo $join(x) ===== echo $join(x) ^ [ -c flag ]:1: Space required before ( ===== CASE: -n -c echo @[split(x)] ===== (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var name:) args: (ArgList left: pos_args: [(expr.Var name:)] named_args: [] right: ) ) right: ) } ] redirects: [] do_fork: T ) ===== CASE: -n -c echo @[split(x)] two ===== (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var name:) args: (ArgList left: pos_args: [(expr.Var name:)] named_args: [] right: ) ) right: ) } {} ] redirects: [] do_fork: T ) ===== CASE: -n -c echo @[split(x)]extra ===== echo @[split(x)]extra ^~~~~ [ -c flag ]:1: Unexpected token after expr splice OK test-ysh-expr-more *** Running test-ysh-nested-proc ===== CASE: -n -c proc p { echo 1; proc f { echo f }; echo 2 } ===== proc p { echo 1; proc f { echo f }; echo 2 } ^~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: -n -c proc p { echo 1; +weird() { echo f; }; echo 2 } ===== proc p { echo 1; +weird() { echo f; }; echo 2 } ^ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: -n -c proc p { echo 1; function f { echo f; }; echo 2 } ===== proc p { echo 1; function f { echo f; }; echo 2 } ^~~~~~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: -n -c f() { echo 1; proc inner { echo inner; }; echo 2; } ===== f() { echo 1; proc inner { echo inner; }; echo 2; } ^~~~ [ -c flag ]:1: procs and shell functions can't be nested ===== CASE: -n -c f() { echo 1; g() { echo g; }; echo 2; } ===== (command.ShFunction name_tok: name: f body: (BraceGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {<1>}] redirects: [] do_fork: T ) terminator: ) (command.Sentence child: (command.ShFunction name_tok: name: g body: (BraceGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) terminator: ) ] redirects: [] right: ) ) terminator: ) (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {<2>}] redirects: [] do_fork: T ) terminator: ) ] redirects: [] right: ) ) ===== CASE: -n -c proc p() { shopt --unset errexit { false hi } } ===== (command.Proc keyword: name:

sig: (proc_sig.Closed word_params:[] pos_params:[] named_params:[]) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {<--unset>} {}] redirects: [] block: (BlockArg brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] redirects: [] do_fork: T ) ] redirects: [] right: ) lines: [ (SourceLine line_num: 1 content: 'proc p() { shopt --unset errexit { false hi } }' src: (source__CFlag) ) ] ) do_fork: T ) ] redirects: [] right: ) ) OK test-ysh-nested-proc *** Running test-ysh-var ===== CASE: -n -c var x = 1 + ===== var x = 1 + ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: -n -c var x = * ===== var x = * ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Star) ===== CASE: -n -c var x = @($(cat <