Skip to content

Commit

Permalink
[spec/var-op-test] Split test case #29
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jan 3, 2025
1 parent 228ea80 commit 361ac8c
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions spec/var-op-test.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,44 @@ a[*]: '' 'with-colon'
## END:
#### op-test for ${!array} with array="a[@]" or array="a[*]"
#### op-test for ${!array} with array="a" and array="a[1]"
case $SH in dash|mksh|zsh) exit ;; esac
test-hyphen() {
ref='a'
echo "ref=a : '${!ref-no-colon}' '${!ref:-with-colon}'"
ref='a[0]'
echo "ref=a[0]: '${!ref-no-colon}' '${!ref:-with-colon}'"
}
a=()
test-hyphen
a=("")
test-hyphen
a=("" "")
test-hyphen
IFS=
test-hyphen
## STDOUT:
ref=a : 'no-colon' 'with-colon'
ref=a[0]: 'no-colon' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
## END
## N-I dash/mksh/zsh STDOUT:
## END:
#### op-test for ${!array} with array="a[@]" or array="a[*]"
case $SH in dash|mksh|zsh) exit ;; esac
test-hyphen() {
ref='a[@]'
echo "ref=a[@]: '${!ref-no-colon}' '${!ref:-with-colon}'"
ref='a[*]'
Expand All @@ -652,39 +682,23 @@ IFS=
test-hyphen
## STDOUT:
ref=a : 'no-colon' 'with-colon'
ref=a[0]: 'no-colon' 'with-colon'
ref=a[@]: 'no-colon' 'with-colon'
ref=a[*]: 'no-colon' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: '' 'with-colon'
ref=a[*]: '' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: ' ' ' '
ref=a[*]: ' ' ' '
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: ' ' ' '
ref=a[*]: '' 'with-colon'
## END
## BUG bash STDOUT:
ref=a : 'no-colon' 'with-colon'
ref=a[0]: 'no-colon' 'with-colon'
ref=a[@]: 'no-colon' 'with-colon'
ref=a[*]: 'no-colon' 'with-colon'
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: '' ''
ref=a[*]: '' ''
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: ' ' ' '
ref=a[*]: ' ' ' '
ref=a : '' 'with-colon'
ref=a[0]: '' 'with-colon'
ref=a[@]: ' ' ' '
ref=a[*]: '' ''
## END
Expand Down

0 comments on commit 361ac8c

Please sign in to comment.