Reflect Value can be compared?
Closed this issue · 3 comments
ggaaooppeenngg commented
about https://github.com/franela/goblin/blob/master/assertions.go#L23
I am finding some snippets about reflect ,I tried
package main
import (
"fmt"
"reflect"
)
func main() {
fmt.Println(reflect.ValueOf(1) == reflect.ValueOf(1))
}
it shows "FALSE",
reflect.Value underlying structure is pointer,even they get same value,it points to different address.
marcosnils commented
@ggaaooppeenngg We know that, that's why objectsAreEqual
function tries many different ways to check if the two parameters supplied return true.
If you run the following code it will print "Are Equal".
package main
import (
"fmt"
"github.com/franela/goblin"
)
func main() {
g := goblin.G{}
g.Assert(1).Equal(1)
fmt.Println("Are Equal")
}
ggaaooppeenngg commented
@marcosnils I think that line is a redundant.
marcosnils commented
@ggaaooppeenngg you're right. Thanks for the catch. I'll remove that line.