Home | History | Annotate | Download | only in regexp

Lines Matching refs:tc

264 	for _, tc := range replaceTests {
265 re, err := Compile(tc.pattern)
267 t.Errorf("Unexpected error compiling %q: %v", tc.pattern, err)
270 actual := re.ReplaceAllString(tc.input, tc.replacement)
271 if actual != tc.output {
273 tc.pattern, tc.input, tc.replacement, actual, tc.output)
276 actual = string(re.ReplaceAll([]byte(tc.input), []byte(tc.replacement)))
277 if actual != tc.output {
279 tc.pattern, tc.input, tc.replacement, actual, tc.output)
286 for _, tc := range replaceTests {
287 if strings.Contains(tc.replacement, "$") {
290 re, err := Compile(tc.pattern)
292 t.Errorf("Unexpected error compiling %q: %v", tc.pattern, err)
295 actual := re.ReplaceAllLiteralString(tc.input, tc.replacement)
296 if actual != tc.output {
298 tc.pattern, tc.input, tc.replacement, actual, tc.output)
301 actual = string(re.ReplaceAllLiteral([]byte(tc.input), []byte(tc.replacement)))
302 if actual != tc.output {
304 tc.pattern, tc.input, tc.replacement, actual, tc.output)
309 for _, tc := range replaceLiteralTests {
310 re, err := Compile(tc.pattern)
312 t.Errorf("Unexpected error compiling %q: %v", tc.pattern, err)
315 actual := re.ReplaceAllLiteralString(tc.input, tc.replacement)
316 if actual != tc.output {
318 tc.pattern, tc.input, tc.replacement, actual, tc.output)
321 actual = string(re.ReplaceAllLiteral([]byte(tc.input), []byte(tc.replacement)))
322 if actual != tc.output {
324 tc.pattern, tc.input, tc.replacement, actual, tc.output)
330 for _, tc := range replaceFuncTests {
331 re, err := Compile(tc.pattern)
333 t.Errorf("Unexpected error compiling %q: %v", tc.pattern, err)
336 actual := re.ReplaceAllStringFunc(tc.input, tc.replacement)
337 if actual != tc.output {
339 tc.pattern, tc.input, actual, tc.output)
342 actual = string(re.ReplaceAllFunc([]byte(tc.input), func(s []byte) []byte { return []byte(tc.replacement(string(s))) }))
343 if actual != tc.output {
345 tc.pattern, tc.input, actual, tc.output)
378 for _, tc := range metaTests {
380 quoted := QuoteMeta(tc.pattern)
381 if quoted != tc.output {
383 tc.pattern, quoted, tc.output)
389 if tc.pattern != "" {
392 t.Errorf("Unexpected error compiling QuoteMeta(`%s`): %v", tc.pattern, err)
395 src := "abc" + tc.pattern + "def"
401 tc.pattern, src, repl, replaced, expected)
408 for _, tc := range append(metaTests, literalPrefixTests...) {
410 re := MustCompile(tc.pattern)
412 if complete != tc.isLiteral {
413 t.Errorf("LiteralPrefix(`%s`) = %t; want %t", tc.pattern, complete, tc.isLiteral)
415 if str != tc.literal {
416 t.Errorf("LiteralPrefix(`%s`) = `%s`; want `%s`", tc.pattern, str, tc.literal)
522 for i, tc := range []struct {
529 parsed, err := syntax.Parse(expr, tc.reFlags)
537 if match := re.MatchString(s); match != tc.expMatch {
538 t.Errorf("%d: %q.MatchString(%q)=%t; expected=%t", i, re, s, match, tc.expMatch)