Permalink
Browse files

Merge branch 'master' into dev/oil-4

  • Loading branch information...
Andy Chu
Andy Chu committed Jul 2, 2018
2 parents 0fede0d + 71cb657 commit 676f9883ae2986e48a997353ac35c9dc3ed99c97
Showing with 2,776 additions and 2,776 deletions.
  1. +15 −15 spec/alias.test.sh
  2. +34 −34 spec/append.test.sh
  3. +37 −37 spec/arith-context.test.sh
  4. +156 −156 spec/arith.test.sh
  5. +14 −14 spec/array-compat.test.sh
  6. +159 −159 spec/array.test.sh
  7. +53 −53 spec/assign.test.sh
  8. +13 −13 spec/assoc-zsh.test.sh
  9. +27 −27 spec/assoc.test.sh
  10. +39 −39 spec/background.test.sh
  11. +12 −12 spec/blog-other1.test.sh
  12. +30 −30 spec/blog1.test.sh
  13. +22 −22 spec/blog2.test.sh
  14. +116 −116 spec/brace-expansion.test.sh
  15. +4 −4 spec/bugs.test.sh
  16. +14 −14 spec/builtin-bash.test.sh
  17. +21 −21 spec/builtin-dirs.test.sh
  18. +13 −13 spec/builtin-eval-source.test.sh
  19. +34 −34 spec/builtin-getopts.test.sh
  20. +112 −112 spec/builtin-io.test.sh
  21. +65 −65 spec/builtin-test.test.sh
  22. +12 −12 spec/builtin-trap.test.sh
  23. +71 −71 spec/builtin-vars.test.sh
  24. +16 −16 spec/builtins-special.test.sh
  25. +76 −76 spec/builtins.test.sh
  26. +2 −2 spec/builtins2.test.sh
  27. +22 −22 spec/case_.test.sh
  28. +21 −21 spec/command-parsing.test.sh
  29. +32 −32 spec/command-sub.test.sh
  30. +1 −1 spec/command_.test.sh
  31. +4 −4 spec/comments.test.sh
  32. +96 −96 spec/dbracket.test.sh
  33. +13 −13 spec/dparen.test.sh
  34. +12 −12 spec/empty-bodies.test.sh
  35. +11 −11 spec/errexit-strict.test.sh
  36. +51 −51 spec/errexit.test.sh
  37. +4 −4 spec/explore-parsing.test.sh
  38. +58 −58 spec/extended-glob.test.sh
  39. +3 −3 spec/for-expr.test.sh
  40. +45 −45 spec/func-parsing.test.sh
  41. +17 −17 spec/func.test.sh
  42. +77 −77 spec/glob.test.sh
  43. +61 −61 spec/here-doc.test.sh
  44. +23 −23 spec/if_.test.sh
  45. +5 −5 spec/introspect.test.sh
  46. +9 −9 spec/let.test.sh
  47. +30 −30 spec/loop.test.sh
  48. +6 −6 spec/osh-only.test.sh
  49. +64 −64 spec/parse-errors.test.sh
  50. +55 −55 spec/pipeline.test.sh
  51. +32 −32 spec/posix.test.sh
  52. +3 −3 spec/process-sub.test.sh
  53. +72 −72 spec/quote.test.sh
  54. +99 −99 spec/redirect.test.sh
  55. +49 −49 spec/regex.test.sh
  56. +96 −96 spec/sh-options.test.sh
  57. +43 −43 spec/shell-grammar.test.sh
  58. +35 −35 spec/smoke.test.sh
  59. +34 −34 spec/special-vars.test.sh
  60. +7 −7 spec/strict-options.test.sh
  61. +3 −3 spec/subshell.test.sh
  62. +13 −13 spec/tilde.test.sh
  63. +8 −8 spec/type-compat.test.sh
  64. +14 −14 spec/var-num.test.sh
  65. +85 −85 spec/var-op-other.test.sh
  66. +37 −37 spec/var-op-strip.test.sh
  67. +32 −32 spec/var-op-test.test.sh
  68. +22 −22 spec/var-ref.test.sh
  69. +73 −73 spec/var-sub-quote.test.sh
  70. +25 −25 spec/var-sub.test.sh
  71. +20 −20 spec/word-eval.test.sh
  72. +50 −50 spec/word-split.test.sh
  73. +21 −21 spec/xtrace.test.sh
  74. +4 −4 test/sh_spec.py
  75. +12 −12 test/sh_spec_test.py
