summary refs log tree commit diff
path: root/bin/cash/tests/builtins/case2.0
blob: cc737f42dd0266c788fdd0820aff38f91eaf1f14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Generated by ./test-fnmatch -s 1, do not edit.
# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case2.0 207821 2010-05-09 16:15:40Z jilles $
failures=
failed() { printf '%s\n' "Failed: $1 '$2' '$3'"; failures=x$failures; }
testmatch() { eval "case \$2 in ''$1) ;; *) failed testmatch \"\$@\";; esac"; }
testnomatch() { eval "case \$2 in ''$1) failed testnomatch \"\$@\";; esac"; }
testmatch '' ''
testmatch 'a' 'a'
testnomatch 'a' 'b'
testnomatch 'a' 'A'
testmatch '*' 'a'
testmatch '*' 'aa'
testmatch '*a' 'a'
testnomatch '*a' 'b'
testnomatch '*a*' 'b'
testmatch '*a*b*' 'ab'
testmatch '*a*b*' 'qaqbq'
testmatch '*a*bb*' 'qaqbqbbq'
testmatch '*a*bc*' 'qaqbqbcq'
testmatch '*a*bb*' 'qaqbqbb'
testmatch '*a*bc*' 'qaqbqbc'
testmatch '*a*bb' 'qaqbqbb'
testmatch '*a*bc' 'qaqbqbc'
testnomatch '*a*bb' 'qaqbqbbq'
testnomatch '*a*bc' 'qaqbqbcq'
testnomatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaa'
testmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaa'
testmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaaa'
testnomatch '.*.*.*.*.*.*.*.*.*.*' '.........'
testmatch '.*.*.*.*.*.*.*.*.*.*' '..........'
testmatch '.*.*.*.*.*.*.*.*.*.*' '...........'
testnomatch '*?*?*?*?*?*?*?*?*?*?*' '123456789'
testnomatch '??????????*' '123456789'
testnomatch '*??????????' '123456789'
testmatch '*?*?*?*?*?*?*?*?*?*?*' '1234567890'
testmatch '??????????*' '1234567890'
testmatch '*??????????' '1234567890'
testmatch '*?*?*?*?*?*?*?*?*?*?*' '12345678901'
testmatch '??????????*' '12345678901'
testmatch '*??????????' '12345678901'
testmatch '[x]' 'x'
testmatch '[*]' '*'
testmatch '[?]' '?'
testmatch '[' '['
testmatch '[[]' '['
testnomatch '[[]' 'x'
testnomatch '[*]' ''
testnomatch '[*]' 'x'
testnomatch '[?]' 'x'
testmatch '*[*]*' 'foo*foo'
testnomatch '*[*]*' 'foo'
testmatch '[0-9]' '0'
testmatch '[0-9]' '5'
testmatch '[0-9]' '9'
testnomatch '[0-9]' '/'
testnomatch '[0-9]' ':'
testnomatch '[0-9]' '*'
testnomatch '[!0-9]' '0'
testnomatch '[!0-9]' '5'
testnomatch '[!0-9]' '9'
testmatch '[!0-9]' '/'
testmatch '[!0-9]' ':'
testmatch '[!0-9]' '*'
testmatch '*[0-9]' 'a0'
testmatch '*[0-9]' 'a5'
testmatch '*[0-9]' 'a9'
testnomatch '*[0-9]' 'a/'
testnomatch '*[0-9]' 'a:'
testnomatch '*[0-9]' 'a*'
testnomatch '*[!0-9]' 'a0'
testnomatch '*[!0-9]' 'a5'
testnomatch '*[!0-9]' 'a9'
testmatch '*[!0-9]' 'a/'
testmatch '*[!0-9]' 'a:'
testmatch '*[!0-9]' 'a*'
testmatch '*[0-9]' 'a00'
testmatch '*[0-9]' 'a55'
testmatch '*[0-9]' 'a99'
testmatch '*[0-9]' 'a0a0'
testmatch '*[0-9]' 'a5a5'
testmatch '*[0-9]' 'a9a9'
testmatch '\*' '*'
testmatch '\?' '?'
testmatch '\[x]' '[x]'
testmatch '\[' '['
testmatch '\\' '\'
testmatch '*\**' 'foo*foo'
testnomatch '*\**' 'foo'
testmatch '*\\*' 'foo\foo'
testnomatch '*\\*' 'foo'
testmatch '\(' '('
testmatch '\a' 'a'
testnomatch '\*' 'a'
testnomatch '\?' 'a'
testnomatch '\*' '\*'
testnomatch '\?' '\?'
testnomatch '\[x]' '\[x]'
testnomatch '\[x]' '\x'
testnomatch '\[' '\['
testnomatch '\(' '\('
testnomatch '\a' '\a'
testmatch '.*' '.'
testmatch '.*' '..'
testmatch '.*' '.a'
testmatch 'a*' 'a.'
[ -z "$failures" ]