ninja: no work to do. *** Running test-arglist ===== CASE: -n -c json write () ===== json write () ^ [ -c flag ]:1: Empty arg list not allowed ===== CASE: -n -c json write (42, indent=1) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[(NamedArg name: value:(Const Expr_DecInt _))] right: ) is_last_cmd:F ) ===== CASE: -n -c json write (42; indent=2) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[(NamedArg name: value:(Const Expr_DecInt _))] right: ) is_last_cmd:F ) ===== CASE: -n -c = toJson(42, indent=1) ===== (ExprCommand keyword: pos_args:[(Const Expr_DecInt _)] named_args:[ (NamedArg name: value:(Const Expr_DecInt _)) ] right: ) ) ) ===== CASE: -n -c = toJson(42; indent=2) ===== (ExprCommand keyword: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[ (NamedArg name: value:(Const Expr_DecInt _)) ] right: ) ) ) ===== CASE: -n -c p (; n=true) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[] semi_tok: named_args:[(NamedArg name: value:(Const Expr_True _))] right: ) is_last_cmd:F ) ===== CASE: -n -c = f(; n=true) ===== (ExprCommand keyword: pos_args:[] semi_tok: named_args:[(NamedArg name: value:(Const Expr_True _))] right: ) ) ) ===== CASE: -n -c p (;) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[] semi_tok: named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c = f(;) ===== (ExprCommand keyword: pos_args:[] semi_tok: named_args:[] right: ) ) ) ===== CASE: -n -c p (42;) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c = f(42;) ===== (ExprCommand keyword: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[] right: ) ) ) ===== CASE: -n -c = f(42; n=true; block) ===== = f(42; n=true; block) ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_Semi) ===== CASE: -n -c = f(42; ; block) ===== = f(42; ; block) ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_Semi) ===== CASE: -n -c p (42; n=true; block) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[(NamedArg name: value:(Const Expr_True _))] semi_tok2: block_expr:(Var block) right: ) is_last_cmd:F ) ===== CASE: -n -c p (42; ; block) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] semi_tok: named_args:[] semi_tok2: block_expr:(Var block) right: ) is_last_cmd:F ) ===== CASE: -n -c p (42; n=42; bad=3) ===== p (42; n=42; bad=3) ^~~ [ -c flag ]:1: Invalid block expression argument ===== CASE: -n -c p (42; n=42; ...bad) ===== p (42; n=42; ...bad) ^~~ [ -c flag ]:1: Invalid block expression argument ===== CASE: -n -c = f(; 42) ===== = f(; 42) ^~ [ -c flag ]:1: Positional arg can't appear in group of named args ===== CASE: -n -c = f(; name) ===== = f(; name) ^~~~ [ -c flag ]:1: Positional arg can't appear in group of named args ===== CASE: -n -c = f(; x for x in y) ===== = f(; x for x in y) ^ [ -c flag ]:1: Positional arg can't appear in group of named args OK test-arglist *** Running test-assert-left-brackets ===== CASE: -c var x = [42]; assert [ [42] === x] ===== OK test-assert-left-brackets *** 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 (Id.Word_Compound) OK test-blocks *** Running test-bug-1118 ===== CASE: -n -c var snippets = [{status: 42}] for snippet in (snippets) { if (snippet["status"] === 0) { echo hi } # The $ causes a weird error if ($snippet["status"] === 0) { echo hi } } ===== if ($snippet["status"] === 0) { ^~~~~~~~ [ -c flag ]:9: In expressions, remove $ and use `snippet`, or sometimes "$snippet" ===== CASE: -n -c var content = [ 1, 2, 4 ] var count = 0 # The $ causes a weird error while (count < $len(content)) { setvar count += 1 } ===== while (count < $len(content)) { ^~~~ [ -c flag ]:6: In expressions, remove $ and use `len`, or sometimes "$len" OK test-bug-1118 *** Running test-bug-1826 ===== CASE: -n -c echo b'\xff' ===== echo b'\xff' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c var s = b'\xff' ===== var s = b'\xff' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) [echo b'\] ===== CASE: -n -c echo b'\ ===== echo b'\ ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) [var s = b'\] ===== CASE: -n -c var s = b'\ ===== var s = b'\ ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) [var s = $'\] ===== CASE: -n -c var s = $'\ ===== var s = $'\ ^~ [ -c flag ]:1: Instead of $'', use J8 strings like b'' (no_parse_osh) OK test-bug-1826 *** Running test-bug-1850 ===== CASE: -n -c pp test_ (42); pp line (43) ===== (command.CommandList children:[ (command.Sentence child:(command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) terminator: ) (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) ] ) ===== CASE: -n -c pp test_ (42) extra ===== pp test_ (42) extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c pp test_ (42), echo ===== pp test_ (42), echo ^ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c pp test_ @(echo), echo ===== pp test_ @(echo), echo ^ [ -c flag ]:1: Unexpected token after @() ===== CASE: -n -c pp test_ (42) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c pp test_ (42) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c pp test_ (42); ===== (command.Sentence child:(command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) terminator: ) ===== CASE: -n -c pp test_ (42) { echo hi } ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) block:(LiteralBlock brace_group:(BraceGroup left: children:[(C (w ) (w ))] right: ) code_str:" echo hi " ) is_last_cmd:F ) ===== CASE: -n -c pp test_ (42), pp line (43) ===== pp test_ (42), pp line (43) ^ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) OK test-bug-1850 *** Running test-bug-1850-more ===== CASE: -n -c assert (42)extra ===== assert (42)extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c assert (42) extra ===== assert (42) extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c assert [42]extra ===== assert [42]extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c assert [42] extra ===== assert [42] extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) OK test-bug-1850-more *** Running test-bug_1825_backslashes ===== CASE: -n -c echo $'trailing\ ' ===== (C (w ) (w (SingleQuoted left: sval:"trailing\\\n" right: ) ) ) OK test-bug_1825_backslashes *** Running test-command-simple-more ===== CASE: -n -c foo=1 ===== (command.ShAssignment left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c foo=1 cmd >out (42) ===== (command.Simple blame_tok: more_env:[(EnvPair left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F redirects:[ (Redir op:"> loc:(redir_loc.Fd fd:1) arg:(w )) ] ) OK test-command-simple-more *** Running test-destructure ===== CASE: -n -c func f() { const x, y = 3, 4 #setvar x = 5 setvar y = 6 } ===== const x, y = 3, 4 ^~~~~ [ -c flag ]:3: const can't be inside proc or func. Use var instead. ===== CASE: -n -c func f() { var x, y = 3, 4 var y = 6 } ===== var y = 6 ^ [ -c flag ]:5: 'y' was already declared ===== CASE: -n -c func f() { var x, y = 3, 4 const y = 6 } ===== const y = 6 ^~~~~ [ -c flag ]:5: const can't be inside proc or func. Use var instead. OK test-destructure *** Running test-eggex ===== CASE: -n -c = /%start dot %end \n \u{ff}/ ===== (ExprCommand keyword: id:Eggex_Start) (re.Primitive blame_tok: id:Eggex_Dot) (re.Primitive blame_tok: id:Eggex_End) (re.LiteralChars blame_tok: s:"\n") (re.LiteralChars blame_tok: s:"ΓΏ") ] ) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c = /%star dot %end \n/ ===== = /%star dot %end \n/ ^~~~~ [ -c flag ]:1: Unexpected token '%star' in regex ===== CASE: -n -c = /%start do %end \n/ ===== = /%start do %end \n/ ^~ [ -c flag ]:1: 'do' isn't a character class ===== CASE: -n -c = /%start dot %end \z/ ===== = /%start dot %end \z/ ^ [ -c flag ]:1: Unexpected token in expression mode ===== CASE: -n -c = /%start dot %end \n \u{}/ ===== = /%start dot %end \n \u{}/ ^ [ -c flag ]:1: Unexpected token in expression mode ===== CASE: -n -c = /['a'-'z']/ ===== (ExprCommand keyword: i:97 u_braced:F) end:(CharCode blame_tok: i:122 u_braced:F) ) ] ) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c = /['a'-'']/ ===== = /['a'-'']/ ^ [ -c flag ]:1: Quoted range char can't be empty ===== CASE: -n -c = /['a'-'zz']/ ===== = /['a'-'zz']/ ^ [ -c flag ]:1: Range start/end shouldn't have more than one character ===== CASE: -n -c = /dot{N *} / ===== = /dot{N *} / ^ [ -c flag ]:1: Perl-style repetition isn't implemented with libc ===== CASE: -n -c = /dot{zzz *} / ===== = /dot{zzz *} / ^~~ [ -c flag ]:1: Perl-style repetition isn't implemented with libc ===== CASE: -n -c = /dot{*} / ===== = /dot{*} / ^ [ -c flag ]:1: Perl-style repetition isn't implemented with libc OK test-eggex *** Running test-eggex-capture ===== CASE: -n -c = / d+ / ===== (ExprCommand keyword:) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c = / < capture d+ as date > / ===== (ExprCommand keyword:) name: ) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c = / < capture d+ as date: Int > / ===== (ExprCommand keyword:) name: func_name: ) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c var capture = 42 ===== var capture = 42 ^~~~~~~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_Capture) ===== CASE: -n -c var as = 42 ===== var as = 42 ^~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_As) OK test-eggex-capture *** Running test-eggex-flags ===== CASE: -n -c = / d+ ; reg_icase / ===== (ExprCommand keyword:) flags:[(EggexFlag negated:F flag:)] canonical_flags:i ) ) ===== CASE: -n -c = / d+ ; i / ===== (ExprCommand keyword:) flags:[(EggexFlag negated:F flag:)] canonical_flags:i ) ) ===== CASE: -n -c = / d+ ; !i / ===== = / d+ ; !i / ^ [ -c flag ]:1: Flag can't be negated ===== CASE: -n -c = / d+ ; reg_oops / ===== = / d+ ; reg_oops / ^~~~~~~~ [ -c flag ]:1: Invalid regex flag 'reg_oops' ===== CASE: -n -c = / d+ ; !i; PCRE / ===== (ExprCommand keyword:) flags:[(EggexFlag negated:T flag:)] trans_pref: ) ) ===== CASE: -n -c = / d+ ; reg_oops; PCRE / ===== (ExprCommand keyword:) flags:[(EggexFlag negated:F flag:)] trans_pref: ) ) ===== CASE: -n -c = / d+ ; i reg_newline ; ERE / ===== (ExprCommand keyword:) flags:[ (EggexFlag negated:F flag:) (EggexFlag negated:F flag:) ] trans_pref: canonical_flags:in ) ) ===== CASE: -n -c = / d+ ; ; ERE / ===== (ExprCommand keyword:) flags:[] trans_pref: canonical_flags:"" ) ) ===== CASE: -n -c = / d+ ; / ===== (ExprCommand keyword:) flags:[] canonical_flags:"" ) ) ===== CASE: -n -c = / d+ ; ; / ===== = / d+ ; ; / ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Slash) ===== CASE: -n -c = / d+ ; ; ; / ===== = / d+ ; ; ; / ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_Semi) OK test-eggex-flags *** Running test-expr-range ===== CASE: -n -c = 1..5 ===== = 1..5 ^~ [ -c flag ]:1: Use ..< for half-open range, or ..= for closed range (OILS-ERR-16) ===== CASE: -n -c = 1..<5 ===== (ExprCommand keyword: upper:(Const Expr_DecInt _) ) ) ===== CASE: -n -c = 1..=5 ===== (ExprCommand keyword:"> attr: attr_name:trim ctx:expr_context.Store ) args:(ArgList left: pos_args:[] named_args:[] right: ) ) ) ===== CASE: -n -c func f(x Int) => List[Int] { echo hi } ===== (Func keyword: name: positional:(ParamGroup params:[ (Param blame_tok: name:x type:(TypeExpr tok: name:Int) ) ] ) body:(BraceGroup left: children:[(C (w ) (w ))] right: ) ) OK test-fat-arrow *** Running test-float-literals ===== CASE: -n -c = 42.0 ===== (ExprCommand keyword: e:(Const Expr_Float _)) ===== CASE: -n -c = 42_.0 ===== = 42_.0 ^ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DecInt) ===== CASE: -n -c = 42. ===== = 42. ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: -n -c = .333 ===== = .333 ^ [ -c flag ]:1: Syntax error in expression (near Id.Expr_Dot) ===== CASE: -n -c = _42.0 ===== = _42.0 ^ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DecInt) OK test-float-literals *** Running test-for ===== CASE: -n -c for x in <> { echo $x } ===== for x in <> { ^~ [ -c flag ]:2: Reserved syntax ===== CASE: -n -c for x in <> { echo $x } ===== for x in <> ^~ [ -c flag ]:2: Reserved syntax ===== CASE: -n -c for x in < { echo $x } ===== for x in < { ^ [ -c flag ]:2: Reserved syntax ===== CASE: -n -c for x in < > { echo $x } ===== for x in < > { ^ [ -c flag ]:2: Reserved syntax OK test-for *** Running test-for-parse-bare-word ===== CASE: -n -c for x in bare { echo $x } ===== for x in bare { ^~~~ [ -c flag ]:2: Surround this word with either parens or quotes (no_parse_bare_word) ===== CASE: -n -c for x in a b { echo $x } ===== (command.ForEach keyword: iter_names:[x] iterable:(for_iter.Words words:[(w ) (w )]) body:(BraceGroup left: children:[(C (w ) (w ($ x)))] right: ) ) ===== CASE: -n -c for x in *.py { echo $x } ===== (command.ForEach keyword: iter_names:[x] iterable:(for_iter.Words words:[(w )]) body:(BraceGroup left: children:[(C (w ) (w ($ x)))] right: ) ) ===== CASE: -n -c for x in "quoted" { echo $x } ===== (command.ForEach keyword: iter_names:[x] iterable:(for_iter.Words words:[(w (DQ ))]) body:(BraceGroup left: children:[(C (w ) (w ($ x)))] right: ) ) OK test-for-parse-bare-word *** Running test-func-def ===== CASE: -n -c func f(p) { var p = foo } ===== func f(p) { var p = foo } ^ [ -c flag ]:1: 'p' was already declared ===== CASE: -n -c func f(p; n) { var n = foo } ===== func f(p; n) { var n = foo } ^ [ -c flag ]:1: 'n' was already declared OK test-func-def *** 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 } ===== (Func keyword: name: body:(BraceGroup left: children:[(C (w ) (w ))] right: ) ) ===== CASE: -n -c func f (a List[Int] = [3,4]) { echo hi } ===== (Func keyword: name: positional:(ParamGroup params:[ (Param blame_tok: name:a type:(TypeExpr tok: name:List params:[(TypeExpr tok: name:Int)] ) default_val:(expr.List left: elts:[(Const Expr_DecInt _) (Const Expr_DecInt _)] ctx:expr_context.Store ) ) ] ) body:(BraceGroup left: children:[(C (w ) (w ))] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c) { echo hi } ===== (Func keyword: name: positional:(ParamGroup params:[ (Param blame_tok: name:a) (Param blame_tok: name:b) ] rest_of:(RestParam blame_tok: name:rest) ) named:(ParamGroup params:[(Param blame_tok: name:c)]) body:(BraceGroup left: children:[(C (w ) (w ))] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c, ...named) { echo hi } ===== (Func keyword: name: positional:(ParamGroup params:[ (Param blame_tok: name:a) (Param blame_tok: name:b) ] rest_of:(RestParam blame_tok: name:rest) ) named:(ParamGroup params:[(Param blame_tok: name:c)] rest_of:(RestParam blame_tok: name:named) ) body:(BraceGroup left: children:[(C (w ) (w ))] right: ) ) ===== CASE: -n -c func f (a, b, ...rest; c, ...named;) { echo hi } ===== func f (a, b, ...rest; c, ...named;) { 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 } ===== (Func keyword: name: positional:(ParamGroup params:[(Param blame_tok: name:x)]) body:(BraceGroup left: children:[ (Mutation keyword: lhs:[] op: ) ) ===== CASE: -n -c func f() { setvar x = true } ===== setvar x = true ^ [ -c flag ]:3: setvar couldn't find matching 'var x' (OILS-ERR-10) 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:[(w )] block:(LiteralBlock brace_group:(BraceGroup left: children:[ (VarDecl lhs:[(NameType left: name:x)] rhs:(Const Expr_DecInt _) ) ] right: ) code_str:" \n x = 42\n" ) is_last_cmd:F ) ===== CASE: -n -c Rule X Y { x = 42 } ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w ) (w )] block:(LiteralBlock brace_group:(BraceGroup left: children:[ (VarDecl lhs:[(NameType left: name:x)] rhs:(Const Expr_DecInt _) ) ] right: ) code_str:" \n x = 42\n" ) is_last_cmd:F ) ===== CASE: -n -c RULe { # inconsistent but OK x = 42 } ===== (command.Simple blame_tok: more_env:[] words:[(w )] block:(LiteralBlock brace_group:(BraceGroup left: children:[ (VarDecl lhs:[(NameType left: name:x)] rhs:(Const Expr_DecInt _) ) ] right: ) code_str:" # inconsistent but OK\n x = 42\n" ) is_last_cmd:F ) ===== 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:[ (C (w ) (w ) (w ) ) (command.Simple blame_tok: more_env:[] words:[(w ) (w )] block:(LiteralBlock brace_group:(BraceGroup left: children:[ (command.Simple blame_tok: more_env:[] words:[(w ) (w )] block:(LiteralBlock brace_group:(BraceGroup left: children:[ (command.ShAssignment left: children:[ (VarDecl lhs:[(NameType left: name:name)] rhs:(DQ ) ) ] right: ) code_str:" \n name = \"z\"\n " ) is_last_cmd:F ) ] right: ) code_str:" \n sudo=1\n User {\n name = \"z\"\n }\n " ) is_last_cmd:F ) ] right: ) code_str:" \n SHELL bob {\n sudo=1\n User {\n name = \"z\"\n }\n }\n" ) is_last_cmd:F ) ] ) ===== 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-int-literals ===== CASE: -n -c = 42 ===== (ExprCommand keyword: e:(Const Expr_DecInt _)) ===== CASE: -n -c = 42_ ===== = 42_ ^ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = 42_0_ ===== = 42_0_ ^ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = _42 ===== (ExprCommand keyword: child:(expr.FuncCall func:(Var sorted) args:(ArgList left: pos_args:[(Var x)] named_args:[] right: ) ) right: ) ) ) ===== CASE: -n -c f() { write -- @[sorted(x)] } ===== write -- @[sorted(x)] ^ [ -c flag ]:3: Unexpected left paren (might need a space before it) ===== CASE: -n -c f() { write -- @[sorted(x)] } ===== (ShFunction name_tok: name:f body:(BraceGroup left: children:[ (C (w ) (w ) (w (ExprSub left: child:(expr.FuncCall func:(Var sorted) args:(ArgList left: pos_args:[(Var x)] named_args:[] right: ) ) right: ) ) ) ] right: ) code_str:"f() {\n write -- @[sorted(x)]\n}" ) ===== CASE: -n -c f() { write -- @sorted (( z )) } ===== write -- @sorted (( z )) ^~ [ -c flag ]:3: Invalid word while parsing command list OK test-invalid_parens *** Running test-lazy-arg-list ===== CASE: -n -c assert [42 === x] ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[ (expr.Compare left:(Const Expr_DecInt _) ops:[] comparators:[(Var x)] ) ] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c assert [ 42 === x ] ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[ (expr.Compare left:(Const Expr_DecInt _) ops:[] comparators:[(Var x)] ) ] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c assert [42, 43] ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _) (Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c assert [42, named=true] ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[(NamedArg name: value:(Const Expr_True _))] right: ) is_last_cmd:F ) ===== CASE: -n -c assert [42, named=true]; echo hi ===== (command.CommandList children:[ (command.Sentence child:(command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[ (NamedArg name: value:(Const Expr_True _)) ] right: ) is_last_cmd:F ) terminator: ) (C (w ) (w )) ] ) ===== CASE: -n -c assert [42, named=true] { echo hi } ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[(NamedArg name: value:(Const Expr_True _))] right: ) block:(LiteralBlock brace_group:(BraceGroup left: children:[(C (w ) (w ))] right: ) code_str:" echo hi " ) is_last_cmd:F ) ===== CASE: -n -c assert [42, named=true]{ echo hi } ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[(NamedArg name: value:(Const Expr_True _))] right: ) block:(LiteralBlock brace_group:(BraceGroup left: children:[(C (w ) (w ))] right: ) code_str:" echo hi " ) is_last_cmd:F ) ===== CASE: -n -c assert *.[ch] ===== (C (w ) (w ) ) ===== CASE: -n -c assert 42[ch] ===== (C (w ) (w ) ) ===== CASE: -n -c echo[] ===== (C (w )) ===== CASE: -n -c assert [4 ===== assert [4 ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: -n -c assert [ 4 ===== assert [ 4 ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_Real) ===== CASE: -n -c json write (42) >out ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F redirects:[ (Redir op:"> loc:(redir_loc.Fd fd:1) arg:(w )) ] ) ===== CASE: -n -c json write >out (42) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Const Expr_DecInt _)] named_args:[] right: ) is_last_cmd:F redirects:[ (Redir op:"> loc:(redir_loc.Fd fd:1) arg:(w )) ] ) ===== CASE: -n -c [ x = y ] ===== (C (w ) (w ) (w ) ) OK test-lazy-arg-list *** Running test-lhs-expr ===== CASE: -n -c setvar x.y[z] = 42 ===== (Mutation keyword: lhs:[ (Subscript left: obj:(Attribute obj:(Var x) op: attr: attr_name:y ctx:expr_context.Store ) index:(Var z) ) ] op: obj:(Subscript left: obj:(Var a) index:(Var i)) index:(Var j) ) ] op: obj:(Var a) index:(Var i)) (Attribute obj:(Var d) op: attr: attr_name:key ctx:expr_context.Store ) ] op:y = 42 ===== setvar x->y = 42 ^~ [ -c flag ]:1: Can't assign to this attribute expr ===== CASE: -n -c setglobal a[{k:3}["k"]] = 42 ===== (Mutation keyword: lhs:[ (Subscript left: obj:(Var a) index:(Subscript left: obj:(expr.Dict left: keys:[(Const Expr_Name _)] values:[(Const Expr_DecInt _)] ) index:(DQ ) ) ) ] op: lhs:[(NameType left: name:x)] rhs:(SingleQuoted left: sval:" \\n " right: ) ) ===== CASE: -n -c var x = u''' \n ''' ===== (VarDecl keyword: lhs:[(NameType left: name:x)] rhs:(SingleQuoted left: sval:"\n" right: ) ) OK test-multiline-backslashes *** Running test-multiline-string ===== CASE: -n -c echo u''' hi ''' ===== (C (w ) (w (SingleQuoted left: sval:"hi\n" right: ) ) ) ===== CASE: -n -c echo b''' hi ''' ===== (C (w ) (w (SingleQuoted left: sval:"hi\n" right: ) ) ) ===== CASE: -n -c echo b''' hi '' ===== echo b''' ^ [ -c flag ]:1: Unexpected EOF in single-quoted string that began here ===== CASE: -n -c echo r''' hi '''bad ===== '''bad ^~~ [ -c flag ]:3: Unexpected token after YSH single-quoted string ===== CASE: -n -c echo u''' hi '''bad ===== '''bad ^~~ [ -c flag ]:3: Unexpected token after YSH single-quoted string ===== CASE: -n -c echo """ hi """bad ===== """bad ^~~ [ -c flag ]:3: Unexpected parts after triple quoted string OK test-multiline-string *** Running test-no-const ===== CASE: -n -c const x = 42 ===== (VarDecl keyword: lhs:[(NameType left: name:x)] rhs:(Const Expr_DecInt _) ) ===== CASE: -n -c proc p { const x = 42 } ===== const x = 42 ^~~~~ [ -c flag ]:3: const can't be inside proc or func. Use var instead. ===== CASE: -n -c func f() { const x = 42 } ===== const x = 42 ^~~~~ [ -c flag ]:3: const can't be inside proc or func. Use var instead. OK test-no-const *** Running test-no-parse-dollar ===== CASE: -n -c echo $ ===== (C (w ) (w )) ===== CASE: -o no_parse_dollar -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo $: ===== (C (w ) (w )) ===== CASE: -o no_parse_dollar -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo "$" ===== (C (w ) (w (DQ ))) ===== CASE: -o no_parse_dollar -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$:" ===== (C (w ) (w (DQ ))) ===== CASE: -o no_parse_dollar -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ) ===== CASE: -o no_parse_dollar -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo ${x:-$:} ===== (C (w ) (w (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ) ===== CASE: -o no_parse_dollar -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo "${x:-$}" ===== (C (w ) (w (DQ (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ) ) ===== CASE: -o no_parse_dollar -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo "${x:-$:}" ===== (C (w ) (w (DQ (BracedVarSub left: name_tok: var_name:x suffix_op:(suffix_op.Unary op: arg_word:(w ) ) right: ) ) ) ) ===== CASE: -o no_parse_dollar -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) ===== CASE: -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ (no_parse_dollar) OK test-no-parse-dollar *** Running test-no-parse-osh ===== CASE: -n -c echo $'hi' ===== echo $'hi' ^~ [ -c flag ]:1: Instead of $'', use J8 strings like b'' (no_parse_osh) ===== CASE: -n -c var x = $'hi' ===== var x = $'hi' ^~ [ -c flag ]:1: Instead of $'', use J8 strings like b'' (no_parse_osh) ===== CASE: -n -c sleep 2 & ===== sleep 2 & ^ [ -c flag ]:1: Use the 'fork' builtin instead of & ===== CASE: -n -c sleep 2 & wait ===== sleep 2 & wait ^ [ -c flag ]:1: Use the 'fork' builtin instead of & ===== CASE: -n -c { sleep 2 & } ===== { sleep 2 & } ^ [ -c flag ]:1: Use the 'fork' builtin instead of & ===== CASE: -n -c ( cd /tmp && ls ) ===== ( cd /tmp && ls ) ^ [ -c flag ]:1: Subshell syntax ( ) isn't allowed in YSH (OILS-ERR-19) ===== CASE: -n -c { ( cd /tmp && ls ) } ===== { ( cd /tmp && ls ) } ^ [ -c flag ]:1: Subshell syntax ( ) isn't allowed in YSH (OILS-ERR-19) OK test-no-parse-osh *** 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-backslash ===== CASE: -n -c echo \( ===== (C (w ) (w (word_part.EscapedLiteral token: ch:"(")) ) ===== CASE: -n -c echo \; ===== (C (w ) (w (word_part.EscapedLiteral token: ch:";")) ) ===== CASE: -n -c echo ~ ===== (C (w ) (w (word_part.TildeSub left:))) ===== CASE: -n -c echo \! ===== (C (w ) (w (word_part.EscapedLiteral token: ch:"!")) ) ===== CASE: -n -c echo \% ===== (C (w ) (w (word_part.EscapedLiteral token: ch:"%")) ) ===== CASE: -n -c echo \# ===== (C (w ) (w (word_part.EscapedLiteral token: ch:"#")) ) ===== CASE: -n -c echo \. ===== echo \. ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \- ===== echo \- ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \/ ===== echo \/ ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \a ===== echo \a ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \Z ===== echo \Z ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \0 ===== echo \0 ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \9 ===== echo \9 ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) ===== CASE: -n -c echo \. \- \/ \a \Z \0 \9 ===== (C (w ) (w (word_part.EscapedLiteral token: ch:.)) (w (word_part.EscapedLiteral token: ch:-)) (w (word_part.EscapedLiteral token: ch:/)) (w (word_part.EscapedLiteral token: ch:a)) (w (word_part.EscapedLiteral token: ch:Z)) (w (word_part.EscapedLiteral token: ch:0)) (w (word_part.EscapedLiteral token: ch:9)) ) OK test-parse-backslash *** 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-parse-dparen ===== CASE: -n -c ((1 > 0 && 43 > 42)) ===== (command.DParen left: child:(arith_expr.Binary op: left:(arith_expr.Binary op:"> left:(w ) right:(w ) ) right:(arith_expr.Binary op:"> left:(w ) right:(w ) ) ) right: ) ===== CASE: -n -c ((1 > 0 && 43 > 42)) ===== ((1 > 0 && 43 > 42)) ^~ [ -c flag ]:1: Bash (( not allowed in YSH (no_parse_dparen, see OILS-ERR-14 for wart) ===== CASE: -n -c if ((1 > 0 && 43 > 42)); then echo yes; fi ===== (command.If if_kw: arms:[ (IfArm keyword:...0x1246 cond:[ (command.Sentence child:(command.DParen left: child:(arith_expr.Binary op: left:(arith_expr.Binary op:"> left:(w ) right:(w ) ) right:(arith_expr.Binary op:"> left:(w ) right:(w ) ) ) right: ) terminator: ) ] then_kw: action:[ (command.Sentence child:(C (w ) (w )) terminator: ) ] then_tok:...0x11be ) ] else_action:[] fi_kw: ) ===== CASE: -n -c if ((1 > 0 && 43 > 42)); then echo yes; fi ===== if ((1 > 0 && 43 > 42)); then echo yes; fi ^~ [ -c flag ]:1: Bash (( not allowed in YSH (no_parse_dparen, see OILS-ERR-14 for wart) ===== CASE: -n -c for ((x = 1; x < 5; ++x)); do echo $x; done ===== (command.ForExpr keyword: init:(arith_expr.BinaryAssign op_id:Arith_Equal left: right:(w ) ) cond:(arith_expr.Binary op: left: right:(w ) ) update:(arith_expr.UnaryAssign op_id:Arith_DPlus child:) body:(command.DoGroup left: children:[ (command.Sentence child:(C (w ) (w ($ x))) terminator: ) ] right: ) ) ===== CASE: -n -c for ((x = 1; x < 5; ++x)); do echo $x; done ===== for ((x = 1; x < 5; ++x)); do echo $x; done ^~ [ -c flag ]:1: Bash for loops aren't allowed (no_parse_dparen) ===== CASE: -n -c if (1 > 0 and 43 > 42) { echo yes } ===== (command.If if_kw: arms:[ (IfArm keyword:...0x7f001b188c20 cond:(condition.YshExpr e:(expr.Binary op: left:(expr.Compare left:(Const Expr_DecInt _) ops:[">] comparators:[(Const Expr_DecInt _)] ) right:(expr.Compare left:(Const Expr_DecInt _) ops:[">] comparators:[(Const Expr_DecInt _)] ) ) ) action:[(C (w ) (w ))] ) ] else_action:[] ) ===== CASE: -n -c if ( (1 > 0 and 43 > 42) ) { echo yes } ===== (command.If if_kw: arms:[ (IfArm keyword:...0x7fe394968c20 cond:(condition.YshExpr e:(expr.Binary op: left:(expr.Compare left:(Const Expr_DecInt _) ops:[">] comparators:[(Const Expr_DecInt _)] ) right:(expr.Compare left:(Const Expr_DecInt _) ops:[">] comparators:[(Const Expr_DecInt _)] ) ) ) action:[(C (w ) (w ))] ) ] else_action:[] ) OK test-parse-dparen *** Running test-place-expr ===== CASE: -n -c read (&x) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[(expr.Place blame_tok: var_name:x ops:[])] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c read (&x[0]) ===== read (&x[0]) ^ [ -c flag ]:1: Places in containers not implemented yet ===== CASE: -n -c read (&x[0][1]) ===== read (&x[0][1]) ^ [ -c flag ]:1: Places in containers not implemented yet ===== CASE: -n -c read (&x.key.other) ===== read (&x.key.other) ^ [ -c flag ]:1: Places in containers not implemented yet ===== CASE: -n -c read (&x + 1) ===== (command.Simple blame_tok: more_env:[] words:[(w )] typed_args:(ArgList left: pos_args:[ (expr.Binary op: left:(expr.Place blame_tok: var_name:x ops:[]) right:(Const Expr_DecInt _) ) ] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c read (&42) ===== read (&42) ^~ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DecInt) ===== CASE: -n -c read (&+) ===== read (&+) ^ [ -c flag ]:1: Syntax error in expression (near Id.Arith_Plus) ===== CASE: -n -c read (&(x)) ===== read (&(x)) ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_LParen) OK test-place-expr *** Running test-proc-args ===== CASE: -n -c json write (x) ===== (command.Simple blame_tok: more_env:[] words:[(w ) (w )] typed_args:(ArgList left: pos_args:[(Var x)] named_args:[] right: ) is_last_cmd:F ) ===== CASE: -n -c echo $(json write (x)) ===== echo $(json write (x)) ^ [ -c flag ]:1: Invalid word while parsing command list test/ysh-parse-errors.sh: fatal: Should parse with _bin/cxx-asan/osh: expected status 0, got 2 FAIL test-proc-args