Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff tests/farray-array.t @ 635:2d0201f54870
farray.sh: Also provide a strict posixly correct quoting alternative.
Because $'...' is not a POSIX standard supply now the possibility to encode
using just single quotes (without dollar): this is posixly correct.
More quoting tests.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 26 Sep 2024 11:58:44 +0200 |
| parents | 618f8e72e5e6 |
| children | 57ee25cec0dd |
line wrap: on
line diff
--- a/tests/farray-array.t Wed Sep 25 21:04:19 2024 +0200 +++ b/tests/farray-array.t Thu Sep 26 11:58:44 2024 +0200 @@ -906,15 +906,30 @@ $ check_no_array_artifacts -Eval -==== +Eval / Quoting +============== - $ _var=$'" 678" \\\'910 ' - $ eval _evar="\$(_farr_quote_for_eval \"\${_var}\")" +# Use Dollar-Single-Quotes + $ _var1=$'" 678" \\\'910 ' +# Use just Single-Quotes + $ _var2='" 678" \'\''910 ' +# Use a Double-Quotes to insert a single quote + $ _var3='" 678" \'"'"'910 ' + $ test "${_var1}" = "${_var2}" + $ test "${_var1}" = "${_var3}" + $ eval _evar="\$(_farr_quote_for_eval \"\${_var1}\")" $ eval printf '%s' "${_evar}" " 678" \'910 (no-eol) - $ _var=$'" 678" \\\'910\t\'' - $ eval _evar="\$(_farr_quote_for_eval \"\${_var}\")" + $ _var1=$'" 678" \\\'910\t\'' + $ _var2='" 678" \'\''910 '\''' + $ _var3='" 678" \'"'"'910 '"'"'' + $ test "${_var1}" = "${_var2}" + $ test "${_var1}" = "${_var3}" + $ eval _evar="\$(_farr_quote_for_eval \"\${_var1}\")" + $ eval printf '%s' "${_evar}" + " 678" \'910 ' (no-eol) + $ _var1=$'" 678" \\\'910\t\'' + $ eval _evar="\$(_farr_quote_for_eval_strict \"\${_var1}\")" $ eval printf '%s' "${_evar}" " 678" \'910 ' (no-eol)
