[1/1] SYMLINK _bin/cxx-asan oils-for-unix ysh 'ysh' -> 'oils-for-unix' *** Running test-EvalExpr-calls ===== CASE: -c json write (len(42)) ===== json write (len(42)) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c = len(42) ===== = len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c call len(42) ===== call len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c echo $[len(42)] ===== echo $[len(42)] ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c echo $[len(z = 42)] ===== echo $[len(z = 42)] ^ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c echo @[len(42)] ===== echo @[len(42)] ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c echo @[len(z = 42)] ===== echo @[len(z = 42)] ^ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c const x = len(42) ===== const x = len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c setvar x += len(42) ===== setvar x += len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c var d = {} setvar d[len(42)] = "foo" ===== setvar d[len(42)] = "foo" ^~ [ -c flag ]:3: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c var d = {} setvar len(42).z = "foo" ===== setvar len(42).z = "foo" ^ [ -c flag ]:3: Subscript/Attribute not allowed on this LHS expression ===== CASE: -c hay define Package Package foo { x = len(42) } ===== x = len(42) ^~ [ -c flag ]:4: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c if (len(42)) { echo hi } ===== if (len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c while (len(42)) { echo hi } ===== while (len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c for x in (len(42)) { echo $x } ===== for x in (len(42)) { echo $x } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int OK test-EvalExpr-calls *** Running test-append-usage-error ===== CASE: -c append x ([]) ===== ===== CASE: -c append ===== append ^~~~~~ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c append x ===== append x ^~~~~~ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c append x ([], []) ===== append x ([], []) ^ [ -c flag ]:1: fatal: Expected 1 typed args, but got 2 OK test-append-usage-error *** Running test-assert ===== CASE: -c assert [0.0] ===== assert [0.0] ^ [ -c flag ]:1: fatal: Expression isn't true ===== CASE: -c assert [3 > 4] ===== assert [3 > 4] ^ [ -c flag ]:1: fatal: Expression isn't true ===== CASE: -c assert (0) ===== Value isn't true: (Int) 0 assert (0) ^ [ -c flag ]:1: fatal: assertion ===== CASE: -c assert (null === 42) ===== Value isn't true: (Bool) false assert (null === 42) ^ [ -c flag ]:1: fatal: assertion ===== CASE: -c assert [null === 42] ===== Expected: (Null) null Got: (Int) 42 assert [null === 42] ^~~ [ -c flag ]:1: fatal: Not equal ===== CASE: -c assert [null === list(1 ..< 50)] ===== Expected: (Null) null Got: (List) [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ] assert [null === list(1 ..< 50)] ^~~ [ -c flag ]:1: fatal: Not equal ===== CASE: -c assert [{k: list(3 ..< 40)} === list(1 ..< 50)] ===== Expected: (Dict) { k: [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 ] } Got: (List) [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ] assert [{k: list(3 ..< 40)} === list(1 ..< 50)] ^~~ [ -c flag ]:1: fatal: Not equal OK test-assert *** Running test-attr-error-locs ===== CASE: -c = {}.key ===== = {}.key ^ [ -c flag ]:1: fatal: Dict entry 'key' not found ===== CASE: -c = {}->method ===== = {}->method ^~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/method' not found on builtin type Dict ===== CASE: -c var obj = Object(null, {}); = obj.attr ===== var obj = Object(null, {}); = obj.attr ^ [ -c flag ]:1: fatal: Attribute 'attr' not found on Obj ===== CASE: -c var obj = Object(null, {}); = obj->method ===== var obj = Object(null, {}); = obj->method ^~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/method' not found on Obj prototype chain OK test-attr-error-locs *** Running test-cannot-stringify-list ===== CASE: -c var mylist = [1,2,3]; write $mylist ===== var mylist = [1,2,3]; write $mylist ^~~~~ [ -c flag ]:1: fatal: Word eval got a List, which can't be stringified (OILS-ERR-203) ===== CASE: -c var mylist = [1,2,3]; write $[mylist] ===== var mylist = [1,2,3]; write $[mylist] ^~ [ -c flag ]:1: fatal: Expr sub got a List, which can't be stringified (OILS-ERR-203) ===== CASE: -c = str(/d+/) ===== (Str) '[[:digit:]]+' ===== CASE: -c = str([1,2]) ===== = str([1,2]) ^ [ -c flag ]:1: fatal: str() got a List, which can't be stringified (OILS-ERR-203) ===== CASE: -c = str({}) ===== = str({}) ^ [ -c flag ]:1: fatal: str() expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c = join([true, null]) ===== (Str) 'truenull' ===== CASE: -c = join([[1,2], null]) ===== = join([[1,2], null]) ^ [ -c flag ]:1: fatal: join() got a List, which can't be stringified (OILS-ERR-203) OK test-cannot-stringify-list *** Running test-const-decl ===== CASE: -c const x = {}; const x = {}; ===== const x = {}; const x = {}; ^ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' ===== CASE: -c const x; const x; ===== const x; const x; ^ [ -c flag ]:1: fatal: Can't assign to readonly value 'x' OK test-const-decl *** Running test-dict-convert ===== CASE: -c = dict(1) ===== = dict(1) ^ [ -c flag ]:1: fatal: dict() expected Dict, Obj, or BashAssoc, got Int ===== CASE: -c = dict("foo") ===== = dict("foo") ^ [ -c flag ]:1: fatal: dict() expected Dict, Obj, or BashAssoc, got Str ===== CASE: -c = dict(len) ===== = dict(len) ^~~ [ -c flag ]:1: fatal: dict() expected Dict, Obj, or BashAssoc, got BuiltinFunc ===== CASE: -c = dict("foo"->startswith) ===== = dict("foo"->startswith) ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str ===== CASE: -c = dict([["too", "many", "parts"]]) ===== = dict([["too", "many", "parts"]]) ^ [ -c flag ]:1: fatal: dict() expected Dict, Obj, or BashAssoc, got List OK test-dict-convert *** Running test-eggex ===== CASE: -c = / [ \x00 \xff ] / ===== ===== CASE: -c = / [ \x00-\xff ] / ===== ===== CASE: -c = / [ $'\x00 \xff' ] / ===== = / [ $'\x00 \xff' ] / ^~ [ -c flag ]:1: fatal: Use unquoted char literal for byte 255, which is >= 128 (avoid confusing a set of bytes with a sequence) ===== CASE: -c = / [ \u{0} ] / ===== ===== CASE: -c = / [ \u{0}-\u{1} ] / ===== ===== CASE: -c var x =/ [ \u{80} ] /; echo $x ===== var x =/ [ \u{80} ] /; echo $x ^~~~~~ [ -c flag ]:1: fatal: ERE can't express char code 128 ===== CASE: -c var x = / [ \u{7f}-\u{80} ] /; echo $x ===== var x = / [ \u{7f}-\u{80} ] /; echo $x ^~~~~~ [ -c flag ]:1: fatal: ERE can't express char code 128 ===== CASE: -c = / [ \\ '^-]' 'abc' ] / ===== ===== CASE: -c var x = / [ a-'^' ] /; echo $x ===== var x = / [ a-'^' ] /; echo $x ^ [ -c flag ]:1: fatal: Can't use char 94 as end of range in ERE syntax ===== CASE: -c var x = / [ '-'-z ] /; echo $x ===== var x = / [ '-'-z ] /; echo $x ^ [ -c flag ]:1: fatal: Can't use char 45 as start of range in ERE syntax ===== CASE: -c var x = / [ ']'-z ] /; echo $x ===== var x = / [ ']'-z ] /; echo $x ^ [ -c flag ]:1: fatal: Can't use char 93 as start of range in ERE syntax ===== CASE: -c var x = / ['^'] /; echo $x ===== [^] ===== CASE: -c var i = 42 = / @i / # splice object of wrong type ===== = / @i / # splice object of wrong type ^ [ -c flag ]:3: fatal: Eggex splice expected Str or Eggex, got Int ===== CASE: -c var i = 42 = / [a @i] / # char class splice object of wrong type ===== = / [a @i] / # char class splice object of wrong type ^ [ -c flag ]:3: fatal: Eggex char class splice expected Str, got Int OK test-eggex *** Running test-eggex-2 ===== CASE: -c var sq = / 'foo'+ / ===== ===== CASE: -c var sq = / ('foo')+ / echo $sq var sq2 = / + / echo $sq2 ===== (foo)+ (foo)+ ===== CASE: -c var literal = "foo" var svs = / @literal+ / echo $svs ===== var svs = / @literal+ / ^ [ -c flag ]:3: fatal: POSIX EREs don't have groups without capture, so this node needs () around it. OK test-eggex-2 *** Running test-eggex-api ===== CASE: -c = _group(0) ===== = _group(0) ^ [ -c flag ]:1: fatal: No regex capture groups ===== CASE: -c if ("foo" ~ /[a-z]/) { echo $[_group(1)] } ===== if ("foo" ~ /[a-z]/) { echo $[_group(1)] } ^ [ -c flag ]:1: fatal: Expected capture group less than 1, got 1 ===== CASE: -c if ("foo" ~ /[a-z]/) { echo $[_group("name")] } ===== if ("foo" ~ /[a-z]/) { echo $[_group("name")] } ^ [ -c flag ]:1: fatal: No such group 'name' ===== CASE: -c if ("foo" ~ "[a-z]") { echo $[_group(1)] } ===== if ("foo" ~ "[a-z]") { echo $[_group(1)] } ^ [ -c flag ]:1: fatal: Expected capture group less than 1, got 1 ===== CASE: -c if ("foo" ~ "[a-z]") { echo $[_group("name")] } ===== if ("foo" ~ "[a-z]") { echo $[_group("name")] } ^ [ -c flag ]:1: fatal: ERE captures don't have names ('name') ===== CASE: -c = _group("foo") ===== = _group("foo") ^ [ -c flag ]:1: fatal: No regex capture groups OK test-eggex-api *** Running test-eggex-convert-func ===== CASE: -c = / / ===== ===== CASE: -c = / / ===== ===== CASE: -c = / / ===== ===== CASE: -c = / / ===== = / / ^~~ [ -c flag ]:1: fatal: Expected 'BAD' to be a func, got Undef ===== CASE: -c = / / ===== = / / ^~~ [ -c flag ]:1: fatal: Expected 'BAD' to be a func, got Undef ===== CASE: -c var pat = / /; var m = "10" => search(pat) => group(1) ===== var pat = / /; var m = "10" => search(pat) => group(1) ^~~~~~~~ [ -c flag ]:1: fatal: Expected 'evalExpr' to be a func, got Undef OK test-eggex-convert-func *** Running test-equality ===== CASE: -c = ^[42] === ^[43] ===== = ^[42] === ^[43] ^~~ [ -c flag ]:2: fatal: Can't compare two values of type Expr ===== CASE: -c = ^(echo hi) === ^(echo yo) ===== = ^(echo hi) === ^(echo yo) ^~~ [ -c flag ]:2: fatal: Can't compare two values of type Command OK test-equality *** Running test-error-builtin ===== CASE: -c error ===== error ^~~~~ [ -c flag ]:1: 'error' expected a message to display error ^~~~~ [ -c flag ]:1: errexit PID 15321: command.Simple failed with status 2 ===== CASE: -c error -- ===== error -- ^~~~~ [ -c flag ]:1: 'error' expected a message to display error -- ^~~~~ [ -c flag ]:1: errexit PID 15323: command.Simple failed with status 2 ===== CASE: -c error -- oops ===== error -- oops ^~~~~ [ -c flag ]:1: fatal: oops ===== CASE: -c error oops ===== error oops ^~~~~ [ -c flag ]:1: fatal: oops ===== CASE: -c error oops (code=99) ===== error oops (code=99) ^~~~~ [ -c flag ]:1: fatal: oops OK test-error-builtin *** Running test-error-loc-bugs ===== CASE: -c func id(x) { return (x) } #pp test_ (id(len(42))) # This should point at ( in len, not id( pp test_ (len(id(42))) ===== pp test_ (len(id(42))) ^ [ -c flag ]:9: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c var methods = {} # Should point at methods, not {} var o = Object(methods, {}) ===== var o = Object(methods, {}) ^ [ -c flag ]:5: fatal: Object() expected Obj or Null, got Dict OK test-error-loc-bugs *** Running test-fallback-locations ===== CASE: -c if (len(42)) { echo hi } ===== if (len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c if (1 + len(42)) { echo hi } ===== if (1 + len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c const f = 42; func f() { echo hi } ===== const f = 42; func f() { echo hi } ^ [ -c flag ]:1: fatal: Can't assign to readonly value 'f' ===== CASE: -c for x in $[2 + len(42)] { echo hi } ===== for x in $[2 + len(42)] { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c for x in (len(42)) { echo hi } ===== for x in (len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c while (len(42)) { echo hi } ===== while (len(42)) { echo hi } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c case (len(42)) { pat { echo argument } } ===== case (len(42)) { pat { echo argument } } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c case (42) { (len(42)) { echo arm } } ===== case (42) { (len(42)) { echo arm } } ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c case "$[len(42)]" in pat) echo hi ;; esac ===== case "$[len(42)]" in pat) echo hi ;; esac ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c var x = 3 + len(42) ===== var x = 3 + len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c const x = 3 + len(42) ===== const x = 3 + len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c setvar x = 3 + len(42) ===== setvar x = 3 + len(42) ^~ [ -c flag ]:1: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c setvar x = "s" + 5 ===== setvar x = "s" + 5 ^ [ -c flag ]:1: fatal: Binary operator expected numbers, got Str and Int (OILS-ERR-201) ===== CASE: -c while ("s" + 5) { echo yes } ===== while ("s" + 5) { echo yes } ^ [ -c flag ]:1: fatal: Binary operator expected numbers, got Str and Int (OILS-ERR-201) ===== CASE: -c func f(x) { return (x) }; var x = f([1,2])[1](3); echo $x ===== func f(x) { return (x) }; var x = f([1,2])[1](3); echo $x ^ [ -c flag ]:1: fatal: Expected a function or method, got Int OK test-fallback-locations *** Running test-fat-arrow ===== CASE: -c = "str" => upper() ===== (Str) 'STR' ===== CASE: -c = "str" -> bad() ===== = "str" -> bad() ^~~ [ -c flag ]:1: fatal: Mutating method 'M/bad' not found on builtin type Str ===== CASE: -c = "str" => bad() ===== = "str" => bad() ^~~ [ -c flag ]:1: fatal: Undefined variable 'bad' ===== CASE: -c = ["3", "4"] => join("/") ===== (Str) '3/4' ===== CASE: -c = "badstring" => join("/") ===== = "badstring" => join("/") ^ [ -c flag ]:1: fatal: Arg 1 should be a List, got Str ===== CASE: -c = [1.0, 2.0] => indexOf(3.14) ===== = [1.0, 2.0] => indexOf(3.14) ^ [ -c flag ]:1: fatal: Equality isn't defined on Float values (OILS-ERR-202) ===== CASE: -c var myint = 42 = "badstring" => myint("/") ===== = "badstring" => myint("/") ^~~~~ [ -c flag ]:3: fatal: Fat arrow => expects method or function, got Int OK test-fat-arrow *** Running test-float-convert ===== CASE: -c = float({}) ===== = float({}) ^ [ -c flag ]:1: fatal: float() expected Int, Float, or Str, got Dict ===== CASE: -c = float([]) ===== = float([]) ^ [ -c flag ]:1: fatal: float() expected Int, Float, or Str, got List ===== CASE: -c = float("foo") ===== = float("foo") ^ [ -c flag ]:1: fatal: Cannot convert foo to Float ===== CASE: -c = float(len) ===== = float(len) ^~~ [ -c flag ]:1: fatal: float() expected Int, Float, or Str, got BuiltinFunc ===== CASE: -c = float("foo"->startswith) ===== = float("foo"->startswith) ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str OK test-float-convert *** Running test-float-equality ===== CASE: -c var x = 1 pp test_ (42.0 === x) ===== pp test_ (42.0 === x) ^~~ [ -c flag ]:3: fatal: Equality isn't defined on Float values (OILS-ERR-202) ===== CASE: -c pp test_ (2.0 === 1.0) ===== pp test_ (2.0 === 1.0) ^~~ [ -c flag ]:1: fatal: Equality isn't defined on Float values (OILS-ERR-202) OK test-float-equality *** Running test-func-defaults ===== CASE: -c func f(a=ZZ) { echo } ===== func f(a=ZZ) { echo } ^~ [ -c flag ]:1: fatal: Undefined variable 'ZZ' ===== CASE: -c func f(a; named=YY) { echo } ===== func f(a; named=YY) { echo } ^~ [ -c flag ]:1: fatal: Undefined variable 'YY' ===== CASE: -c func f(a=[]) { echo } ===== func f(a=[]) { echo } ^ [ -c flag ]:1: fatal: Default values can't be mutable, got List ===== CASE: -c func f(; d={a:3}) { echo } ===== func f(; d={a:3}) { echo } ^ [ -c flag ]:1: fatal: Default values can't be mutable, got Dict OK test-func-defaults *** Running test-func-error-locs ===== CASE: -c = join(["foo", "bar"], " ", 99) ===== = join(["foo", "bar"], " ", 99) ^~ [ -c flag ]:1: fatal: Expected 2 typed args, but got 3 ===== CASE: -c = int() ===== = int() ^ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c = str({}) ===== = str({}) ^ [ -c flag ]:1: fatal: str() expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c = "foo"->startswith("f", "o") ===== = "foo"->startswith("f", "o") ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str ===== CASE: -c = "foo"->startswith() ===== = "foo"->startswith() ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str ===== CASE: -c = "foo"->startswith(1) ===== = "foo"->startswith(1) ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str ===== CASE: -c func f(x) { return (x) } = f() ===== = f() ^ [ -c flag ]:5: fatal: 'f' wasn't passed typed param 'x' OK test-func-error-locs *** Running test-func-extra ===== CASE: -c func f() { echo "$x $y" } call f(42) # extra pos ===== call f(42) # extra pos ^ [ -c flag ]:5: fatal: Func 'f' takes no positional args, but got 1 ===== CASE: -c func f() { echo "$x $y" } call f(; x=32) # extra named ===== call f(; x=32) # extra named ^ [ -c flag ]:5: fatal: Func 'f' takes no named args, but got 1 OK test-func-extra *** Running test-func-missing ===== CASE: -c func f(x, y) { echo "$x $y" } call f(1) ===== call f(1) ^ [ -c flag ]:5: fatal: 'f' wasn't passed typed param 'y' ===== CASE: -c func f(x, y; z) { echo "$x $y" } call f(3, 4) ===== call f(3, 4) ^ [ -c flag ]:5: fatal: 'f' wasn't passed named param 'z' OK test-func-missing *** Running test-func-passing ===== CASE: -c func f(...rest=3) { return (42) } ===== func f(...rest=3) { ^ [ -c flag ]:2: Syntax error in expression (near Id.Arith_Equal) ===== CASE: -c func f(a, b) { echo "$a -- $b" } = f() ===== = f() ^ [ -c flag ]:5: fatal: 'f' wasn't passed typed param 'a' ===== CASE: -c func f(a, b) { echo "$a -- $b" } = f(...[1, 2]) = f(...3) ===== 1 -- 2 (Null) null = f(...3) ^~~ [ -c flag ]:6: fatal: Spread expected a List, got Int ===== CASE: -c func f(a, ...b) { echo $a - @b - } = f(1, 2, 3) var x = [4, 5, 6] = f(...x) ===== 1 - 2 3 - (Null) null 4 - 5 6 - (Null) null ===== CASE: -c func f(p ; a, b) { echo "$p ; $a $b" } var kwargs = {a: 42, b: 43, c: 44} = f(99; ...kwargs) ===== 99 ; 42 43 (Null) null OK test-func-passing *** Running test-hay ===== CASE: -c hay define package user TASK hay eval :result { package foo { # commands can be run while evaluating oops } bad 2 } ===== oops ^~~~ [ -c flag ]:7: Unknown command 'oops' while running hay [ -c flag ]:7: errexit PID 15466: command.Simple failed with status 127 OK test-hay *** Running test-hay-osh ===== CASE: -c hay define package TASK package foo { version = 1 } ===== version = 1 ^~~~~~~ [ -c flag ]:5: 'version' not found (OILS-ERR-100) } ^ [ -c flag ]:6: Unexpected right brace ===== CASE: -c shopt --set parse_brace hay define package TASK hay eval :result { package foo { version = 1 } } ===== version = 1 ^~~~~~~ [ -c flag ]:8: Unknown command 'version' while running hay OK test-hay-osh *** Running test-int-convert ===== CASE: -c = int({}) ===== = int({}) ^ [ -c flag ]:1: fatal: int() expected Bool, Int, Float, or Str, got Dict ===== CASE: -c = int([]) ===== = int([]) ^ [ -c flag ]:1: fatal: int() expected Bool, Int, Float, or Str, got List ===== CASE: -c = int("foo") ===== = int("foo") ^ [ -c flag ]:1: fatal: Can't convert foo to Int ===== CASE: -c = int(len) ===== = int(len) ^~~ [ -c flag ]:1: fatal: int() expected Bool, Int, Float, or Str, got BuiltinFunc ===== CASE: -c = int("foo" => startsWith) ===== = int("foo" => startsWith) ^~ [ -c flag ]:1: fatal: int() expected Bool, Int, Float, or Str, got BoundFunc ===== CASE: -c = int(NAN) ===== = int(NAN) ^~~ [ -c flag ]:1: fatal: Can't convert float NAN to Int ===== CASE: -c = int(-INFINITY) ===== = int(-INFINITY) ^ [ -c flag ]:1: fatal: Can't convert float -INFINITY to Int OK test-int-convert *** Running test-int-overflow ===== CASE: -c var s = '18446744073709551616'; = s % 2 ===== var s = '18446744073709551616'; = s % 2 ^ [ -c flag ]:1: fatal: Integer too big: 18446744073709551616 ===== CASE: -c var s = '-18446744073709551616'; = s % 2 ===== var s = '-18446744073709551616'; = s % 2 ^ [ -c flag ]:1: fatal: Integer too big: -18446744073709551616 ===== CASE: -c var s = '18446744073709551616'; = s + 1 ===== var s = '18446744073709551616'; = s + 1 ^ [ -c flag ]:1: fatal: Integer too big: 18446744073709551616 ===== CASE: -c var s = '-18446744073709551616'; = s + 1 ===== var s = '-18446744073709551616'; = s + 1 ^ [ -c flag ]:1: fatal: Integer too big: -18446744073709551616 ===== CASE: -c = '18446744073709551616' ~== 42 ===== = '18446744073709551616' ~== 42 ^~~ [ -c flag ]:1: fatal: Integer too big: 18446744073709551616 ===== CASE: -c = '-18446744073709551616' ~== 42 ===== = '-18446744073709551616' ~== 42 ^~~ [ -c flag ]:1: fatal: Integer too big: -18446744073709551616 ===== CASE: -c = int('18446744073709551616') ===== = int('18446744073709551616') ^ [ -c flag ]:1: fatal: Integer too big: 18446744073709551616 ===== CASE: -c = int('-18446744073709551616') ===== = int('-18446744073709551616') ^ [ -c flag ]:1: fatal: Integer too big: -18446744073709551616 OK test-int-overflow *** Running test-json ===== CASE: -c json write ===== json write ^~~~ [ -c flag ]:1: fatal: Expected at least 1 typed args, but only got 0 ===== CASE: -c json write (42, 43) ===== json write (42, 43) ^~ [ -c flag ]:1: fatal: Expected 1 typed args, but got 2 ===== CASE: -c json read zz ===== json read zz ^~ [ -c flag ]:1: 'json' read got too many args json read zz ^~~~ [ -c flag ]:1: errexit PID 15520: command.Simple failed with status 2 ===== CASE: -c json read yy zz ===== json read yy zz ^~ [ -c flag ]:1: 'json' read got too many args json read yy zz ^~~~ [ -c flag ]:1: errexit PID 15522: command.Simple failed with status 2 ===== CASE: -c json read (&x, 43) ===== json read (&x, 43) ^~ [ -c flag ]:1: fatal: Expected 1 typed args, but got 2 OK test-json *** Running test-list-convert ===== CASE: -c = list(1) ===== = list(1) ^ [ -c flag ]:1: fatal: list() expected Dict, List, or Range, got Int ===== CASE: -c = list(len) ===== = list(len) ^~~ [ -c flag ]:1: fatal: list() expected Dict, List, or Range, got BuiltinFunc ===== CASE: -c = list("foo"->startswith) ===== = list("foo"->startswith) ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str OK test-list-convert *** Running test-method-type-errors ===== CASE: -c = "hi" => search(42) ===== = "hi" => search(42) ^ [ -c flag ]:1: fatal: expected Eggex or Str, got Int ===== CASE: -c = "hi" => leftMatch(42) ===== = "hi" => leftMatch(42) ^ [ -c flag ]:1: fatal: expected Eggex or Str, got Int ===== CASE: -c var m = 'hi' => leftMatch(/'hi'/); = m => group(3.14) ===== var m = 'hi' => leftMatch(/'hi'/); = m => group(3.14) ^ [ -c flag ]:1: fatal: expected Int or Str, got Float OK test-method-type-errors *** Running test-module ===== CASE: -c use spec/testdata/module2/util.ysh; util ===== caller_no_leak = null use spec/testdata/module2/util.ysh; util ^~~~ [ -c flag ]:1: 'util' module must be invoked with a proc name argument [ -c flag ]:1: errexit PID 15547: command.Simple failed with status 2 ===== CASE: -c use spec/testdata/module2/util.ysh; util zz ===== caller_no_leak = null use spec/testdata/module2/util.ysh; util zz ^~ [ -c flag ]:1: 'util' module doesn't contain invokable 'zz' [ -c flag ]:1: errexit PID 15549: command.Simple failed with status 2 ===== CASE: -c use spec/testdata/module2/util2.ysh; util2 echo-args ===== use spec/testdata/module2/util2.ysh; util2 echo-args ^~~~~~~~~ [ -c flag ]:1: fatal: proc 'echo-args' wasn't passed word param 'w1' ===== CASE: -c use spec/testdata/module2/util2.ysh; util2 badObj otherproc ===== use spec/testdata/module2/util2.ysh; util2 badObj otherproc ^~~~~~ [ -c flag ]:1: fatal: __invoke__ on 'badObj' should be a user-defined Proc, got BuiltinProc OK test-module *** Running test-no-typed-args ===== CASE: -c echo (42) ===== echo (42) ^ [ -c flag ]:1: 'echo' got unexpected typed args echo (42) ^~~~ [ -c flag ]:1: errexit PID 15558: command.Simple failed with status 2 ===== CASE: -c echo { echo hi } ===== echo { echo hi } ^ [ -c flag ]:1: 'echo' got unexpected typed args echo { echo hi } ^~~~ [ -c flag ]:1: errexit PID 15560: command.Simple failed with status 2 ===== CASE: -c write (42) ===== write (42) ^ [ -c flag ]:1: 'write' got unexpected typed args write (42) ^~~~~ [ -c flag ]:1: errexit PID 15562: command.Simple failed with status 2 ===== CASE: -c true (42) ===== true (42) ^ [ -c flag ]:1: 'true' got unexpected typed args true (42) ^~~~ [ -c flag ]:1: errexit PID 15564: command.Simple failed with status 2 ===== CASE: -c false { echo hi } ===== false { echo hi } ^ [ -c flag ]:1: 'false' got unexpected typed args false { echo hi } ^~~~~ [ -c flag ]:1: errexit PID 15566: command.Simple failed with status 2 ===== CASE: -c test x (42) ===== test x (42) ^ [ -c flag ]:1: 'test' got unexpected typed args test x (42) ^~~~ [ -c flag ]:1: errexit PID 15568: command.Simple failed with status 2 ===== CASE: -c test x { echo hi } ===== test x { echo hi } ^ [ -c flag ]:1: 'test' got unexpected typed args test x { echo hi } ^~~~ [ -c flag ]:1: errexit PID 15570: command.Simple failed with status 2 OK test-no-typed-args *** Running test-obj-methods ===== CASE: -c var o = Object(null, {}); pp test_ (o[1]) ===== var o = Object(null, {}); pp test_ (o[1]) ^ [ -c flag ]:1: fatal: Subscript expected one of (Str List Dict, indexable Obj), got Obj ===== CASE: -c var o = Str; pp test_ (Str[1]) ===== var o = Str; pp test_ (Str[1]) ^ [ -c flag ]:1: fatal: Obj __index__ method expected Obj or List, got Int ===== CASE: -c pp test_ (Bool[Bool]) ===== pp test_ (Bool[Bool]) ^ [ -c flag ]:1: fatal: Obj __index__ method expected 0 params, got 1 ===== CASE: -c pp test_ (Dict[Bool]) ===== pp test_ (Dict[Bool]) ^ [ -c flag ]:1: fatal: Obj __index__ method expected 2 params, got 1 ===== CASE: -c pp test_ (List[Str, Bool]) ===== pp test_ (List[Str, Bool]) ^ [ -c flag ]:1: fatal: Obj __index__ method expected 1 params, got 2 ===== CASE: -c call propView(List)->erase("name"); pp test_ (List[Str]) ===== call propView(List)->erase("name"); pp test_ (List[Str]) ^ [ -c flag ]:1: fatal: Obj __index__ method detected a broken type Obj invariant ===== CASE: -c call propView(Str)->erase("name"); pp test_ (List[Str]) ===== call propView(Str)->erase("name"); pp test_ (List[Str]) ^ [ -c flag ]:1: fatal: Obj __index__ method detected a broken type Obj invariant ===== CASE: -c pp test_ (List[Str, 3]) ===== pp test_ (List[Str, 3]) ^ [ -c flag ]:1: fatal: Obj __index__ method detected a broken type Obj invariant OK test-obj-methods *** Running test-place ===== CASE: -c var a = null var p = &a call p->setValue() # 1 arg ===== call p->setValue() # 1 arg ^ [ -c flag ]:4: fatal: Expected at least 2 typed args, but only got 1 ===== CASE: -c var a = null var p = &a call p->setValue(3, 4) ===== call p->setValue(3, 4) ^ [ -c flag ]:4: fatal: Expected 1 typed args, but got 2 OK test-place *** Running test-pp ===== CASE: -c pp (42/0) ===== pp (42/0) ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c pp [42 /0] ===== pp [42 ^ [ -c flag ]:1: ===== CASE: -c pp [5, 6] ===== pp [5, 6] ^ [ -c flag ]:1: fatal: Expected 1 typed args, but got 2 ===== CASE: -c pp (42) ===== pp (42) ^ [ -c flag ]:1: (Int) 42 ===== CASE: -c var x = 42; pp (x) ===== var x = 42; pp (x) ^ [ -c flag ]:1: (Int) 42 ===== CASE: -c var x = 42; pp [x] ===== pp [x] ^ [ -c flag ]:3: ===== CASE: -c var x = list(1 ..< 50); pp [x] ===== pp [x] ^ [ -c flag ]:3: OK test-pp *** Running test-proc-defaults ===== CASE: -c proc p(word=42) { echo } ===== proc p(word=42) { echo } ^~~~ [ -c flag ]:1: fatal: Default val for word param must be Str, got Int ===== CASE: -c proc p(word=null) { echo } ===== proc p(word=null) { echo } ^~~~ [ -c flag ]:1: fatal: Default val for word param must be Str, got Null ===== CASE: -c proc p( ; ; ; block="str") { echo } ===== proc p( ; ; ; block="str") { echo } ^~~~~ [ -c flag ]:1: fatal: Default value for block should be Command or Null, got Str ===== CASE: -c proc p( ; ; ; block=[]) { echo } ===== proc p( ; ; ; block=[]) { echo } ^~~~~ [ -c flag ]:1: fatal: Default value for block should be Command or Null, got List ===== CASE: -c proc p( ; ; ; block=^(echo hi)) { true } ===== ===== CASE: -c proc p( ; ; ; block=null) { true } ===== ===== CASE: -c proc p(word; t=42/0) { echo } ===== proc p(word; t=42/0) { echo } ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c proc p(word; t=f()) { echo } ===== proc p(word; t=f()) { echo } ^ [ -c flag ]:1: fatal: Undefined variable 'f' ===== CASE: -c proc p(word; t=42; named=undef) { echo } ===== proc p(word; t=42; named=undef) { echo } ^~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' ===== CASE: -c proc p(word; t=42; named=43; block=ZZ) { echo } ===== proc p(word; t=42; named=43; block=ZZ) { echo } ^~ [ -c flag ]:1: fatal: Undefined variable 'ZZ' ===== CASE: -c proc p(word="yo"; t=42; named=43; block=null) { #echo $word $t $named $block echo $word $t $block } p ===== yo 42 null OK test-proc-defaults *** Running test-proc-error-locs ===== CASE: -c var d = [1] func f(a=1, x=d[2]) { echo hi } ===== func f(a=1, x=d[2]) { ^ [ -c flag ]:4: fatal: List index out of range: 2 ===== CASE: -c var d = [1] func f(; n=1, m=d[2]) { echo hi } ===== func f(; n=1, m=d[2]) { ^ [ -c flag ]:4: fatal: List index out of range: 2 OK test-proc-error-locs *** Running test-proc-extra ===== CASE: -c proc myproc () { echo hi } myproc foo ===== myproc foo ^~~~~~ [ -c flag ]:5: fatal: Proc 'myproc' takes no word args, but got 1 ===== CASE: -c proc myproc (w) { echo hi } myproc foo (42) ===== myproc foo (42) ^ [ -c flag ]:5: fatal: Proc 'myproc' takes no typed args, but got 1 ===== CASE: -c proc myproc (w; p) { echo hi } myproc foo (42; named=1) ===== myproc foo (42; named=1) ^ [ -c flag ]:5: fatal: Proc 'myproc' takes no named args, but got 1 ===== CASE: -c proc myproc (w; p; n) { echo hi } myproc foo (42; n=1) { echo hi } ===== myproc foo (42; n=1) { echo hi } ^ [ -c flag ]:5: fatal: Proc 'myproc' doesn't accept a block argument OK test-proc-extra *** Running test-proc-missing ===== CASE: -c proc myproc (w) { = w } myproc ===== myproc ^~~~~~ [ -c flag ]:5: fatal: proc 'myproc' wasn't passed word param 'w' ===== CASE: -c proc myproc (w; t1, t2) { = w = t } myproc foo (42) ===== myproc foo (42) ^ [ -c flag ]:6: fatal: 'myproc' wasn't passed typed param 't2' ===== CASE: -c proc myproc (; p ; a, b) { echo "$p ; $a $b" } myproc (99, b=3) ===== myproc (99, b=3) ^ [ -c flag ]:5: fatal: 'myproc' wasn't passed named param 'a' ===== CASE: -c proc myproc (; p ; a, b) { echo "$p ; $a $b" } myproc (99; b=3) ===== myproc (99; b=3) ^ [ -c flag ]:5: fatal: 'myproc' wasn't passed named param 'a' ===== CASE: -c proc myproc (w; p ; a, b; block) { = block } myproc foo (99, a=1, b=2) ===== myproc foo (99, a=1, b=2) ^ [ -c flag ]:5: fatal: 'myproc' wasn't passed block param 'block' OK test-proc-missing *** Running test-proc-passing ===== CASE: -c proc p(a, b) { echo } p a ===== p a ^ [ -c flag ]:3: fatal: proc 'p' wasn't passed word param 'b' ===== CASE: -c proc p(a, b) { echo } p AA b c DD ===== p AA b c DD ^ [ -c flag ]:3: fatal: proc 'p' takes 2 words, but got 4 ===== CASE: -c proc p( ; a, b) { echo } p (42) ===== p (42) ^ [ -c flag ]:3: fatal: 'p' wasn't passed typed param 'b' ===== CASE: -c proc p( ; a, b) { echo } p (42, 43, 44, 45) ===== p (42, 43, 44, 45) ^ [ -c flag ]:3: fatal: 'p' takes 2 typed args, but got 4 ===== CASE: -c proc p(; a, b) { echo $a - $b - } p (...[1, 2]) p (...3) ===== 1 - 2 - p (...3) ^~~ [ -c flag ]:6: fatal: Spread expected a List, got Int ===== CASE: -c proc p(; a, ...b) { echo $a - @b - } p (1, 2, 3) var x = [4, 5, 6] p (...x) ===== 1 - 2 3 - 4 - 5 6 - ===== CASE: -c proc myproc (; p ; a, b) { echo "$p ; $a $b" } var kwargs = {a: 42, b: 43} myproc (99; ...kwargs) ===== 99 ; 42 43 ===== CASE: -c proc myproc (; p ; a, b, ...named) { = p = a = b = named } var kwargs = {a: 42, b: 43, c:44} myproc (99; ...kwargs) ===== (Int) 99 (Int) 42 (Int) 43 (Dict) {c: 44} OK test-proc-passing *** Running test-read-builtin ===== CASE: -c echo hi | read (&x) ===== echo hi | read (&x) ^ [ -c flag ]:1: 'read' doesn't accept typed args without --all, or --num-bytes echo hi | read (&x) ^~~~ [ -c flag ]:1: errexit PID 15693: command.Simple failed with status 2 echo hi | read (&x) ^~~~ [ -c flag ]:1: errexit PID 15693: command.Pipeline failed with status 2 ===== CASE: -c echo hi | read --all x y ===== echo hi | read --all x y ^ [ -c flag ]:1: 'read' got extra argument echo hi | read --all x y ^~~~ [ -c flag ]:1: errexit PID 15696: command.Simple failed with status 2 echo hi | read --all x y ^~~~ [ -c flag ]:1: errexit PID 15696: command.Pipeline failed with status 2 ===== CASE: -c echo hi | read --line x y ===== echo hi | read --line x y ^~~~~~ [ -c flag ]:1: 'read' got invalid flag '--line' echo hi | read --line x y ^~~~ [ -c flag ]:1: errexit PID 15699: command.Simple failed with status 2 echo hi | read --line x y ^~~~ [ -c flag ]:1: errexit PID 15699: command.Pipeline failed with status 2 OK test-read-builtin *** Running test-remainder ===== CASE: -c = 5 % -3 ===== = 5 % -3 ^ [ -c flag ]:1: fatal: Divisor can't be negative ===== CASE: -c var x = 5; setvar x %= -3 ===== var x = 5; setvar x %= -3 ^~ [ -c flag ]:1: fatal: Divisor can't be negative OK test-remainder *** Running test-required-blocks ===== CASE: -c shvar ===== shvar ^~~~~ [ -c flag ]:1: 'shvar' expected a block arg shvar ^~~~~ [ -c flag ]:1: errexit PID 15712: command.Simple failed with status 2 ===== CASE: -c push-registers ===== push-registers ^~~~~~~~~~~~~~ [ -c flag ]:1: 'push-registers' expected a block arg push-registers ^~~~~~~~~~~~~~ [ -c flag ]:1: errexit PID 15714: command.Simple failed with status 2 ===== CASE: -c redir ===== redir ^~~~~ [ -c flag ]:1: 'redir' expected a block arg redir ^~~~~ [ -c flag ]:1: errexit PID 15716: command.Simple failed with status 2 ===== CASE: -c redir (42) ===== redir (42) ^ [ -c flag ]:1: 'redir' expected a block arg redir (42) ^~~~~ [ -c flag ]:1: errexit PID 15718: command.Simple failed with status 2 ===== CASE: -c hay eval :myvar ===== hay eval :myvar ^~~ [ -c flag ]:1: 'hay' expected a block arg hay eval :myvar ^~~ [ -c flag ]:1: errexit PID 15720: command.Simple failed with status 2 ===== CASE: -c hay eval :myvar (42) ===== hay eval :myvar (42) ^ [ -c flag ]:1: 'hay' expected a block arg hay eval :myvar (42) ^~~ [ -c flag ]:1: errexit PID 15722: command.Simple failed with status 2 ===== CASE: -c try ===== try ^~~ [ -c flag ]:1: 'try' expected a block arg try ^~~ [ -c flag ]:1: errexit PID 15724: command.Simple failed with status 2 ===== CASE: -c ctx push ({}) ===== ctx push ({}) ^ [ -c flag ]:1: 'ctx' expected a block arg ctx push ({}) ^~~ [ -c flag ]:1: errexit PID 15726: command.Simple failed with status 2 ===== CASE: -c fork ===== fork ^~~~ [ -c flag ]:1: 'fork' expected a block arg fork ^~~~ [ -c flag ]:1: errexit PID 15728: command.Simple failed with status 2 ===== CASE: -c forkwait ===== forkwait ^~~~~~~~ [ -c flag ]:1: 'forkwait' expected a block arg forkwait ^~~~~~~~ [ -c flag ]:1: errexit PID 15730: command.Simple failed with status 2 ===== CASE: -c forkwait ( ; ; 42) ===== forkwait ( ; ; 42) ^ [ -c flag ]:1: fatal: Arg 0 should be a CommandFrag, got Int ===== CASE: -c haynode Foo ===== haynode Foo ^~~~~~~ [ -c flag ]:1: 'haynode' expected at least 1 arg, or a literal block { } haynode Foo ^~~~~~~ [ -c flag ]:1: errexit PID 15734: command.Simple failed with status 2 ===== CASE: -c haynode Foo (42) ===== haynode Foo (42) ^~ [ -c flag ]:1: fatal: Expected 0 typed args, but got 1 ===== CASE: -c haynode Foo ( ; ; 42) ===== haynode Foo ( ; ; 42) ^ [ -c flag ]:1: fatal: Arg 0 should be a LiteralBlock, got Int ===== CASE: -c haynode Foo a { echo hi } ===== hi OK test-required-blocks *** Running test-setglobal ===== CASE: -c var a = [0] setglobal a[1-1] = 42 pp test_ (a) ===== (List) [42] ===== CASE: -c var a = [0] setglobal a[a.bad] = 42 pp test_ (a) ===== setglobal a[a.bad] = 42 ^~~ [ -c flag ]:3: fatal: Method 'bad' not found on builtin type List ===== CASE: -c var d = {e:{f:0}} setglobal d.e.f = 42 pp test_ (d) setglobal d.e.f += 1 pp test_ (d) ===== (Dict) {"e":{"f":42}} (Dict) {"e":{"f":43}} OK test-setglobal *** Running test-str-convert ===== CASE: -c = str({}) ===== = str({}) ^ [ -c flag ]:1: fatal: str() expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c = str([]) ===== = str([]) ^ [ -c flag ]:1: fatal: str() got a List, which can't be stringified (OILS-ERR-203) ===== CASE: -c = str(len) ===== = str(len) ^ [ -c flag ]:1: fatal: str() expected one of (Null Bool Int Float Str Eggex), got BuiltinFunc ===== CASE: -c = str("foo"->startswith) ===== = str("foo"->startswith) ^~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/startswith' not found on builtin type Str OK test-str-convert *** Running test-str-replace ===== CASE: -c = "foo" => replace("", "-") ===== (Str) '-f-o-o-' ===== CASE: -c = "foo" => replace("", "-", count=2) ===== (Str) '-f-oo' ===== CASE: -c = "foo" => replace("o", ^"-") ===== (Str) 'f--' ===== CASE: -c = "foo" => replace("o", ^"-$0") ===== (Str) 'f-o-o' ===== CASE: -c = "foo" => replace(/[o]/, ^"-$0") ===== (Str) 'f-o-o' ===== CASE: -c = "foo" => replace(//, ^"-$1") ===== (Str) 'f-o-o' ===== CASE: -c = "foo" => replace(//, ^"-$letter") ===== (Str) 'f-o-o' ===== CASE: -c = "foo" => replace(42, "x") ===== = "foo" => replace(42, "x") ^ [ -c flag ]:1: fatal: expected pattern to be Eggex or Str, got Int ===== CASE: -c = "foo" => replace("x", 42) ===== = "foo" => replace("x", 42) ^ [ -c flag ]:1: fatal: expected substitution to be Str or Expr, got Int ===== CASE: -c = "foo" => replace("x", ^[42]) ===== = "foo" => replace("x", ^[42]) ^ [ -c flag ]:1: fatal: expected expr to eval to a Str, got Int OK test-str-replace *** Running test-trim-utf8-error ===== CASE: -c var badUtf = b'\yF9' # error is missed call " a$[badUtf]b " => trim() echo status=$_status # error is found call "$[badUtf]b " => trim() ===== status=0 call "$[badUtf]b " => trim() ^~ [ -c flag ]:8: fatal: UTF-8 decode: Bad encoding at offset 0 in string of 3 bytes OK test-trim-utf8-error *** Running test-try-usage-error ===== CASE: -c var s = "README" case (s) { README { echo hi } } echo hi try myproc if (_status !== 0) { echo failed } ===== hi hi try myproc ^~~ [ -c flag ]:8: 'try' expected a block arg try myproc ^~~ [ -c flag ]:8: errexit PID 15794: command.Simple failed with status 2 OK test-try-usage-error *** Running test-undefined-vars ===== CASE: -c echo hi; const y = 2 + x + 3 ===== hi echo hi; const y = 2 + x + 3 ^ [ -c flag ]:1: fatal: Undefined variable 'x' ===== CASE: -c if (x) { echo hello } ===== if (x) { echo hello } ^ [ -c flag ]:1: fatal: Undefined variable 'x' ===== CASE: -c if (${x}) { echo hi } ===== if (${x}) { echo hi } ^ [ -c flag ]:1: fatal: Undefined variable 'x' ===== CASE: -c const x = / @undef /; echo hi ===== const x = / @undef /; echo hi ^ [ -c flag ]:1: fatal: Undefined variable 'undef' ===== CASE: -c var x = undef; echo $x ===== var x = undef; echo $x ^~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' ===== CASE: -c setvar a = undef ===== setvar a = undef ^~~~~ [ -c flag ]:1: fatal: Undefined variable 'undef' OK test-undefined-vars *** Running test-user-reported ===== CASE: -c var snippets = [{status: 42}] for snippet in (snippets) { if (len(42)) { echo hi } } ===== if (len(42)) { ^~ [ -c flag ]:4: fatal: len() expected Str, List, or Dict, got Int ===== CASE: -c var count = 0 # The $ causes a weird error while (count < len(count)) { setvar count += 1 } ===== while (count < len(count)) { ^~~~~ [ -c flag ]:5: fatal: len() expected Str, List, or Dict, got Int OK test-user-reported *** Running test-var-decl ===== CASE: -c var x, y = 1, 2, 3 ===== var x, y = 1, 2, 3 ^~~ [ -c flag ]:1: fatal: Got 2 places on the left, but 3 values on right ===== CASE: -c setvar x, y = 1, 2, 3 ===== setvar x, y = 1, 2, 3 ^~~~~~ [ -c flag ]:1: fatal: Got 2 places on the left, but 3 values on the right OK test-var-decl *** Running test-word-eval-with-ysh-data ===== CASE: -c var d = {}; echo ${d:-} ===== var d = {}; echo ${d:-} ^~ [ -c flag ]:1: fatal: Can't substitute into word, got Dict ===== CASE: -c var d = {}; echo ${#d} ===== var d = {}; echo ${#d} ^ [ -c flag ]:1: fatal: Length op expected Str, BashArray, BashAssoc, got Dict ===== CASE: -c var d = {}; echo ${d[0]} ===== var d = {}; echo ${d[0]} ^~ [ -c flag ]:1: fatal: Index op expected BashArray, BashAssoc, got Dict ===== CASE: -c var d = {}; echo ${d[@]:1:3} ===== var d = {}; echo ${d[@]:1:3} ^~ [ -c flag ]:1: fatal: Slice op expected Str or BashArray, got Dict ===== CASE: -c var d = {}; echo ${!d} ===== var d = {}; echo ${!d} ^ [ -c flag ]:1: fatal: Var Ref op expected Str, got Dict ===== CASE: -c var d = {}; echo ${!d[@]} ===== var d = {}; echo ${!d[@]} ^ [ -c flag ]:1: fatal: Keys op expected Str, got Dict ===== CASE: -c var d = {}; echo ${d#prefix} ===== var d = {}; echo ${d#prefix} ^ [ -c flag ]:1: fatal: Unary op expected Str, BashArray, BashAssoc, got Dict ===== CASE: -c var d = {}; echo ${d//a/b} ===== var d = {}; echo ${d//a/b} ^ [ -c flag ]:1: fatal: Pat Sub op expected Str, BashArray, BashAssoc, got Dict OK test-word-eval-with-ysh-data *** Running test-ysh-expr-eval ===== CASE: -c echo $[42 / 0 ] ===== echo $[42 / 0 ] ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c var d = {}; var item = d->nonexistent ===== var d = {}; var item = d->nonexistent ^~~~~~~~~~~ [ -c flag ]:1: fatal: Mutating method 'M/nonexistent' not found on builtin type Dict ===== CASE: -c var d = {}; var item = d["nonexistent"] ===== var d = {}; var item = d["nonexistent"] ^ [ -c flag ]:1: fatal: Dict entry not found: 'nonexistent' ===== CASE: -c var a = []; setvar item = a[1] ===== var a = []; setvar item = a[1] ^ [ -c flag ]:1: fatal: List index out of range: 1 ===== CASE: -c const x = 42 / 0 ===== const x = 42 / 0 ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c var x = "z" ++ $(false) ===== var x = "z" ++ $(false) ^~~~~ [ -c flag ]:1: errexit PID 15865: command.Simple failed with status 1 [ -c flag ]:1: errexit PID 15864: Command Sub exited with status 1 ===== CASE: -c case (42 / 0) { * { echo hi } }; echo OK ===== case (42 / 0) { * { echo hi } }; echo OK ^ [ -c flag ]:1: fatal: Divide by zero ===== CASE: -c var d = {}; for x in $[d->zzz] { echo hi } ===== var d = {}; for x in $[d->zzz] { echo hi } ^~~ [ -c flag ]:1: fatal: Mutating method 'M/zzz' not found on builtin type Dict ===== CASE: -c var d = {}; setvar d[42] = 3 ===== var d = {}; setvar d[42] = 3 ^~~~~~ [ -c flag ]:1: fatal: Dict index should be Str, got Int ===== CASE: -c var L = []; setvar L["key"] = 3 ===== var L = []; setvar L["key"] = 3 ^~~~~~ [ -c flag ]:1: fatal: List index should be Int, got Str ===== CASE: -c var L = []; setvar L[99] = 3 ===== var L = []; setvar L[99] = 3 ^~~~~~ [ -c flag ]:1: fatal: index out of range ===== CASE: -c var L = []; pp (L[-99]) ===== var L = []; pp (L[-99]) ^ [ -c flag ]:1: fatal: List index out of range: -99 OK test-ysh-expr-eval *** Running test-ysh-expr-eval-2 ===== CASE: -c var L = []; var slice = L["foo": "bar"] ===== var L = []; var slice = L["foo": "bar"] ^ [ -c flag ]:1: fatal: Slice begin should be Int, got Str ===== CASE: -c = 3 < true ===== = 3 < true ^ [ -c flag ]:1: fatal: Comparison operator expected numbers, got Int and Bool ===== CASE: -c = "a" < "b" ===== = "a" < "b" ^ [ -c flag ]:1: fatal: Comparison operator expected numbers, got Str and Str ===== CASE: -c var key = 42; var d = {[key]: 3} ===== var key = 42; var d = {[key]: 3} ^ [ -c flag ]:1: fatal: Dict keys must be strings, got Int ===== CASE: -c var d = {}; var a = d.a ===== var d = {}; var a = d.a ^ [ -c flag ]:1: fatal: Dict entry 'a' not found ===== CASE: -c var d = []; var a = d.a ===== var d = []; var a = d.a ^ [ -c flag ]:1: fatal: Method 'a' not found on builtin type List ===== CASE: -c = 3 ** -2 ===== = 3 ** -2 ^~ [ -c flag ]:1: fatal: Exponent can't be a negative number ===== CASE: -c = 3.2 ** 2 ===== = 3.2 ** 2 ^~ [ -c flag ]:1: fatal: Left operand should be Int, got Float ===== CASE: -c = - "foo" ===== = - "foo" ^ [ -c flag ]:1: fatal: Negation expected Int or Float, got Str OK test-ysh-expr-eval-2 *** Running test-ysh-word-eval ===== CASE: -c echo $[maybe("foo")] ===== echo $[maybe("foo")] ^~ [ -c flag ]:1: fatal: Expr sub got a List, which can't be stringified (OILS-ERR-203) ===== CASE: -c source $LIB_YSH/math.ysh; echo $[identity({key: "val"})] ===== source $LIB_YSH/math.ysh; echo $[identity({key: "val"})] ^~ [ -c flag ]:1: fatal: Expr sub expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c source $LIB_YSH/math.ysh; write -- @[identity([{key: "val"}])] ===== source $LIB_YSH/math.ysh; write -- @[identity([{key: "val"}])] ^~ [ -c flag ]:1: fatal: Expr splice expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c var x = [1, 2]; write @x ===== 1 2 ===== CASE: -c var x = [3, {}]; write @x ===== var x = [3, {}]; write @x ^~ [ -c flag ]:1: fatal: Splice expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c var x = [3, {}]; write @[x] ===== var x = [3, {}]; write @[x] ^~ [ -c flag ]:1: fatal: Expr splice expected one of (Null Bool Int Float Str Eggex), got Dict ===== CASE: -c var x = /d+/; write @x ===== var x = /d+/; write @x ^~ [ -c flag ]:1: fatal: Splice expected List, got Eggex ===== CASE: -c var x = /d+/; write @[x] ===== var x = /d+/; write @[x] ^~ [ -c flag ]:1: fatal: Expr splice expected List, got Eggex OK test-ysh-word-eval test/ysh-runtime-errors.sh: 55 tests passed.