Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Jul 14, 2019
1 parent 495cbac commit 128c910
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions spec/assoc.test.sh
Expand Up @@ -44,6 +44,20 @@ argv.py "${!assoc[@]}"
[]
## END

#### Can't initialize assoc array with indexed array
declare -A A=(1 2 3)
## status: 1
## BUG bash status: 0

#### Initializing indexed array with with assoc array drops the constants
declare -a a=([xx]=1 [yy]=2 [zz]=3)
#declare -a a=(1 2 3)
echo "${a[@]}"
## stdout-json: ""
## BUG bash STDOUT:
3
## END

#### create empty assoc array, put, then get
declare -A A # still undefined
argv.py "${A[@]}"
Expand Down Expand Up @@ -255,19 +269,6 @@ foo
42
##
#### Can't initialize assoc array with indexed array
declare -A A=(1 2 3)
## status: 1
## BUG bash status: 0
#### Initializing indexed array with with assoc array drops the constants
declare -a a=([xx]=1 [yy]=2 [zz]=3)
#declare -a a=(1 2 3)
echo "${a[@]}"
#echo "${!a[@]}"
## N-I mksh stdout-json: ""
## BUG bash stdout-json: "3\n"
#### Append to associative array value A['x']+='suffix'
declare -A A
A['x']='foo'
Expand Down
2 changes: 1 addition & 1 deletion test/spec.sh
Expand Up @@ -575,7 +575,7 @@ append() {

# associative array -- mksh and zsh implement different associative arrays.
assoc() {
sh-spec spec/assoc.test.sh --osh-failures-allowed 6 \
sh-spec spec/assoc.test.sh --osh-failures-allowed 7 \
$BASH $OSH_LIST "$@"
}

Expand Down

0 comments on commit 128c910

Please sign in to comment.