You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.4 KiB
39 lines
1.4 KiB
4 years ago
|
package binding
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestProtoPath(t *testing.T) {
|
||
4 years ago
|
url := EncodeURL("http://helloworld.Greeter/helloworld/{name}/sub/{sub.name}", &HelloRequest{Name: "test", Sub: &Sub{Name: "2233!!!"}}, false)
|
||
4 years ago
|
fmt.Println(url)
|
||
|
if url != `http://helloworld.Greeter/helloworld/test/sub/2233!!!` {
|
||
|
t.Fatalf("proto path not expected!actual: %s ", url)
|
||
|
}
|
||
|
|
||
3 years ago
|
url = EncodeURL("http://helloworld.Greeter/helloworld/{name}/sub/{sub.naming}", &HelloRequest{Name: "test", Sub: &Sub{Name: "5566!!!"}}, false)
|
||
|
fmt.Println(url)
|
||
|
if url != `http://helloworld.Greeter/helloworld/test/sub/5566!!!` {
|
||
|
t.Fatalf("proto path not expected!actual: %s ", url)
|
||
|
}
|
||
|
|
||
4 years ago
|
url = EncodeURL("http://helloworld.Greeter/helloworld/sub", &HelloRequest{Name: "test", Sub: &Sub{Name: "2233!!!"}}, false)
|
||
4 years ago
|
fmt.Println(url)
|
||
|
if url != `http://helloworld.Greeter/helloworld/sub` {
|
||
|
t.Fatalf("proto path not expected!actual: %s ", url)
|
||
|
}
|
||
|
|
||
4 years ago
|
url = EncodeURL("http://helloworld.Greeter/helloworld/{name}/sub/{sub.name}", &HelloRequest{Name: "test"}, false)
|
||
4 years ago
|
fmt.Println(url)
|
||
|
if url != `http://helloworld.Greeter/helloworld/test/sub/` {
|
||
|
t.Fatalf("proto path not expected!actual: %s ", url)
|
||
|
}
|
||
|
|
||
4 years ago
|
url = EncodeURL("http://helloworld.Greeter/helloworld/{name}/sub/{sub.name33}", &HelloRequest{Name: "test"}, false)
|
||
4 years ago
|
fmt.Println(url)
|
||
|
if url != `http://helloworld.Greeter/helloworld/test/sub/{sub.name33}` {
|
||
|
t.Fatalf("proto path not expected!actual: %s ", url)
|
||
|
}
|
||
|
}
|