util/router: sync from github

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-08-03 00:19:53 +03:00
parent f2e6b7540c
commit 46d4461f6d
4 changed files with 7 additions and 20 deletions

View File

@ -25,7 +25,7 @@ func TestCompile(t *testing.T) {
segs: []segment{ segs: []segment{
literal(eof), literal(eof),
}, },
ops: []int{int(utilities.OpLitPush), 0}, ops: []int{int(OpLitPush), 0},
pool: []string{""}, pool: []string{""},
}, },
{ {

View File

@ -3,11 +3,8 @@ package router
// download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/parse.go // download from https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/protoc-gen-grpc-gateway/httprule/parse.go
import ( import (
"context"
"fmt" "fmt"
"strings" "strings"
"github.com/unistack-org/micro/v3/logger"
) )
// InvalidTemplateError indicates that the path template is not valid. // InvalidTemplateError indicates that the path template is not valid.

View File

@ -4,7 +4,6 @@ package router
import ( import (
"context" "context"
"flag"
"fmt" "fmt"
"reflect" "reflect"
"testing" "testing"
@ -135,10 +134,6 @@ func TestTokenize(t *testing.T) {
} }
func TestParseSegments(t *testing.T) { func TestParseSegments(t *testing.T) {
err := flag.Set("v", "3")
if err != nil {
t.Fatalf("failed to set flag: %v", err)
}
for _, spec := range []struct { for _, spec := range []struct {
tokens []string tokens []string
want []segment want []segment
@ -298,10 +293,6 @@ func TestParseSegments(t *testing.T) {
} }
func TestParseSegmentsWithErrors(t *testing.T) { func TestParseSegmentsWithErrors(t *testing.T) {
err := flag.Set("v", "3")
if err != nil {
t.Fatalf("failed to set flag: %v", err)
}
for _, spec := range []struct { for _, spec := range []struct {
tokens []string tokens []string
}{ }{

View File

@ -149,7 +149,6 @@ func NewPattern(version int, ops []int, pool []string, verb string) (Pattern, er
stacksize: maxstack, stacksize: maxstack,
tailLen: tailLen, tailLen: tailLen,
verb: verb, verb: verb,
assumeColonVerb: options.assumeColonVerb,
}, nil }, nil
} }