1name: arith-lazy-1 2description: 3 Check that only one side of ternary operator is evaluated 4stdin: 5 x=i+=2 6 y=j+=2 7 typeset -i i=1 j=1 8 echo $((1 ? 20 : (x+=2))) 9 echo $i,$x 10 echo $((0 ? (y+=2) : 30)) 11 echo $j,$y 12expected-stdout: 13 20 14 1,i+=2 15 30 16 1,j+=2 17--- 18 19name: arith-lazy-2 20description: 21 Check that assignments not done on non-evaluated side of ternary 22 operator 23stdin: 24 x=i+=2 25 y=j+=2 26 typeset -i i=1 j=1 27 echo $((1 ? 20 : (x+=2))) 28 echo $i,$x 29 echo $((0 ? (y+=2) : 30)) 30 echo $i,$y 31expected-stdout: 32 20 33 1,i+=2 34 30 35 1,j+=2 36--- 37 38name: arith-ternary-prec-1 39description: 40 Check precidance of ternary operator vs assignment 41stdin: 42 typeset -i x=2 43 y=$((1 ? 20 : x+=2)) 44expected-exit: e != 0 45expected-stderr-pattern: 46 /.*:.*1 \? 20 : x\+=2.*lvalue.*\n$/ 47--- 48 49name: arith-ternary-prec-2 50description: 51 Check precidance of ternary operator vs assignment 52stdin: 53 typeset -i x=2 54 echo $((0 ? x+=2 : 20)) 55expected-stdout: 56 20 57--- 58 59name: arith-div-assoc-1 60description: 61 Check associativity of division operator 62stdin: 63 echo $((20 / 2 / 2)) 64expected-stdout: 65 5 66--- 67 68name: arith-assop-assoc-1 69description: 70 Check associativity of assignment-operator operator 71stdin: 72 typeset -i i=1 j=2 k=3 73 echo $((i += j += k)) 74 echo $i,$j,$k 75expected-stdout: 76 6 77 6,5,3 78--- 79 80