Commit ba260316 authored by Kyle Lemons's avatar Kyle Lemons

Compare unexported fields

parent 21e37b6e
...@@ -53,14 +53,15 @@ func (cfg *Config) Fprint(w io.Writer, vals ...interface{}) (n int64, err error) ...@@ -53,14 +53,15 @@ func (cfg *Config) Fprint(w io.Writer, vals ...interface{}) (n int64, err error)
} }
// Compare returns a string containing a line-by-line unified diff of the // Compare returns a string containing a line-by-line unified diff of the
// values in got and want. Compare ignores unexported fields. // values in got and want. Compare includes unexported fields.
// //
// Each line in the output is prefixed with '+', '-', or ' ' to indicate if it // Each line in the output is prefixed with '+', '-', or ' ' to indicate if it
// should be added to, removed from, or is correct for the "got" value with // should be added to, removed from, or is correct for the "got" value with
// respect to the "want" value. // respect to the "want" value.
func Compare(got, want interface{}) string { func Compare(got, want interface{}) string {
diffOpt := &Config{ diffOpt := &Config{
Diffable: true, Diffable: true,
IncludeUnexported: true,
} }
return diff.Diff(diffOpt.Sprint(got), diffOpt.Sprint(want)) return diff.Diff(diffOpt.Sprint(got), diffOpt.Sprint(want))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment