*** 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: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Int i:1)) ) ] right: ) do_fork: T ) ===== CASE: -n -c json write (42; indent=2) ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] semi_tok: named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Int i:2)) ) ] right: ) do_fork: T ) ===== CASE: -n -c = toJson(42, indent=1) ===== (command.Expr keyword: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Int i:1)) ) ] right: ) ) ) ===== CASE: -n -c = toJson(42; indent=2) ===== (command.Expr keyword: pos_args: [(expr.Const c: val:(value.Int i:42))] semi_tok: named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Int i:2)) ) ] right: ) ) ) ===== CASE: -n -c p (; n=true) ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [] semi_tok: named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) do_fork: T ) ===== CASE: -n -c = f(; n=true) ===== (command.Expr keyword: pos_args: [] semi_tok: named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) ) ) ===== CASE: -n -c p (;) ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [] semi_tok: named_args: [] right: ) do_fork: T ) ===== CASE: -n -c = f(;) ===== (command.Expr keyword: pos_args: [] semi_tok: named_args: [] right: ) ) ) ===== CASE: -n -c p (42;) ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] semi_tok: named_args: [] right: ) do_fork: T ) ===== CASE: -n -c = f(42;) ===== (command.Expr keyword: pos_args: [(expr.Const c: val:(value.Int i:42))] 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: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] semi_tok: named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] semi_tok2: block_expr: (expr.Var left: name:block) right: ) do_fork: T ) ===== CASE: -n -c p (42; ; block) ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] semi_tok: named_args: [] semi_tok2: block_expr: (expr.Var left: name:block) right: ) do_fork: T ) ===== 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-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: Invalid char escape in C-style string literal (OILS-ERR-11) OK test-bug-1826 *** Running test-bug-1850 ===== CASE: -n -c pp line (42); pp line (43) ===== (command.CommandList children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) terminator: ) (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:43))] named_args: [] right: ) do_fork: T ) ] ) ===== CASE: -n -c pp line (42) extra ===== pp line (42) extra ^~~~~ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c pp line (42), echo ===== pp line (42), echo ^ [ -c flag ]:1: Invalid word while parsing command line (Id.Word_Compound) ===== CASE: -n -c pp line @(echo), echo ===== pp line @(echo), echo ^ [ -c flag ]:1: Unexpected token after @() ===== CASE: -n -c pp line (42) ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c pp line (42) ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c pp line (42); ===== (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) terminator: ) ===== CASE: -n -c pp line (42) { echo hi } ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [(SourceLine line_num:1 content:"pp line (42) { echo hi }" src:(source__CFlag))] ) do_fork: T ) ===== CASE: -n -c pp line (42), pp line (43) ===== pp line (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\ ' ===== (command.Simple blame_tok: more_env: [] words: [ {} { (SingleQuoted left: sval: "trailing\\\n" right: ) } ] do_fork: T ) ===== CASE: -n -c echo $'trailing\\ ' ===== (command.Simple blame_tok: more_env: [] words: [ {} { (SingleQuoted left: sval: "trailing\\\n" right: ) } ] do_fork: T ) ===== CASE: -n -c echo $'trailing\ ' ===== echo $'trailing\ ^~ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c setvar x = $'trailing\ ' ===== setvar x = $'trailing\ ^~ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) OK test-bug_1825_backslashes *** Running test-command-simple-more ===== CASE: -n -c foo=1 ===== (command.ShAssignment left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c foo=1 cmd >out (42) ===== (command.Redirect child: (command.Simple blame_tok: more_env: [(EnvPair left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) redirects: [(Redir op:"> loc:(redir_loc.Fd fd:1) arg:{})] ) 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}/ ===== (command.Expr keyword: id:Id.Eggex_Start) (re.Primitive blame_tok: id:Id.Eggex_Dot) (re.Primitive blame_tok: id: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']/ ===== (command.Expr 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+ / ===== (command.Expr keyword: ) flags: [] canonical_flags: "" ) ) ===== CASE: -n -c = / < capture d+ as date > / ===== (command.Expr keyword: ) name: ) flags: [] canonical_flags: "" ) ) ===== CASE: -n -c = / < capture d+ as date: Int > / ===== (command.Expr 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 / ===== (command.Expr keyword: ) flags: [(EggexFlag negated:F flag:)] canonical_flags: i ) ) ===== CASE: -n -c = / d+ ; i / ===== (command.Expr 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 / ===== (command.Expr keyword: ) flags: [(EggexFlag negated:T flag:)] trans_pref: ) ) ===== CASE: -n -c = / d+ ; reg_oops; PCRE / ===== (command.Expr keyword: ) flags: [(EggexFlag negated:F flag:)] trans_pref: ) ) ===== CASE: -n -c = / d+ ; i reg_newline ; ERE / ===== (command.Expr keyword: ) flags: [ (EggexFlag negated:F flag:) (EggexFlag negated:F flag:) ] trans_pref: canonical_flags: in ) ) ===== CASE: -n -c = / d+ ; ; ERE / ===== (command.Expr keyword: ) flags: [] trans_pref: canonical_flags: "" ) ) ===== CASE: -n -c = / d+ ; / ===== (command.Expr 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-fat-arrow ===== CASE: -n -c var x = s => trim() ===== (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.FuncCall func: (Attribute obj: (expr.Var left: name:s) op: "> 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: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ) OK test-fat-arrow *** Running test-float-literals ===== CASE: -n -c = 42.0 ===== (command.Expr keyword: e: (expr.Const c: val:(value.Float f:420.0)) ) ===== 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 (parse_bare_word) ===== CASE: -n -c for x in a b { echo $x } ===== (command.ForEach keyword: iter_names: [x] iterable: (for_iter.Words words:[{} {}]) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] right: ) ) ===== CASE: -n -c for x in *.py { echo $x } ===== (command.ForEach keyword: iter_names: [x] iterable: (for_iter.Words words:[{ }]) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] right: ) ) ===== CASE: -n -c for x in "quoted" { echo $x } ===== (command.ForEach keyword: iter_names: [x] iterable: (for_iter.Words words:[{(DQ )}]) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] 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: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] 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: [ (expr.Const c: val:(value.Int i:3)) (expr.Const c: val:(value.Int i:4)) ] ctx: expr_context.Store ) ) ] ) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] 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: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] 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: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] 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: [ (command.Mutation keyword: lhs: [] op: val:(value.Bool b:T)) ) ] right: ) ) ===== 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: [{}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.VarDecl lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:42)) ) ] right: ) lines: [ (SourceLine line_num:2 content:"Rule {\n" src:(source__CFlag)) (SourceLine line_num:3 content:" x = 42\n" src:...0x7ff64a2da290) (SourceLine line_num:4 content:"}\n" src:...0x7ff64a2da290) ] ) do_fork: T ) ===== CASE: -n -c Rule X Y { x = 42 } ===== (command.Simple blame_tok: more_env: [] words: [{} {} {}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.VarDecl lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:42)) ) ] right: ) lines: [ (SourceLine line_num:2 content:"Rule X Y {\n" src:(source__CFlag)) (SourceLine line_num:3 content:" x = 42\n" src:...0x7fea090502d0) (SourceLine line_num:4 content:"}\n" src:...0x7fea090502d0) ] ) do_fork: T ) ===== CASE: -n -c RULe { # inconsistent but OK x = 42 } ===== (command.Simple blame_tok: more_env: [] words: [{}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.VarDecl lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:42)) ) ] right: ) lines: [ (SourceLine line_num:2 content:"RULe { # inconsistent but OK\n" src:(source__CFlag)) (SourceLine line_num:3 content:" x = 42\n" src:...0x7f8b9c111290) (SourceLine line_num:4 content:"}\n" src:...0x7f8b9c111290) ] ) 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: [ {} {} { } ] do_fork: T ) (command.Simple blame_tok: more_env: [] words: [{} {}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.ShAssignment left: children: [ (command.VarDecl lhs: [(NameType left: name:name)] rhs: (DQ ) ) ] right: ) lines: [ (SourceLine line_num: 7 content: " User {\n" src: (source__CFlag) ) (SourceLine line_num: 8 content: " name = \"z\"\n" src: ...0x7f26f7fc1290 ) (SourceLine line_num: 9 content: " }\n" src: ...0x7f26f7fc1290 ) ] ) do_fork: T ) ] right: ) lines: [] ) do_fork: T ) ] 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-int-literals ===== CASE: -n -c = 42 ===== (command.Expr keyword: e:(expr.Const c: val:(value.Int i:420))) ===== 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 ===== (command.Expr keyword: child: (expr.FuncCall func: (expr.Var left: name:sorted) args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) ) right: ) } ] do_fork: T ) ===== 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)] } ===== (command.ShFunction name_tok: name: f body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [ {} {} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var left: name:sorted) args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) ) right: ) } ] do_fork: T ) ] right: ) ) ===== 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: [{}] typed_args: (ArgList left: pos_args: [ (expr.Compare left: (expr.Const c: val:(value.Int i:42)) ops: [] comparators: [(expr.Var left: name:x)] ) ] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c assert [ 42 === x ] ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [ (expr.Compare left: (expr.Const c: val:(value.Int i:42)) ops: [] comparators: [(expr.Var left: name:x)] ) ] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c assert [42, 43] ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [ (expr.Const c: val:(value.Int i:42)) (expr.Const c: val:(value.Int i:43)) ] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c assert [42, named=true] ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) do_fork: T ) ===== CASE: -n -c assert [42, named=true]; echo hi ===== (command.CommandList children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) do_fork: T ) terminator: ) (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] ) ===== CASE: -n -c assert [42, named=true] { echo hi } ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [(SourceLine line_num:1 content:"assert [42, named=true] { echo hi }" src:(source__CFlag))] ) do_fork: T ) ===== CASE: -n -c assert [42, named=true]{ echo hi } ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [ (NamedArg name: value: (expr.Const c: val:(value.Bool b:T)) ) ] right: ) block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [(SourceLine line_num:1 content:"assert [42, named=true]{ echo hi }" src:(source__CFlag))] ) do_fork: T ) ===== CASE: -n -c assert *.[ch] ===== (command.Simple blame_tok: more_env: [] words: [ {} { } ] do_fork: T ) ===== CASE: -n -c assert 42[ch] ===== (command.Simple blame_tok: more_env: [] words: [ {} { } ] do_fork: T ) ===== CASE: -n -c echo[] ===== (command.Simple blame_tok: more_env: [] words: [{ }] do_fork: T ) ===== 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.Redirect child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) redirects: [(Redir op:"> loc:(redir_loc.Fd fd:1) arg:{})] ) ===== CASE: -n -c json write >out (42) ===== (command.Redirect child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Const c: val:(value.Int i:42))] named_args: [] right: ) do_fork: T ) redirects: [(Redir op:"> loc:(redir_loc.Fd fd:1) arg:{})] ) ===== CASE: -n -c [ x = y ] ===== (command.Simple blame_tok: more_env: [] words: [ {} {} {} ] do_fork: T ) OK test-lazy-arg-list *** Running test-lhs-expr ===== CASE: -n -c setvar x.y[z] = 42 ===== (command.Mutation keyword: lhs: [ (Subscript left: obj: (Attribute obj: (expr.Var left: name:x) op: attr: attr_name: y ctx: expr_context.Store ) index: (expr.Var left: name:z) ) ] op: obj: (Subscript left: obj: (expr.Var left: name:a) index: (expr.Var left: name:i) ) index: (expr.Var left: name:j) ) ] op: obj: (expr.Var left: name:a) index: (expr.Var left: name:i) ) (Attribute obj: (expr.Var left: name: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 ===== (command.Mutation keyword: lhs: [ (Subscript left: obj: (expr.Var left: name:a) index: (Subscript left: obj: (expr.Dict left: keys: [(expr.Const c: val:(value.Str s:k))] values: [(expr.Const c: val:(value.Int i:3))] ) index: (DQ ) ) ) ] op: more_env: [] words: [ {} {(SingleQuoted left: sval:"hi\n" right:)} ] do_fork: T ) ===== CASE: -n -c echo b''' hi ''' ===== (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:"hi\n" right:)} ] do_fork: T ) ===== 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 ===== (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:42)) ) ===== 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-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 \( ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:"(")}] do_fork: T ) ===== CASE: -n -c echo \; ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:";")}] do_fork: T ) ===== CASE: -n -c echo ~ ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.TildeSub left:)}] do_fork: T ) ===== CASE: -n -c echo \! ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:"!")}] do_fork: T ) ===== CASE: -n -c echo \% ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:"%")}] do_fork: T ) ===== CASE: -n -c echo \# ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:"#")}] do_fork: T ) ===== 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 ===== (command.Simple blame_tok: more_env: [] words: [ {} {(word_part.EscapedLiteral token: ch:.)} {(word_part.EscapedLiteral token: ch:-)} {(word_part.EscapedLiteral token: ch:/)} {(word_part.EscapedLiteral token: ch:a)} {(word_part.EscapedLiteral token: ch:Z)} {(word_part.EscapedLiteral token: ch:0)} {(word_part.EscapedLiteral token: ch:9)} ] do_fork: T ) 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: {} right: {} ) right: (arith_expr.Binary op: "> left: {} right: {} ) ) right: ) ===== CASE: -n -c ((1 > 0 && 43 > 42)) ===== ((1 > 0 && 43 > 42)) ^~ [ -c flag ]:1: Bash (( not allowed in YSH (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: cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen left: child: (arith_expr.Binary op: left: (arith_expr.Binary op: "> left: {} right: {} ) right: (arith_expr.Binary op: "> left: {} right: {} ) ) right: ) terminator: ) ] ) then_kw: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] then_tok: ) ] 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 (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: Id.Arith_Equal left: right: {} ) cond: (arith_expr.Binary op: left: right: {} ) update: (arith_expr.UnaryAssign op_id:Id.Arith_DPlus child:) body: (command.DoGroup left: children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) 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 (parse_dparen) ===== CASE: -n -c if (1 > 0 and 43 > 42) { echo yes } ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.YshExpr e: (expr.Binary op: left: (expr.Compare left: (expr.Const c: val:(value.Int i:1)) ops: [">] comparators: [(expr.Const c: val:(value.Int i:0))] ) right: (expr.Compare left: (expr.Const c: val:(value.Int i:43)) ops: [">] comparators: [(expr.Const c: val:(value.Int i:42))] ) ) ) action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] ) ] else_action: [] ) ===== CASE: -n -c if ( (1 > 0 and 43 > 42) ) { echo yes } ===== (command.If if_kw: arms: [ (IfArm keyword: cond: (condition.YshExpr e: (expr.Binary op: left: (expr.Compare left: (expr.Const c: val:(value.Int i:1)) ops: [">] comparators: [(expr.Const c: val:(value.Int i:0))] ) right: (expr.Compare left: (expr.Const c: val:(value.Int i:43)) ops: [">] comparators: [(expr.Const c: val:(value.Int i:42))] ) ) ) action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] ) ] else_action: [] ) OK test-parse-dparen *** Running test-parse_dollar ===== CASE: -n -c echo $ ===== (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo $ ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo $ ===== echo $ ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo $: ===== (command.Simple blame_tok: more_env: [] words: [{} { }] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo $: ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo $: ===== echo $: ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo "$" ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo "$" ===== echo "$" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "$:" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo "$:" ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo "$:" ===== echo "$:" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{}) right: ) } ] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo ${x:-$} ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo ${x:-$} ===== echo ${x:-$} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo ${x:-$:} ===== (command.Simple blame_tok: more_env: [] words: [ {} { (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word: { } ) right: ) } ] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo ${x:-$:} ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo ${x:-$:} ===== echo ${x:-$:} ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$}" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word:{}) right: ) ) } ] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo "${x:-$}" ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo "${x:-$}" ===== echo "${x:-$}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ ===== CASE: -n -c echo "${x:-$:}" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (BracedVarSub left: token: var_name: x suffix_op: (suffix_op.Unary op: arg_word: { } ) right: ) ) } ] do_fork: T ) ===== CASE: +O test-parse_dollar -n -c echo "${x:-$:}" ===== oils: got invalid option 'test-parse_dollar' ===== CASE: -n -c echo "${x:-$:}" ===== echo "${x:-$:}" ^ [ -c flag ]:1: Literal $ should be quoted like \$ OK test-parse_dollar *** Running test-place-expr ===== CASE: -n -c read (&x) ===== (command.Simple blame_tok: more_env: [] words: [{}] typed_args: (ArgList left: pos_args: [(expr.Place blame_tok: var_name:x ops:[])] named_args: [] right: ) do_fork: T ) ===== 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: [{}] typed_args: (ArgList left: pos_args: [ (expr.Binary op: left: (expr.Place blame_tok: var_name:x ops:[]) right: (expr.Const c: val:(value.Int i:1)) ) ] named_args: [] right: ) do_fork: T ) ===== 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: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c echo $(json write (x)) ===== (command.Simple blame_tok: more_env: [] words: [ {} { (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) do_fork: T ) right: ) } ] do_fork: T ) ===== CASE: -n -c var result = $(json write (x)) ===== (command.VarDecl keyword: lhs: [(NameType left: name:result)] rhs: (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) do_fork: T ) right: ) ) ===== CASE: -n -c json write (x, y); echo hi ===== (command.CommandList children: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [ (expr.Var left: name:x) (expr.Var left: name:y) ] named_args: [] right: ) do_fork: T ) terminator: ) (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] ) ===== CASE: -n -c json write (x, name = "value") echo hi ===== (command.CommandList children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [(NamedArg name: value:(DQ ))] right: ) do_fork: T ) (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] ) ===== CASE: -n -c json write (x) { echo hi } ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [(SourceLine line_num:1 content:"json write (x) { echo hi }" src:(source__CFlag))] ) do_fork: T ) ===== CASE: -n -c json write (x) { echo hi } ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [ (SourceLine line_num:2 content:"json write (x) {\n" src:(source__CFlag)) (SourceLine line_num:3 content:" echo hi\n" src:...0x7f75ee650290) (SourceLine line_num:4 content:"}" src:...0x7f75ee650290) ] ) do_fork: T ) ===== CASE: -n -c json write ( x, y, z ) ===== (command.Simple blame_tok: more_env: [] words: [{} {}] typed_args: (ArgList left: pos_args: [ (expr.Var left: name:x) (expr.Var left: name:y) (expr.Var left: name:z) ] named_args: [] right: ) do_fork: T ) ===== CASE: -n -c json write () ===== json write () ^ [ -c flag ]:1: Empty arg list not allowed ===== CASE: -n -c json write ( ) ===== json write ( ) ^ [ -c flag ]:1: Empty arg list not allowed ===== CASE: -n -c json write(x) ===== json write(x) ^ [ -c flag ]:1: Space required before ( ===== CASE: -n -c json write() ===== json write() ^ [ -c flag ]:1: Space required before ( ===== CASE: -n -c f(x) ===== f(x) ^ [ -c flag ]:1: Space required before ( OK test-proc-args *** Running test-proc-def ===== CASE: -n -c proc p(w) { var w = foo } ===== proc p(w) { var w = foo } ^ [ -c flag ]:1: 'w' was already declared ===== CASE: -n -c proc p(w; p) { var p = foo } ===== proc p(w; p) { var p = foo } ^ [ -c flag ]:1: 'p' was already declared ===== CASE: -n -c proc p(w; p; n, n2) { var n2 = foo } ===== proc p(w; p; n, n2) { var n2 = foo } ^~ [ -c flag ]:1: 'n2' was already declared ===== CASE: -n -c proc p(w; p; n, n2; b) { var b = foo } ===== proc p(w; p; n, n2; b) { var b = foo } ^ [ -c flag ]:1: 'b' was already declared OK test-proc-def *** 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.Arith_Colon) 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 left: name:x)] rhs: (Eggex left: regex: (re.CharClassLiteral negated: T terms: [ (CharRange start: (CharCode blame_tok: i:97 u_braced:F) end: (CharCode blame_tok: i:122 u_braced:F) ) ] ) flags: [] canonical_flags: "" ) ) ===== CASE: -n -c var x = / !d / ===== (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (Eggex left: regex: (PerlClass negated: name:d) flags: [] canonical_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) } ===== (Func keyword: name: positional: (ParamGroup params:[(Param blame_tok: name:x)]) body: (BraceGroup left: children: [ (command.Retval keyword: val: (expr.Var left: name:x) ) ] right: ) ) ===== CASE: -n -c func foo(x) { return () } ===== return () ^~~~~~ [ -c flag ]:3: shell functions can't be defined inside proc or func ===== 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-setvar ===== CASE: -n -c proc p(x) { var y = 1 setvar y = 42 } ===== (Proc keyword: name: sig: (proc_sig.Closed word:(ParamGroup params:[(Param blame_tok: name:x)])) body: (BraceGroup left: children: [ (command.VarDecl keyword: lhs: [(NameType left: name:y)] rhs: (expr.Const c: val:(value.Int i:1)) ) (command.Mutation keyword: lhs: [] op: ) ) ===== CASE: -n -c proc p(x) { var y = 1 setvar L = "L" # ERROR: not declared } ===== setvar L = "L" # ERROR: not declared ^ [ -c flag ]:4: setvar couldn't find matching 'var L' (OILS-ERR-10) ===== CASE: -n -c proc p(x) { var y = 1 setvar L[0] = "L" # ERROR: not declared } ===== setvar L[0] = "L" # ERROR: not declared ^ [ -c flag ]:4: setvar couldn't find matching 'var L' (OILS-ERR-10) ===== CASE: -n -c proc p(x) { var y = 1 setvar d.key = "v" # ERROR: not declared } ===== setvar d.key = "v" # ERROR: not declared ^ [ -c flag ]:4: setvar couldn't find matching 'var d' (OILS-ERR-10) ===== CASE: -n -c proc p(x) { setvar x = "X" # is mutating params allowed? I guess why not. } ===== (Proc keyword: name: sig: (proc_sig.Closed word:(ParamGroup params:[(Param blame_tok: name:x)])) body: (BraceGroup left: children: [ (command.Mutation keyword: lhs: [] op: ) ) OK test-setvar *** Running test-sh-assign ===== CASE: -n -c x=y ===== (command.ShAssignment left: children: [ (command.Sentence child: (command.ShAssignment left: ) ] right: ) ) ===== 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: ) ] right: ) ===== CASE: -n -c ( x=y; ) ===== (command.Subshell left: child: (command.Sentence child: (command.ShAssignment left: ) right: ) ===== CASE: -o ysh:upgrade -n -c x=y ===== (command.ShAssignment left: sval:hi right:)} ] do_fork: T ) terminator: ) ===== CASE: -n -c echo u'hi' ===== (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:hi right:)} ] do_fork: T ) ===== CASE: -n -c (echo u'hi') ===== (command.Subshell left: child: (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:hi right:)} ] do_fork: T ) right: ) ===== CASE: -n -c echo b'hi'trailing ===== echo b'hi'trailing ^~~~~~~~ [ -c flag ]:1: Unexpected token after YSH single-quoted string ===== CASE: -n -c echo b'hi'#notcomment ===== echo b'hi'#notcomment ^ [ -c flag ]:1: Unexpected token after YSH single-quoted string ===== CASE: -n -c echo 'hi'#notcomment ===== (command.Simple blame_tok: more_env: [] words: [{} {(SQ hi) }] do_fork: T ) OK test-string-literals *** Running test-type-expr ===== CASE: -n -c var x: Int = f() ===== (command.VarDecl keyword: lhs: [(NameType left: name:x typ:(TypeExpr tok: name:Int))] rhs: (expr.FuncCall func: (expr.Var left: name:f) args: (ArgList left: pos_args:[] named_args:[] right:) ) ) ===== CASE: -n -c var x Int = f() ===== (command.VarDecl keyword: lhs: [(NameType left: name:x typ:(TypeExpr tok: name:Int))] rhs: (expr.FuncCall func: (expr.Var left: name:f) args: (ArgList left: pos_args:[] named_args:[] right:) ) ) ===== CASE: -n -c proc p (; x Int, y Int; ) { echo hi } ===== (Proc keyword: name: sig: (proc_sig.Closed positional: (ParamGroup params: [ (Param blame_tok: name: x type: (TypeExpr tok: name:Int) ) (Param blame_tok: name: y type: (TypeExpr tok: name:Int) ) ] ) ) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ) ===== CASE: -n -c func f (x Int, y Int; z Int = 0) { echo hi } ===== (Func keyword: name: positional: (ParamGroup params: [ (Param blame_tok: name: x type: (TypeExpr tok: name:Int) ) (Param blame_tok: name: y type: (TypeExpr tok: name:Int) ) ] ) named: (ParamGroup params: [ (Param blame_tok: name: z type: (TypeExpr tok: name:Int) default_val: (expr.Const c: val:(value.Int i:0)) ) ] ) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ) OK test-type-expr *** Running test-typed-proc ===== CASE: -n -c typed proc p(words) { echo hi } ===== (Proc keyword: name: sig: (proc_sig.Closed word:(ParamGroup params:[(Param blame_tok: name:words)])) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ) ===== CASE: -n -c typed zzz p(words) { echo hi } ===== typed zzz p(words) { echo hi } ^~~ [ -c flag ]:1: Expected 'proc' after 'typed' ===== CASE: -n -c typed p(words) { echo hi } ===== typed p(words) { echo hi } ^ [ -c flag ]:1: Expected 'proc' after 'typed' OK test-typed-proc *** Running test-units-suffix ===== CASE: -n -c = 100 M M ===== = 100 M M ^ [ -c flag ]:1: Syntax error in expression (near Id.Expr_Name) ===== CASE: -n -c = 100 M; echo ===== = 100 M; echo ^ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = 100 Mi; echo ===== = 100 Mi; echo ^~ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = 9.9 Mi; echo ===== = 9.9 Mi; echo ^~ [ -c flag ]:1: unix suffix implemented ===== CASE: -n -c = 9.9e-1 Mi; echo ===== = 9.9e-1 Mi; echo ^~ [ -c flag ]:1: unix suffix implemented ===== CASE: -n -c = 100Mi ===== = 100Mi ^~ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = [100 Mi, 200 Mi] ===== = [100 Mi, 200 Mi] ^~ [ -c flag ]:1: Units suffix not implemented ===== CASE: -n -c = {[42 Ki]: 43 Ki} ===== = {[42 Ki]: 43 Ki} ^~ [ -c flag ]:1: Units suffix not implemented OK test-units-suffix *** Running test-var-decl ===== CASE: -n -c proc p(x) { echo hi var x = 2 # Cannot redeclare param } ===== var x = 2 # Cannot redeclare param ^ [ -c flag ]:4: 'x' was already declared ===== CASE: -n -c proc p { var x = 1 echo hi var x = 2 # Cannot redeclare local } ===== var x = 2 # Cannot redeclare local ^ [ -c flag ]:5: 'x' was already declared ===== CASE: -n -c proc p(x, :out) { var out = 2 # Cannot redeclare out param } ===== proc p(x, :out) { ^ [ -c flag ]:2: Syntax error in expression (near Id.Arith_Colon) ===== CASE: -n -c proc p { var out = 2 # Cannot redeclare out param cd /tmp { var out = 3 } } ===== var out = 3 ^~~ [ -c flag ]:5: 'out' was already declared ===== CASE: -n -c var x = 1 proc p { echo hi var x = 2 } proc p2 { var x = 3 } ===== (command.CommandList children: [ (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:1)) ) (Proc keyword: name: sig: (proc_sig__Open) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:2)) ) ] right: ) ) (Proc keyword: name: sig: ...0x7ff565ffa0d0 body: (BraceGroup left: children: [ (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:3)) ) ] right: ) ) ] ) OK test-var-decl *** Running test-ysh-case ===== CASE: -n -c case (x) { (else) { = 1; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Sentence child: (command.Expr keyword: ) ] right: ) ] arms_end: ) ===== CASE: -n -c var myexpr = ^[123] case (123) { (myexpr) { echo 1 } } ===== (command.CommandList children: [ (command.VarDecl keyword: lhs: [(NameType left: name:myexpr)] rhs: (expr.Literal inner:(expr.Const c: val:(value.Int i:123))) ) (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Const c: val:(value.Int i:123))) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Var left: name:myexpr)]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ] ) ===== CASE: -n -c case (x) { (else) { echo 1 } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { (else) { = 1 } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Expr keyword: ) ] arms_end: ) ===== CASE: -n -c case (x) { (else) { = 1 } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Expr keyword: ) ] arms_end: ) ===== CASE: -n -c case (x) { (else) { = 1 } # Comment } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Expr keyword: ) ] arms_end: ) ===== CASE: -n -c case (3) { (3) { echo hi } # comment line } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Const c: val:(value.Int i:3))) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { (else) { echo 1 } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { (else) { echo } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { *.py { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{ }]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { (obj.attr) { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs: [ (Attribute obj: (expr.Var left: name:obj) op: attr: attr_name: attr ctx: expr_context.Store ) ] ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { (0) { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:0))]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (foo) { ("main.py") { echo "python" } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:foo)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs:[(DQ )]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (add(10, 32)) { (40 + 2) { echo Found the answer } (else) { echo Incorrect } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e: (expr.FuncCall func: (expr.Var left: name:add) args: (ArgList left: pos_args: [ (expr.Const c: val:(value.Int i:10)) (expr.Const c: val:(value.Int i:32)) ] named_args: [] right: ) ) ) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs: [ (expr.Binary op: left: (expr.Const c: val:(value.Int i:40)) right: (expr.Const c: val:(value.Int i:2)) ) ] ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [ {} {} {} {} ] do_fork: T ) ] right: ) (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (file) { / dot* '.py' / { echo Python } / dot* ('.cc' | '.h') / { echo C++ } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:file)) arms_start: arms: [ (CaseArm left: pattern: (Eggex left: regex: (re.Seq children: [ (re.Repeat child: (re.Primitive blame_tok: id:Id.Eggex_Dot) op: ) (SQ .py) ] ) flags: [] canonical_flags: "" ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) (CaseArm left: pattern: (Eggex left: regex: (re.Seq children: [ (re.Repeat child: (re.Primitive blame_tok: id:Id.Eggex_Dot) op: ) (re.Group child:(re.Alt children:[(SQ .cc) (SQ .h)])) ] ) flags: [] canonical_flags: "" ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} { }] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (lang) { en-US | en-CA | en-UK { echo Hello } fr-FR | fr-CA { echo Bonjour } (else) { echo o/ } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:lang)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words: [{} {} {}] ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) (CaseArm left: pattern: (pat.Words words:[{} {}]) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} { }] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (num) { (1) | (2) { echo number } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:num)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs: [ (expr.Const c: val:(value.Int i:1)) (expr.Const c: val:(value.Int i:2)) ] ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (num) { (1) | (2) | (3) | (4) | (5) { echo small } (else) { echo large } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:num)) arms_start: arms: [ (CaseArm left: pattern: (pat.YshExprs exprs: [ (expr.Const c: val:(value.Int i:1)) (expr.Const c: val:(value.Int i:2)) (expr.Const c: val:(value.Int i:3)) (expr.Const c: val:(value.Int i:4)) (expr.Const c: val:(value.Int i:5)) ] ) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) (CaseArm left: pattern: (pat__Else) middle: action: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (add(10, 32)) { (40 + 2) { echo Found the answer } (else) { echo Incorrect } } ===== case ^ [ -c flag ]:2: Expected a word to match against ===== CASE: -n -c case (file) { ('README') | / dot* '.md' / { echo Markdown } } ===== case (file) ^ [ -c flag ]:2: Expected word type Id.Lit_LBrace, got Id.Op_Newline ===== CASE: -n -c case (file) { { echo Python } } ===== case (file) ^ [ -c flag ]:2: Expected word type Id.Lit_LBrace, got Id.Op_Newline ===== CASE: -n -c case (file) { cc h { echo C++ } } ===== case (file) ^ [ -c flag ]:2: Expected word type Id.Lit_LBrace, got Id.Op_Newline ===== CASE: -n -c case (lang) { en-US | ('en-CA') | / 'en-UK' / { echo Hello } } ===== | ('en-CA') ^ [ -c flag ]:4: Expected case pattern ===== CASE: -n -c case (lang) { else) { echo o/ } } ===== else) { ^ [ -c flag ]:3: Expected word type Id.Lit_LBrace, got Id.Op_RParen ===== CASE: -n -c case (num) { (1) | (2) | (3) | (4) | (5) { echo small } (6) | (else) { echo large } } ===== (6) | (else) { ^~~~ [ -c flag ]:8: Syntax error in expression (near Id.Expr_Else) ===== CASE: -n -c case $foo { ("main.py") { echo "python" } } ===== case $foo { ^ [ -c flag ]:2: Expected word type Id.KW_In, got Id.Lit_LBrace ===== CASE: -n -c case (x) { *.py { echo "python" } } ===== case (x) ^ [ -c flag ]:2: Expected word type Id.Lit_LBrace, got Id.Op_Newline ===== CASE: -n -c case (foo) in *.py { echo "python" } esac ===== case (foo) in ^~ [ -c flag ]:2: Expected word type Id.Lit_LBrace, got Id.KW_In ===== CASE: -n -c case $foo { bar) { echo "python" } } ===== case $foo { ^ [ -c flag ]:2: Expected word type Id.KW_In, got Id.Lit_LBrace ===== CASE: -n -c case (x) { { echo "python" } } ===== echo "python" ^~~~ [ -c flag ]:4: Expected word type Id.Lit_LBrace, got Id.Word_Compound ===== CASE: -n -c case (x { *.py { echo "python" } } ===== case (x { ^ [ -c flag ]:2: Syntax error in expression (near Id.Op_LBrace) ===== CASE: -n -c case (x) { *.py) { echo "python" } } ===== *.py) { echo "python" } ^ [ -c flag ]:3: Expected word type Id.Lit_LBrace, got Id.Op_RParen ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) ===== CASE: -n -c case (x) { word { echo word; } (3) { echo expr; } /'eggex'/ { echo eggex; } } ===== (command.Case case_kw: to_match: (case_arg.YshExpr e:(expr.Var left: name:x)) arms_start: arms: [ (CaseArm left: pattern: (pat.Words words:[{}]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (pat.YshExprs exprs:[(expr.Const c: val:(value.Int i:3))]) middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) (CaseArm left: pattern: (Eggex left: regex:(SQ eggex) flags:[] canonical_flags:"") middle: action: [ (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ] arms_end: ) OK test-ysh-case *** Running test-ysh-expr ===== CASE: -n -c = 5 mod 3 ===== = 5 mod 3 ^ [ -c flag ]:1: Syntax error in expression (near Id.Expr_DecInt) ===== CASE: -n -c = >>= ===== = >>= ^~~ [ -c flag ]:1: Syntax error in expression (near Id.Arith_DGreatEqual) ===== CASE: -n -c = %( ===== = %( ^ [ -c flag ]:1: Unexpected token in array literal ===== CASE: -n -c = 42, ===== = 42, ^ [ -c flag ]:1: Invalid trailing comma ===== CASE: -n -c = (42,) ===== = (42,) ^ [ -c flag ]:1: Invalid trailing comma ===== CASE: -n -c =a ===== =a ^ [ -c flag ]:1: =word isn't allowed. Hint: add a space after =, or quote it ===== CASE: -n -c var d = {} = d["foo", "bar"] ===== = d["foo", "bar"] ^ [ -c flag ]:3: Only 1 subscript is accepted OK test-ysh-expr *** Running test-ysh-expr-more ===== CASE: -n -c if (5 == 5) { echo yes } ===== if (5 == 5) { echo yes } ^~ [ -c flag ]:1: Use === to be exact, or ~== to convert types ===== CASE: -n -c echo $[join(x)] ===== (command.Simple blame_tok: more_env: [] words: [ {} { (word_part.ExprSub left: child: (expr.FuncCall func: (expr.Var left: name:join) args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) ) right: ) } ] 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 left: name:split) args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) ) right: ) } ] 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 left: name:split) args: (ArgList left: pos_args: [(expr.Var left: name:x)] named_args: [] right: ) ) right: ) } {} ] do_fork: T ) ===== CASE: -n -c echo @[split(x)]extra ===== echo @[split(x)]extra ^~~~~ [ -c flag ]:1: Unexpected token after Expr splice ===== CASE: -n -c echo @split("a") ===== echo @split("a") ^ [ -c flag ]:1: Space required before ( OK test-ysh-expr-more *** Running test-ysh-for ===== CASE: -n -c for x in (obj) { echo $x } ===== (command.ForEach keyword: iter_names: [x] iterable: (for_iter.YshExpr e:(expr.Var left: name:obj) blame:) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] right: ) ) ===== CASE: -n -c for x in (obj); do echo $x done ===== for x in (obj); do ^ [ -c flag ]:2: Expected { after iterable expression ===== CASE: -n -c for x, y in SPAM EGGS; do echo $x done ===== (command.ForEach keyword: iter_names: [x y] iterable: (for_iter.Words words:[{} {}]) semi_tok: body: (command.DoGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] right: ) ) ===== CASE: -n -c for x-y in SPAM EGGS; do echo $x done ===== for x-y in SPAM EGGS; do ^~~ [ -c flag ]:2: Invalid loop variable name 'x-y' ===== CASE: -n -c for x, y, z in SPAM EGGS; do echo $x done ===== for x, y, z in SPAM EGGS; do ^~~ [ -c flag ]:2: Expected at most 2 loop variables ===== CASE: -n -c for w, x, y, z in SPAM EGGS; do echo $x done ===== for w, x, y, z in SPAM EGGS; do ^ [ -c flag ]:2: Unexpected word after 3 loop variables ===== CASE: -n -c for x, y in SPAM EGGS do echo $x done ===== (command.ForEach keyword: iter_names: [x y] iterable: (for_iter.Words words:[{} {}]) body: (command.DoGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ x)}] do_fork: T ) ] right: ) ) ===== CASE: -n -c for const in (x) { echo $var } ===== (command.ForEach keyword: iter_names: [const] iterable: (for_iter.YshExpr e:(expr.Var left: name:x) blame:) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {($ var)}] do_fork: T ) ] right: ) ) OK test-ysh-for *** Running test-ysh-nested-proc-func ===== 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 must be defined at the top level ===== CASE: -n -c func f() { echo 1; proc f { echo f }; echo 2 } ===== func f() { echo 1; proc f { echo f }; echo 2 } ^~~~ [ -c flag ]:1: procs must be defined at the top level ===== CASE: -n -c proc p { echo 1; func f() { echo f }; echo 2 } ===== proc p { echo 1; func f() { echo f }; echo 2 } ^~~~ [ -c flag ]:1: funcs must be defined at the top level ===== CASE: -n -c func f() { echo 1; func f2() { echo f }; echo 2 } ===== func f() { echo 1; func f2() { echo f }; echo 2 } ^~~~ [ -c flag ]:1: funcs must be defined at the top level ===== CASE: -n -c proc p { echo 1; +weird() { echo f; }; echo 2 } ===== proc p { echo 1; +weird() { echo f; }; echo 2 } ^ [ -c flag ]:1: shell functions can't be defined inside proc or func ===== 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: shell functions can't be defined inside proc or func ===== 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 must be defined at the top level ===== 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: [{} {}] 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: [{} {}] do_fork: T ) terminator: ) ] right: ) ) terminator: ) (command.Sentence child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) terminator: ) ] right: ) ) ===== CASE: -n -c proc p() { shopt --unset errexit { false hi } } ===== (Proc keyword: name: sig: (proc_sig.Closed) body: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {} {}] block: (LiteralBlock brace_group: (BraceGroup left: children: [ (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) ] right: ) lines: [ (SourceLine line_num: 1 content: "proc p() { shopt --unset errexit { false hi } }" src: (source__CFlag) ) ] ) do_fork: T ) ] right: ) ) OK test-ysh-nested-proc-func *** 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 < lhs: [(NameType left: name:x)] rhs: (CommandSub left_token: child: (command.Sentence child: (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:1)) ) terminator: ) right: ) ) ===== CASE: -n -c var x = $(var x = 1 ) ===== (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (CommandSub left_token: child: (command.VarDecl keyword: lhs: [(NameType left: name:x)] rhs: (expr.Const c: val:(value.Int i:1)) ) right: ) ) ===== CASE: -n -c var x = $(var x = 1) ===== var x = $(var x = 1) ^ [ -c flag ]:1: Syntax error in expression (near Id.Eof_RParen) ===== CASE: -n -c var x = $(var x = 1; )) ===== var x = $(var x = 1; )) ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_RParen) ===== CASE: -n -c var x = $(var x = 1; ) ) ===== var x = $(var x = 1; ) ) ^ [ -c flag ]:1: Syntax error in expression (near Id.Op_RParen) OK test-ysh-var *** Running test-ysh_bare_words ===== CASE: -n -c echo \$ ===== (command.Simple blame_tok: more_env: [] words: [{} {(word_part.EscapedLiteral token: ch:"$")}] do_fork: T ) ===== CASE: -n -c echo \z ===== echo \z ^~ [ -c flag ]:1: Invalid char escape in unquoted word (OILS-ERR-13) OK test-ysh_bare_words *** Running test-ysh_c_strings ===== CASE: -n -c echo $'\u03bc' ===== (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:"μ" right:)} ] do_fork: T ) ===== CASE: -n -c echo $'\u{03bc}' ===== echo $'\u{03bc}' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c echo $'\u{03bc' ===== echo $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c const bad = $'\u{03bc' ===== const bad = $'\u{03bc' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c echo $'\z' ===== (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:"\\z" right:)} ] do_fork: T ) ===== CASE: -n -c echo $'\z' ===== echo $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c const bad = $'\z' ===== const bad = $'\z' ^ [ -c flag ]:1: Invalid char escape in C-style string literal (OILS-ERR-11) ===== CASE: -n -c echo $'\101' ===== (command.Simple blame_tok: more_env: [] words: [ {} {(SingleQuoted left: sval:A right:)} ] do_fork: T ) ===== CASE: -n -c const bad = $'\101' ===== const bad = $'\101' ^~~~ [ -c flag ]:1: Use \xhh or \u{...} instead of octal escapes in YSH strings ===== CASE: -n -c const bad = c'\xf' ===== const bad = c'\xf' ^ [ -c flag ]:1: Syntax error in expression (near Id.Left_SingleQuote) OK test-ysh_c_strings *** Running test-ysh_dq_strings ===== CASE: -n -c echo "\z" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ===== CASE: +O parse_backslash -n -c echo test-parse_backslash "\z" ===== echo test-parse_backslash "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) ===== CASE: -n -c echo "\z" ===== echo "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) ===== CASE: -n -c const bad = "\z" ===== const bad = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) ===== CASE: -n -c echo "\u1234" ===== (command.Simple blame_tok: more_env: [] words: [{} {(DQ )}] do_fork: T ) ===== CASE: -n -c echo "\u1234" ===== echo "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) ===== CASE: -n -c const bad = "\u1234" ===== const bad = "\u1234" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) ===== CASE: -n -c echo "`echo hi`" ===== (command.Simple blame_tok: more_env: [] words: [ {} { (DQ (CommandSub left_token: child: (command.Simple blame_tok: more_env: [] words: [{} {}] do_fork: T ) right: ) ) } ] do_fork: T ) ===== CASE: -n -c echo "`echo hi`" ===== echo "`echo hi`" ^ [ -c flag ]:1: Use $(cmd) instead of backticks (parse_backticks) ===== CASE: -n -c const bad = "`echo hi`" ===== const bad = "`echo hi`" ^ [ -c flag ]:1: Invalid backtick: use $(cmd) or \` in YSH strings ===== CASE: -n -c setvar x = "\z" ===== setvar x = "\z" ^ [ -c flag ]:1: Invalid char escape in double quoted string (OILS-ERR-12) OK test-ysh_dq_strings test/ysh-parse-errors.sh: 55 tests passed.