MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / TestPatternString

Function TestPatternString

runtime/pattern_test.go:556–636  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

554}
555
556func TestPatternString(t *testing.T) {
557 for _, spec := range []struct {
558 ops []int
559 pool []string
560
561 want string
562 }{
563 {
564 want: "/",
565 },
566 {
567 ops: []int{int(utilities.OpNop), anything},
568 want: "/",
569 },
570 {
571 ops: []int{int(utilities.OpPush), anything},
572 want: "/*",
573 },
574 {
575 ops: []int{int(utilities.OpLitPush), 0},
576 pool: []string{"endpoint"},
577 want: "/endpoint",
578 },
579 {
580 ops: []int{int(utilities.OpPushM), anything},
581 want: "/**",
582 },
583 {
584 ops: []int{
585 int(utilities.OpPush), anything,
586 int(utilities.OpConcatN), 1,
587 },
588 want: "/*",
589 },
590 {
591 ops: []int{
592 int(utilities.OpPush), anything,
593 int(utilities.OpConcatN), 1,
594 int(utilities.OpCapture), 0,
595 },
596 pool: []string{"name"},
597 want: "/{name=*}",
598 },
599 {
600 ops: []int{
601 int(utilities.OpLitPush), 0,
602 int(utilities.OpLitPush), 1,
603 int(utilities.OpPush), anything,
604 int(utilities.OpConcatN), 2,
605 int(utilities.OpCapture), 2,
606 int(utilities.OpLitPush), 3,
607 int(utilities.OpPushM), anything,
608 int(utilities.OpLitPush), 4,
609 int(utilities.OpConcatN), 3,
610 int(utilities.OpCapture), 6,
611 int(utilities.OpLitPush), 5,
612 },
613 pool: []string{"v1", "buckets", "bucket_name", "objects", ".ext", "tail", "name"},

Callers

nothing calls this directly

Calls 2

StringMethod · 0.95
NewPatternFunction · 0.85

Tested by

no test coverage detected