Skip to content

Commit

Permalink
[spec/assoc] Tighten spec, now that we have EvalWordToString.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Jul 14, 2019
1 parent 3a57094 commit 1bafc7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion spec/assoc.test.sh
Expand Up @@ -214,7 +214,7 @@ echo "${a[a+1]}"
## BUG bash stdout: c
## BUG bash status: 0

#### lookup by unquoted string as arithmetic
#### bash bug: "i+1" and i+1 are the same key

i=1
array=(5 6 7)
Expand All @@ -235,9 +235,15 @@ echo assoc[i+1]="${assoc[i+1]}"
echo assoc[i]="${assoc["i"]}"
echo assoc[i+1]="${assoc["i+1"]}"

## status: 1
## STDOUT:
array[i]=6
array[i+1]=7
## END
## BUG bash status: 0
## BUG bash STDOUT:
array[i]=6
array[i+1]=7
assoc[i]=string
assoc[i+1]=string+1
assoc[i]=string
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 5 \
$BASH $OSH_LIST "$@"
}

Expand Down

0 comments on commit 1bafc7a

Please sign in to comment.