lang, test: Inline some overly indented tests

Sometimes you're busy hacking and it's nice for future you to fix up
your code!
This commit is contained in:
James Shubin
2019-07-21 01:19:15 -04:00
parent 9ca6c6a315
commit 64288b4914
4 changed files with 113 additions and 104 deletions

View File

@@ -145,31 +145,33 @@ func TestMetadataParse0(t *testing.T) {
return
}
if metadata != nil {
if !reflect.DeepEqual(meta, metadata) {
// double check because DeepEqual is different since the func exists
diff := pretty.Compare(meta, metadata)
if diff != "" { // bonus
t.Errorf("test #%d: metadata did not match expected", index)
// TODO: consider making our own recursive print function
t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(meta))
t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(metadata))
// more details, for tricky cases:
diffable := &pretty.Config{
Diffable: true,
IncludeUnexported: true,
//PrintStringers: false,
//PrintTextMarshalers: false,
//SkipZeroFields: false,
}
t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(meta))
t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(metadata))
t.Logf("test #%d: diff:\n%s", index, diff)
return
}
}
if metadata == nil {
return
}
if reflect.DeepEqual(meta, metadata) {
return
}
// double check because DeepEqual is different since the func exists
diff := pretty.Compare(meta, metadata)
if diff == "" { // bonus
return
}
t.Errorf("test #%d: metadata did not match expected", index)
// TODO: consider making our own recursive print function
t.Logf("test #%d: actual: \n\n%s\n", index, spew.Sdump(meta))
t.Logf("test #%d: expected: \n\n%s", index, spew.Sdump(metadata))
// more details, for tricky cases:
diffable := &pretty.Config{
Diffable: true,
IncludeUnexported: true,
//PrintStringers: false,
//PrintTextMarshalers: false,
//SkipZeroFields: false,
}
t.Logf("test #%d: actual: \n\n%s\n", index, diffable.Sprint(meta))
t.Logf("test #%d: expected: \n\n%s", index, diffable.Sprint(metadata))
t.Logf("test #%d: diff:\n%s", index, diff)
})
}
}