Merge nucleic/sleek-thistle-egret-fyej into dev
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
name: "Variable tests"
|
||||
cases:
|
||||
- name: "Appending to a variable"
|
||||
stdin: |
|
||||
x=something
|
||||
x+=here
|
||||
echo "x: ${x}"
|
||||
|
||||
- name: "Appending an integer to an integer variable"
|
||||
stdin: |
|
||||
declare -i x=10
|
||||
echo "x: ${x}"
|
||||
x+=5
|
||||
echo "x: ${x}"
|
||||
x+=value
|
||||
echo "x: ${x}"
|
||||
|
||||
y=value
|
||||
declare -i y
|
||||
echo "y: ${y}"
|
||||
y+=5
|
||||
echo "y: ${y}"
|
||||
|
||||
- name: "Append to an unset variable"
|
||||
stdin: |
|
||||
declare -a myvar
|
||||
myvar+=abc
|
||||
echo "myvar: ${myvar}"
|
||||
|
||||
declare -i myint
|
||||
myint+=abc
|
||||
echo "myint: ${myint}"
|
||||
|
||||
- name: "Parameter length of unset variable with nounset"
|
||||
ignore_stderr: true
|
||||
stdin: |
|
||||
set -u
|
||||
echo "${#unset_var}" 2>&1 || true
|
||||
arr=()
|
||||
echo "${#arr[0]}"
|
||||
echo "${#arr[@]}"
|
||||
arr2=(hello world)
|
||||
echo "${#arr2[5]}"
|
||||
echo "${#arr2[0]}"
|
||||
Reference in New Issue
Block a user