diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
commit | 1d5cace9db9aef76f26b2d7ba54bbb76443b00b2 (patch) | |
tree | 314a15dd1aa103da13bdc83ba1d2105a290bc5ba /tests/extglob2.tests | |
parent | Initial commit. (diff) | |
download | bash-89791e9f494bebe33a9c52292a98f4f079926078.tar.xz bash-89791e9f494bebe33a9c52292a98f4f079926078.zip |
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | tests/extglob2.tests | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tests/extglob2.tests b/tests/extglob2.tests new file mode 100755 index 0000000..f35c3e8 --- /dev/null +++ b/tests/extglob2.tests @@ -0,0 +1,90 @@ +# +# More ksh-like extended globbing tests, cribbed from zsh-3.1.5 +# +shopt -s extglob + +failed=0 +while read res str pat; do + [[ $res = '#' ]] && continue + [[ $str = ${pat} ]] + ts=$? + [[ $1 = -q ]] || echo "$ts: [[ $str = $pat ]]" + if [[ ( $ts -gt 0 && $res = t) || ($ts -eq 0 && $res = f) ]]; then + echo "Test failed: [[ $str = $pat ]]" + (( failed += 1 )) + fi +done <<EOT +t fofo *(f*(o)) +t ffo *(f*(o)) +t foooofo *(f*(o)) +t foooofof *(f*(o)) +t fooofoofofooo *(f*(o)) +f foooofof *(f+(o)) +f xfoooofof *(f*(o)) +f foooofofx *(f*(o)) +t ofxoofxo *(*(of*(o)x)o) +f ofooofoofofooo *(f*(o)) +t foooxfooxfoxfooox *(f*(o)x) +f foooxfooxofoxfooox *(f*(o)x) +t foooxfooxfxfooox *(f*(o)x) +t ofxoofxo *(*(of*(o)x)o) +t ofoooxoofxo *(*(of*(o)x)o) +t ofoooxoofxoofoooxoofxo *(*(of*(o)x)o) +t ofoooxoofxoofoooxoofxoo *(*(of*(o)x)o) +f ofoooxoofxoofoooxoofxofo *(*(of*(o)x)o) +t ofoooxoofxoofoooxoofxooofxofxo *(*(of*(o)x)o) +t aac *(@(a))a@(c) +t ac *(@(a))a@(c) +f c *(@(a))a@(c) +t aaac *(@(a))a@(c) +f baaac *(@(a))a@(c) +t abcd ?@(a|b)*@(c)d +t abcd @(ab|a*@(b))*(c)d +t acd @(ab|a*(b))*(c)d +t abbcd @(ab|a*(b))*(c)d +t effgz @(b+(c)d|e*(f)g?|?(h)i@(j|k)) +t efgz @(b+(c)d|e*(f)g?|?(h)i@(j|k)) +t egz @(b+(c)d|e*(f)g?|?(h)i@(j|k)) +t egzefffgzbcdij *(b+(c)d|e*(f)g?|?(h)i@(j|k)) +f egz @(b+(c)d|e+(f)g?|?(h)i@(j|k)) +t ofoofo *(of+(o)) +t oxfoxoxfox *(oxf+(ox)) +f oxfoxfox *(oxf+(ox)) +t ofoofo *(of+(o)|f) +# The following is supposed to match only as fo+ofo+ofo +t foofoofo @(foo|f|fo)*(f|of+(o)) +t oofooofo *(of|oof+(o)) +t fffooofoooooffoofffooofff *(*(f)*(o)) +# The following tests backtracking in alternation matches +t fofoofoofofoo *(fo|foo) +# Exclusion +t foo !(x) +t foo !(x)* +f foo !(foo) +t foo !(foo)* +t foobar !(foo) +t foobar !(foo)* +t moo.cow !(*.*).!(*.*) +f mad.moo.cow !(*.*).!(*.*) +f mucca.pazza mu!(*(c))?.pa!(*(z))? +t fff !(f) +t fff *(!(f)) +t fff +(!(f)) +t ooo !(f) +t ooo *(!(f)) +t ooo +(!(f)) +t foo !(f) +t foo *(!(f)) +t foo +(!(f)) +f f !(f) +f f *(!(f)) +f f +(!(f)) +t foot @(!(z*)|*x) +f zoot @(!(z*)|*x) +t foox @(!(z*)|*x) +t zoox @(!(z*)|*x) +t foo *(!(foo)) +f foob !(foo)b* +t foobb !(foo)b* +EOT +echo "$failed tests failed." |