View
@@ -6,7 +6,7 @@
#
# Bash is the only one that doesn't support aliases!
### basic alias
#### basic alias
shopt -s expand_aliases # bash requires this
alias hi='echo hello world'
hi
@@ -16,7 +16,7 @@ hello world
hi
## END
### alias with trailing space causes second alias expansion
#### alias with trailing space causes second alias expansion
shopt -s expand_aliases # bash requires this
alias hi='echo hello world '
@@ -33,7 +33,7 @@ hello world !!!
hello world punct
## END
### iterative alias expansion of first word
#### iterative alias expansion of first word
shopt -s expand_aliases # bash requires this
alias hi='echo hello world'
alias echo='echo --; echo '
@@ -44,7 +44,7 @@ hello world
## END
### expansion of alias with value
#### expansion of alias with value
shopt -s expand_aliases # bash requires this
x=x
alias echo-x='echo $x' # nothing is evaluated here
@@ -55,7 +55,7 @@ y hi
## END
### first and second word are the same
#### first and second word are the same
shopt -s expand_aliases # bash requires this
x=x
alias echo-x='echo $x' # nothing is evaluated here
@@ -67,7 +67,7 @@ x echo-x
x echo x
## END
### first and second word are the same with trailing space
#### first and second word are the same with trailing space
shopt -s expand_aliases # bash requires this
x=x
alias echo-x='echo $x ' # nothing is evaluated here
@@ -76,7 +76,7 @@ echo-x echo-x
x echo x
## END
### defining multiple aliases, then unalias
#### defining multiple aliases, then unalias
shopt -s expand_aliases # bash requires this
x=x
y=y
@@ -94,22 +94,22 @@ undefined
## END
### Invalid syntax of alias
#### Invalid syntax of alias
shopt -s expand_aliases # bash requires this
alias e= 'echo --; echo' # bad space here
e x
alias echo_alias_= 'echo --; echo' # bad space here
echo_alias_ x
## status: 127
### Dynamic alias definition
#### Dynamic alias definition
shopt -s expand_aliases # bash requires this
x=x
name='e'
name='echo_alias_'
val='=echo'
alias "$name$val"
e X
echo_alias_ X
## stdout: X
### Alias detection happens before expansion
#### Alias detection happens before expansion
shopt -s expand_aliases # bash requires this
alias echo_alias_='echo'
cmd=echo_alias_
@@ -121,7 +121,7 @@ X
status=127
## END
### Alias name with punctuation
#### Alias name with punctuation
# NOTE: / is not OK in bash, but OK in other shells. Must less restrictive
# than var names.
shopt -s expand_aliases # bash requires this
View
@@ -1,68 +1,68 @@
#!/usr/bin/env bash
### Append string to string
#### Append string to string
s='abc'
s+=d
echo $s
# stdout: abcd
## stdout: abcd
### Append array to array
#### Append array to array
a=(x y )
a+=(t 'u v')
argv.py "${a[@]}"
# stdout: ['x', 'y', 't', 'u v']
## stdout: ['x', 'y', 't', 'u v']
### Append array to string should be an error
#### Append array to string should be an error
s='abc'
s+=(d e f)
echo $s
# BUG bash/mksh stdout: abc
# BUG bash/mksh status: 0
# status: 1
## BUG bash/mksh stdout: abc
## BUG bash/mksh status: 0
## status: 1
### Append string to array should be disallowed
#### Append string to array should be disallowed
# They treat this as implicit index 0. We disallow this on the LHS, so we will
# also disallow it on the RHS.
a=(x y )
a+=z
argv.py "${a[@]}"
# OK bash/mksh stdout: ['xz', 'y']
# OK bash/mksh status: 0
# status: 1
## OK bash/mksh stdout: ['xz', 'y']
## OK bash/mksh status: 0
## status: 1
### Append string to array element
#### Append string to array element
# They treat this as implicit index 0. We disallow this on the LHS, so we will
# also disallow it on the RHS.
a=(x y )
a[1]+=z
argv.py "${a[@]}"
# stdout: ['x', 'yz']
# status: 0
## stdout: ['x', 'yz']
## status: 0
### Append to last element
#### Append to last element
# Works in bash, but not mksh. It seems like bash is doing the right thing.
# a[-1] is allowed on the LHS. mksh doesn't have negative indexing?
a=(1 '2 3')
a[-1]+=' 4'
argv.py "${a[@]}"
# stdout: ['1', '2 3 4']
# BUG mksh stdout: ['1', '2 3', ' 4']
## stdout: ['1', '2 3 4']
## BUG mksh stdout: ['1', '2 3', ' 4']
### Try to append list to element
#### Try to append list to element
# bash - cannot assign list to array number
# mksh - a[-1]+: is not an identifier
a=(1 '2 3')
a[-1]+=(4 5)
# status: 1
## status: 1
### Strings have value semantics, not reference semantics
#### Strings have value semantics, not reference semantics
s1='abc'
s2=$s1
s1+='d'
echo $s1 $s2
# stdout: abcd abc
## stdout: abcd abc
### Append to nonexistent string
#### Append to nonexistent string
f() {
local a+=a
echo $a
@@ -85,9 +85,9 @@ f() {
#echo $e
}
f
# stdout-json: "a\nb\nc\nd\ne\n"
## stdout-json: "a\nb\nc\nd\ne\n"
### Append to nonexistent array
#### Append to nonexistent array
f() {
# NOTE: mksh doesn't like a=() after keyword. Doesn't allow local arrays!
local x+=(a b)
@@ -100,16 +100,16 @@ f() {
argv.py "${z[@]}"
}
f
# stdout-json: "['a', 'b']\n['c', 'd']\n['e', 'f']\n"
# N-I mksh stdout-json: ""
# N-I mksh status: 1
## stdout-json: "['a', 'b']\n['c', 'd']\n['e', 'f']\n"
## N-I mksh stdout-json: ""
## N-I mksh status: 1
### Append used like env prefix is a parse error
#### Append used like env prefix is a parse error
# This should be an error in other shells but it's not.
A=a
A+=a printenv.py A
# status: 2
# BUG bash stdout: aa
# BUG bash status: 0
# BUG mksh stdout: a
# BUG mksh status: 0
## status: 2
## BUG bash stdout: aa
## BUG bash status: 0
## BUG mksh stdout: a
## BUG mksh status: 0
View
@@ -8,85 +8,85 @@
# ${a : 1+2 : 1+2}
# a[1 + 2]=foo
### Multiple right brackets inside expression
#### Multiple right brackets inside expression
a=(1 2 3)
echo ${a[a[0]]} ${a[a[a[0]]]}
# stdout: 2 3
# N-I zsh status: 0
# N-I zsh stdout-json: "\n"
## stdout: 2 3
## N-I zsh status: 0
## N-I zsh stdout-json: "\n"
### Slicing of string with constants
#### Slicing of string with constants
s='abcd'
echo ${s:0} ${s:0:4} ${s:1:1}
# stdout: abcd abcd b
## stdout: abcd abcd b
### Slicing of string with variables
#### Slicing of string with variables
s='abcd'
zero=0
one=1
echo ${s:$zero} ${s:$zero:4} ${s:$one:$one}
# stdout: abcd abcd b
## stdout: abcd abcd b
### Array index on LHS of assignment
#### Array index on LHS of assignment
a=(1 2 3)
zero=0
a[zero+5-4]=X
echo ${a[@]}
# stdout: 1 X 3
# OK zsh stdout: X 2 3
## stdout: 1 X 3
## OK zsh stdout: X 2 3
### Array index on LHS with spaces
#### Array index on LHS with spaces
# zsh fails to parse this because of the spaces.
a=(1 2 3)
zero=0
a[zero + 5 - 4]=X
echo ${a[@]}
# stdout: 1 X 3
# BUG zsh stdout-json: ""
# BUG zsh status: 1
## stdout: 1 X 3
## BUG zsh stdout-json: ""
## BUG zsh status: 1
### Array index on LHS with indices
#### Array index on LHS with indices
a=(1 2 3)
a[a[1]]=X
echo ${a[@]}
# stdout: 1 2 X
# OK zsh stdout: X 2 3
## stdout: 1 2 X
## OK zsh stdout: X 2 3
### Slicing of string with expressions
#### Slicing of string with expressions
# mksh accepts ${s:0} and ${s:$zero} but not ${s:zero}
# zsh says unrecognized modifier 'z'
s='abcd'
zero=0
echo ${s:zero} ${s:zero+0} ${s:zero+1:zero+1}
# stdout: abcd abcd b
# BUG mksh stdout-json: ""
# BUG mksh status: 1
# BUG zsh stdout-json: ""
# BUG zsh status: 1
## stdout: abcd abcd b
## BUG mksh stdout-json: ""
## BUG mksh status: 1
## BUG zsh stdout-json: ""
## BUG zsh status: 1
### Ambiguous colon in slice
#### Ambiguous colon in slice
s='abcd'
echo $(( 0 < 1 ? 2 : 0 )) # evalutes to 2
echo ${s: 0 < 1 ? 2 : 0 : 1} # 2:1 -- TRICKY THREE COLONS
# stdout-json: "2\nc\n"
# BUG mksh stdout-json: "2\n"
# BUG mksh status: 1
# BUG zsh stdout-json: "2\n"
# BUG zsh status: 1
## stdout-json: "2\nc\n"
## BUG mksh stdout-json: "2\n"
## BUG mksh status: 1
## BUG zsh stdout-json: "2\n"
## BUG zsh status: 1
### Triple parens should be disambiguated
#### Triple parens should be disambiguated
# The first paren is part of the math, parens 2 and 3 are a single token ending
# arith sub.
((a=1 + (2*3)))
echo $a $((1 + (2*3)))
# stdout: 7 7
## stdout: 7 7
### Quadruple parens should be disambiguated
#### Quadruple parens should be disambiguated
((a=1 + (2 * (3+4))))
echo $a $((1 + (2 * (3+4))))
# stdout: 15 15
## stdout: 15 15
### Alternative $[] syntax
#### Alternative $[] syntax
echo $[1 + 2] "$[3 * 4]"
# stdout: 3 12
# N-I mksh stdout: $[1 + 2] $[3 * 4]
## stdout: 3 12
## N-I mksh stdout: $[1 + 2] $[3 * 4]
Oops, something went wrong.

0 comments on commit 676f988

Please sign in to comment.