arith.t

来自「一个开放源代码的 AT&T 的 Korn Shell 的复制品, 支持大多数 k」· T 代码 · 共 80 行

T
80
字号
name: arith-lazy-1description:	Check that only one side of ternary operator is evaluatedstdin:	x=i+=2	y=j+=2	typeset -i i=1 j=1	echo $((1 ? 20 : (x+=2)))	echo $i,$x	echo $((0 ? (y+=2) : 30))	echo $j,$yexpected-stdout:	20	1,i+=2	30	1,j+=2---name: arith-lazy-2description:	Check that assignments not done on non-evaluated side of ternary	operatorstdin:	x=i+=2	y=j+=2	typeset -i i=1 j=1	echo $((1 ? 20 : (x+=2)))	echo $i,$x	echo $((0 ? (y+=2) : 30))	echo $i,$yexpected-stdout:	20	1,i+=2	30	1,j+=2---name: arith-ternary-prec-1description:	Check precidance of ternary operator vs assignmentstdin:	typeset -i x=2	y=$((1 ? 20 : x+=2))expected-exit: e != 0expected-stderr-pattern:	/.*:.*1 \? 20 : x\+=2.*lvalue.*\n$/---name: arith-ternary-prec-2description:	Check precidance of ternary operator vs assignmentstdin:	typeset -i x=2	echo $((0 ? x+=2 : 20))expected-stdout:	20---name: arith-div-assoc-1description:	Check associativity of division operatorstdin:	echo $((20 / 2 / 2))expected-stdout:	5---name: arith-assop-assoc-1description:	Check associativity of assignment-operator operatorstdin:	typeset -i i=1 j=2 k=3	echo $((i += j += k))	echo $i,$j,$kexpected-stdout:	6	6,5,3---

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?