-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstrings.txt
More file actions
308 lines (307 loc) · 7.24 KB
/
Copy pathstrings.txt
File metadata and controls
308 lines (307 loc) · 7.24 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
mito -cfg cfg.yaml -use strings,try src.cel
! stderr .
cmp stdout want.txt
-- cfg.yaml --
regexp:
"dummy": "."
-- src.cel --
{
"func CanonicalMIMEHeaderKey(s string) string":[
"X-Ratelimit-Limit".canonical_mime_header_key(),
"X-RateLimit-Limit".canonical_mime_header_key(),
"X-rateLimit-Limit".canonical_mime_header_key(),
"X-rateLimit-limit".canonical_mime_header_key(),
"x-ratelimit-limit".canonical_mime_header_key(),
],
"func Compare(a, b string) int":[
"a".compare("b"),
"a".compare("a"),
"b".compare("a"),
],
"func Contains(s, substr string) bool":[
"food".contains_substr("foo"),
"food".contains_substr("bar"),
],
"func ContainsAny(s, chars string) bool":[
"food".contains_any("fud"),
"food".contains_any("bar"),
],
"func Count(s, substr string) int":[
"food".count("x"),
"food".count("o"),
],
"func EqualFold(s, t string) bool":[
"food".equal_fold("FOOD"),
],
"func Fields(s string) []string":[
" one two\tthree four ".fields(),
],
"func HasPrefix(s, prefix string) bool":[
"food".has_prefix("foo"),
"food".has_prefix("bar"),
],
"func HasSuffix(s, suffix string) bool":[
"food".has_suffix("ood"),
"food".has_suffix("bar"),
],
"func Index(s, substr string) int":[
"find me in this string".index("me") == 5,
"find me in this string".index("you") == -1,
],
"func IndexAny(s, chars string) int":[
"find me in this string".index_any("not me") == 2, // n in find.
"find me in this string".index_any("z") == -1,
],
"func Join(elems []string, sep string) string":[
["one", "two", "three"].join("-"),
],
"func LastIndex(s, substr string) int":[
"find me or me in this string".last_index("me") == 11,
"find me or me in this string".last_index("you") == -1,
],
"func LastIndexAny(s, chars string) int":[
"find me or me in this string".last_index_any("is") == 25, // i in string
"find me or me in this string".last_index_any("z") == -1,
],
"func Repeat(s string, count int) string":[
"<little-pig>".repeat(3),
],
"func Replace(s, old, new string, n int) string":[
"replace this and this".replace("this", "that", 1),
],
"func ReplaceAll(s, old, new string) string":[
"replace this and this".replace_all("this", "that"),
],
"func Split(s, sep string) []string":[
"1:2:3:4".split(":"),
],
"func SplitAfter(s, sep string) []string":[
"1:2:3:4".split_after(":"),
],
"func SplitAfterN(s, sep string, n int) []string":[
"1:2:3:4".split_after_n(":", 2),
],
"func SplitN(s, sep string, n int) []string":[
"1:2:3:4".split_n(":", 2),
],
"substring":[
// ASCII
size("01234567890"),
"01234567890".substring(0, 0),
"01234567890".substring(1, 4),
"01234567890".substring(0, 8),
"01234567890".substring(11, 11),
try("01234567890".substring(-1, 8)),
try("01234567890".substring(0, -1)),
try("01234567890".substring(11, 12)),
try("01234567890".substring(0, 12)),
try("01234567890".substring(10, 12)),
// Non-ASCII
size("零一二三四五六七八九十"),
"零一二三四五六七八九十".substring(0, 0),
"零一二三四五六七八九十".substring(1, 4),
"零一二三四五六七八九十".substring(0, 8),
"零一二三四五六七八九十".substring(11, 11),
try("零一二三四五六七八九十".substring(-1, 8)),
try("零一二三四五六七八九十".substring(0, -1)),
try("零一二三四五六七八九十".substring(11, 12)),
try("零一二三四五六七八九十".substring(0, 12)),
try("零一二三四五六七八九十".substring(10, 12)),
],
"func ToLower(s string) string":[
"lEopArds".to_lower(),
],
"func ToTitle(s string) string":[
"lEopArds".to_title(),
],
"func ToUpper(s string) string":[
"lEopArds".to_upper(),
],
"func ToValidUTF8(s, replacement string) string":[
b"good".to_valid_utf8("‽"),
b"b\xc5d".to_valid_utf8("‽"),
],
"func Trim(s, cutset string) string":[
"abacabactextcbacabca".trim("abc"),
],
"func TrimLeft(s, cutset string) string":[
"abacabactextcbacabca".trim_left("abc"),
],
"func TrimPrefix(s, prefix string) string":[
"prefixinfixsuffix".trim_prefix("prefix"),
],
"func TrimRight(s, cutset string) string":[
"abacabactextcbacabca".trim_right("abc"),
],
"func TrimSpace(s string) string":[
"\n text \t \n\r\n".trim_space(),
],
"func TrimSuffix(s, suffix string) string":[
"prefixinfixsuffix".trim_suffix("suffix"),
],
"func utf8.Valid(s []byte) bool":[
b"good".valid_utf8(),
b"b\xc5d".valid_utf8(),
try(string(b"b\xc5d")), // Note to show it is not possible to get an invalid string.
],
}
-- want.txt --
{
"func CanonicalMIMEHeaderKey(s string) string": [
"X-Ratelimit-Limit",
"X-Ratelimit-Limit",
"X-Ratelimit-Limit",
"X-Ratelimit-Limit",
"X-Ratelimit-Limit"
],
"func Compare(a, b string) int": [
-1,
0,
1
],
"func Contains(s, substr string) bool": [
true,
false
],
"func ContainsAny(s, chars string) bool": [
true,
false
],
"func Count(s, substr string) int": [
0,
2
],
"func EqualFold(s, t string) bool": [
true
],
"func Fields(s string) []string": [
[
"one",
"two",
"three",
"four"
]
],
"func HasPrefix(s, prefix string) bool": [
true,
false
],
"func HasSuffix(s, suffix string) bool": [
true,
false
],
"func Index(s, substr string) int": [
true,
true
],
"func IndexAny(s, chars string) int": [
true,
true
],
"func Join(elems []string, sep string) string": [
"one-two-three"
],
"func LastIndex(s, substr string) int": [
true,
true
],
"func LastIndexAny(s, chars string) int": [
true,
true
],
"func Repeat(s string, count int) string": [
"<little-pig><little-pig><little-pig>"
],
"func Replace(s, old, new string, n int) string": [
"replace that and this"
],
"func ReplaceAll(s, old, new string) string": [
"replace that and that"
],
"func Split(s, sep string) []string": [
[
"1",
"2",
"3",
"4"
]
],
"func SplitAfter(s, sep string) []string": [
[
"1:",
"2:",
"3:",
"4"
]
],
"func SplitAfterN(s, sep string, n int) []string": [
[
"1:",
"2:3:4"
]
],
"func SplitN(s, sep string, n int) []string": [
[
"1",
"2:3:4"
]
],
"func ToLower(s string) string": [
"leopards"
],
"func ToTitle(s string) string": [
"LEOPARDS"
],
"func ToUpper(s string) string": [
"LEOPARDS"
],
"func ToValidUTF8(s, replacement string) string": [
"good",
"b‽d"
],
"func Trim(s, cutset string) string": [
"text"
],
"func TrimLeft(s, cutset string) string": [
"textcbacabca"
],
"func TrimPrefix(s, prefix string) string": [
"infixsuffix"
],
"func TrimRight(s, cutset string) string": [
"abacabactext"
],
"func TrimSpace(s string) string": [
"text"
],
"func TrimSuffix(s, suffix string) string": [
"prefixinfix"
],
"func utf8.Valid(s []byte) bool": [
true,
false,
"invalid UTF-8 in bytes, cannot convert to string"
],
"substring": [
11,
"",
"123",
"01234567",
"",
"substring: start out of range: -1 < 0",
"substring: end out of range: -1 < 0",
"substring: end out of range: 12 > 11",
"substring: end out of range: 12 > 11",
"substring: end out of range: 12 > 11",
11,
"",
"一二三",
"零一二三四五六七",
"",
"substring: start out of range: -1 < 0",
"substring: end out of range: -1 < 0",
"substring: end out of range: 12 > 11",
"substring: end out of range: 12 > 11",
"substring: end out of range: 12 > 11"
]
}