diff --git a/brush-core/src/arithmetic.rs b/brush-core/src/arithmetic.rs index ae92d7c5..c13257a4 100644 --- a/brush-core/src/arithmetic.rs +++ b/brush-core/src/arithmetic.rs @@ -157,8 +157,10 @@ fn deref_lvalue(shell: &mut Shell, lvalue: &ast::ArithmeticTarget) -> Result $((x))" echo "x + 1 => $((x+1))" + y= + echo "y => $((y))" + echo "y + 1 => $((y+1))" + + z=notnumber + echo "z => $((z))" + echo "z + 1 => $((z+1))" + + - name: "Complex variable references" + stdin: | + x=10 + y=20 + z=x+y + a=z+z + + echo "z => $((z))" + echo "a => $((a))" + - name: "Nested expressions" stdin: | echo "1: $(($(echo -n 1; echo 2) + 37))" @@ -119,6 +136,12 @@ cases: echo "--x == $((--x))" echo "x is now $x" + - name: "Assignment with references" + stdin: | + x=10+3 + echo "y = x => $((y = x))" + echo "y is now $y" + - name: "Assignments in logical boolean expressions" known_failure: false stdin: |