diff --git a/ChangeLog b/ChangeLog index e6d651144..323c036fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2025-06-03 dana + * 53709: Test/D02glob.ztst: add misc. glob-qualifier tests + * 53709: Doc/Zsh/expn.yo, Doc/Zsh/options.yo: clarify glob-qualifier syntax diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 4d88e5c27..24494d274 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -541,6 +541,19 @@ >No file beginning with z >Normal string if nullglob not set + ( + setopt extended_glob no_nomatch + cd glob.tmp + [[ a(#q.) == a ]] && print lhs 1 + [[ a(#q/) == a ]] && print lhs 2 + [[ z == *(#q.) ]] && print rhs 1 # (#q...) ignored + [[ z == *(#q/) ]] && print rhs 2 # (#q...) ignored + ) +0:(#q) glob expansion only on lhs of pattern-match conditions +>lhs 1 +>rhs 1 +>rhs 2 + (){ print $#@ } glob.tmp/dir*(Y1) (){ print $#@ } glob.tmp/file*(NY1) (){ [[ "$*" == */dir?\ */dir? ]] && print Returns matching filenames } glob.tmp/dir*(Y2) @@ -841,6 +854,53 @@ [[ abc = (b*|a*)~^(*b) ]] 1:Regression test for exclusion after branches: failure case 3 + ( + setopt extended_glob + cd glob.tmp + qual=. + echo [a](.) [a]('.') [a](".") [a](\.) [a]($qual) [a]("$qual") + echo [a](#q.) [a](#q'.') [a](#q".") [a](#q\.) [a](#q$qual) [a](#q"$qual") + qual='(#q.)'; echo [a]$~qual + qual='(#'; echo [a]${~qual}q.${:-)} + qual='(#q'; echo [a]${~qual}.${:-)} + ) +0:general glob qualifier quoting and expansion +>a a a a a a +>a a a a a a +>a +>a +>a + + ( + setopt extended_glob + cd glob.tmp + s='*' quals=( + '(#qe:"REPLY=*":)' '(#qe":REPLY=*:")' '(#qe:REPLY=\*:)' + '(#qe:"reply=( \* )":)' '(#qe":reply=( \* ):")' '(#qe:reply=( \\\* ):)' + '(#qe|"reply=( \* )"|)' '(#qe"|reply=( \* )|")' '(#qe|reply=( \\\* )|)' + '(#qe?"reply=( \* )"?)' '(#qe"?reply=( \* )?")' '(#qe?reply=( \\\* )?)' + '(#qe["reply=( \* )"])' '(#qe"[reply=( \* )]")' '(#qe[reply=( \\\* )])' + '(#qe("reply=( \* )"))' '(#qe"(reply=( \* ))")' '(#qe(reply=( \\\* )))' + '(#qe*"reply=( \* )"*)' '(#qe"*reply=( \* )*")' '(#qe*reply=( \\\* )*)' + '(#qe*"reply=( \$s )"*)' '(#qe"*reply=( \$s )*")' '(#qe*reply=( \$s )*)' + ) + for 1 2 3 in $quals; do + print -r - \ + ${ eval "echo [a]$1" 2>&1 } \ + ${ eval "echo [a]$2" 2>&1 } \ + ${ eval "echo [a]$3" 2>&1 } + done + ) +0:e glob qualifier delimiters, quoting, and expansion +>* * * +>* * * +>* * * +>* * * +>* * * +>* (eval):1: unknown file attribute: ) (eval):1: unknown file attribute: ) +>* (eval):1: unknown file attribute: * +>* * * + # Careful: extendedglob off from this point. unsetopt extendedglob