shelly-shell 0.5.4

A Rust based Unix style shell with a typed and structured language syntax.
check_repl ["id": "LET-DESTRUCTURE", "name": "Destructuring declarations across submissions",
"steps": [
    ['let ($x, $y) = [22,44]; echo $x $y', "output", "22 44"],
    ['let ($x, $y) = [1]', "error", "Array destructuring expected 2 elements, got 1"],
    ['echo $x $y', "output", "22 44"],
    ['let ($x, $y) = [1,2,3]', "error", "Array destructuring expected 2 elements, got 3"],
    ['echo $x $y', "output", "22 44"],
    ['let ($x, $new) = 3', "error", "Array destructuring requires an array"],
    ['echo $x $y', "output", "22 44"],
    ['echo $new', "error", "not found"],
    ['let ($x, $y) = [1 / 0, 2]', "error", "Division or remainder by zero"],
    ['echo $x $y', "output", "22 44"],
    ['let ($x, $x) = [1,2]', "error", "Duplicate destructuring binding"],
    ['let (_, $word) = [1, "hi"]; echo $word', "output", "hi"],
    ['let ($single,) = [7]; echo $single', "output", "7"],
    ['fn reader(): String { $word }; echo (reader)', "output", "hi"],
    ['let ($x, $y) = [$y, $x]; echo $x $y', "output", "44 22"],
    ['{ let ($x, $y) = [1,2]; echo $x $y }; echo $x $y', "output", "1 2\n44 22"],
    ['let $pair: [String, Integer] = ["s", 9]; let ($name, $count) = $pair', "quiet", ""],
    ['let $bad: String = $count', "error", "Expected String, got Integer"],
    ['echo $name $count', "output", "s 9"],
], "exit": 0]