New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive output poorly reported #284
Comments
I agree, I don't think this is a false positive - the graph structure differs, as you have illustrated. It might be worth considering if |
I'm not sure I follow. Can you provide an example reporter output that you feel would better illustrate what exactly is different? Thanks! |
I was thinking something like this:
The point I'm trying to make with this is that Now that I think more about this, maybe even this could make sense (maybe extending the difference to top level, so that
|
Here's another approach that might give you some inspiration about how to print it: package main
import (
"testing"
"github.com/ysmood/got/lib/diff"
"github.com/ysmood/got/lib/gop"
)
func Test(t *testing.T) {
type node struct {
parent *node
child *node
}
t2 := &node{}
t1 := &node{child: t2}
t2.parent = t1
t3 := &node{child: t2}
t2.parent = t3
if df := diff.Diff(gop.F(t1), gop.F(t3)); df != "" {
t.Error(df)
}
} |
We have a case where we have a linked datastructure pointing to both children and parent nodes. Due to a bug in our test implementation we were getting a result that seems like a false-positive, but in fact
cmp
hides the actual difference underref#0
. This occurrs because the data structure has the same values, but different pointer addresses. See the simplified example input and output below:which produces the following output:
The example code is obviously flawed, but in our case that was hidden among 100 other lines before it was distilled to these lines
The text was updated successfully, but these errors were encountered: