patch 9.0.1647: insufficient testing for syntax plugins
Problem: Insufficient testing for syntax plugins.
Solution: Add shell file examples. (Charles Campbell) Create a messages
file for easier debugging and reporting the test results.
This commit is contained in:
33
runtime/syntax/testdir/input/sh_03.sh
Normal file
33
runtime/syntax/testdir/input/sh_03.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/ksh
|
||||
# Test variable modifiers
|
||||
# Variable=value
|
||||
Variable='value'
|
||||
Variable="value"
|
||||
VariableA="pat1xxpat2"
|
||||
VariableB="pat2xxpat1"
|
||||
echo ${#}
|
||||
echo ${#VariableA}
|
||||
echo ${VariableA#pat1}
|
||||
echo ${VariableA##pat1}
|
||||
echo ${VariableB%pat1}
|
||||
echo ${VariableB%%pat1}
|
||||
|
||||
# This gets marked as an error
|
||||
Variable=${VariableB:+${VariableC:=eng}} # :+ seems to work for ksh as well as bash
|
||||
Variable=${VariableB:-${VariableC:-eng}} # :- is ksh and bash
|
||||
|
||||
# This is OK
|
||||
Variable='${VariableB:+${VariableC:=eng}}'
|
||||
Variable='${VariableB:-${VariableC:-eng}}'
|
||||
Variable="${VariableB:+${VariableC:=eng}}" # :+ seems to work for ksh as well as bash
|
||||
Variable="${VariableB:-${VariableC:-eng}}" # :- is ksh and bash
|
||||
|
||||
# These are OK
|
||||
: ${VariableB:-${VariableC:-eng}}
|
||||
: "${VariableB:-${VariableC:-eng}}"
|
||||
: '${VariableB:-${VariableC:-eng}}'
|
||||
|
||||
# Another test
|
||||
Variable=${VariableB:-${VariableC:-${VariableD:-${VariableE:=eng}}}}
|
||||
: ${VariableB:=${VariableC:-${VariableD:-${VariableE:=eng}}}}
|
||||
|
||||
Reference in New Issue
Block a user