Require *T for typeurl interaction
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -18,35 +18,7 @@ func clear() {
|
||||
registry = make(map[reflect.Type]string)
|
||||
}
|
||||
|
||||
func TestRegsiterValueGetValue(t *testing.T) {
|
||||
clear()
|
||||
expected := filepath.Join(Prefix, "test")
|
||||
Register(test{}, "test")
|
||||
|
||||
url, err := TypeURL(test{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if url != expected {
|
||||
t.Fatalf("expected %q but received %q", expected, url)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegsiterValueGetPointer(t *testing.T) {
|
||||
clear()
|
||||
expected := filepath.Join(Prefix, "test")
|
||||
Register(test{}, "test")
|
||||
|
||||
url, err := TypeURL(&test{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if url != expected {
|
||||
t.Fatalf("expected %q but received %q", expected, url)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegsiterPointerGetPointer(t *testing.T) {
|
||||
func TestRegisterPointerGetPointer(t *testing.T) {
|
||||
clear()
|
||||
expected := filepath.Join(Prefix, "test")
|
||||
Register(&test{}, "test")
|
||||
@@ -60,24 +32,10 @@ func TestRegsiterPointerGetPointer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegsiterPointerGetValue(t *testing.T) {
|
||||
clear()
|
||||
expected := filepath.Join(Prefix, "test")
|
||||
Register(&test{}, "test")
|
||||
|
||||
url, err := TypeURL(test{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if url != expected {
|
||||
t.Fatalf("expected %q but received %q", expected, url)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshal(t *testing.T) {
|
||||
clear()
|
||||
expected := filepath.Join(Prefix, "test")
|
||||
Register(test{}, "test")
|
||||
Register(&test{}, "test")
|
||||
|
||||
v := &test{
|
||||
Name: "koye",
|
||||
@@ -94,7 +52,7 @@ func TestMarshal(t *testing.T) {
|
||||
|
||||
func TestMarshalUnmarshal(t *testing.T) {
|
||||
clear()
|
||||
Register(test{}, "test")
|
||||
Register(&test{}, "test")
|
||||
|
||||
v := &test{
|
||||
Name: "koye",
|
||||
@@ -122,7 +80,7 @@ func TestMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
func TestIs(t *testing.T) {
|
||||
clear()
|
||||
Register(test{}, "test")
|
||||
Register(&test{}, "test")
|
||||
|
||||
v := &test{
|
||||
Name: "koye",
|
||||
@@ -132,7 +90,7 @@ func TestIs(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !Is(any, test{}) {
|
||||
if !Is(any, &test{}) {
|
||||
t.Fatal("Is(any, test{}) should be true")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user