Improve tests
This commit is contained in:
parent
4875a9916b
commit
e68f708c4c
@ -120,10 +120,10 @@ func TestMap_Anonymous(t *testing.T) {
|
|||||||
type A struct {
|
type A struct {
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
a := A{Name: "example"}
|
a := &A{Name: "example"}
|
||||||
|
|
||||||
type B struct {
|
type B struct {
|
||||||
A
|
*A
|
||||||
}
|
}
|
||||||
b := &B{}
|
b := &B{}
|
||||||
b.A = a
|
b.A = a
|
||||||
@ -424,4 +424,10 @@ func TestName(t *testing.T) {
|
|||||||
if n != "Foo" {
|
if n != "Foo" {
|
||||||
t.Error("Name should return Foo, got: %s", n)
|
t.Error("Name should return Foo, got: %s", n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unnamed := struct{ Name string }{Name: "Cihangir"}
|
||||||
|
m := Name(unnamed)
|
||||||
|
if m != "" {
|
||||||
|
t.Error("Name should return empty string for unnamed struct, got: %s", n)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user