From 7f46df6d274eff51569b57b382480301caa1dff6 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 16 Aug 2017 15:30:58 +0100 Subject: tests: add SortAndCheck helper (#926) There was quite some code duplication in a lot of tests to check if an answer was considered Ok. Created a test.SortAndCheck helper function that takes care of this. --- middleware/file/ds_test.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'middleware/file/ds_test.go') diff --git a/middleware/file/ds_test.go b/middleware/file/ds_test.go index 32ae5187a..f5c9bb332 100644 --- a/middleware/file/ds_test.go +++ b/middleware/file/ds_test.go @@ -1,7 +1,6 @@ package file import ( - "sort" "strings" "testing" @@ -71,22 +70,6 @@ func TestLookupDS(t *testing.T) { } resp := rec.Msg - sort.Sort(test.RRSet(resp.Answer)) - sort.Sort(test.RRSet(resp.Ns)) - sort.Sort(test.RRSet(resp.Extra)) - - if !test.Header(t, tc, resp) { - t.Logf("%v\n", resp) - continue - } - if !test.Section(t, tc, test.Answer, resp.Answer) { - t.Logf("%v\n", resp) - } - if !test.Section(t, tc, test.Ns, resp.Ns) { - t.Logf("%v\n", resp) - } - if !test.Section(t, tc, test.Extra, resp.Extra) { - t.Logf("%v\n", resp) - } + test.SortAndCheck(t, resp, tc) } } -- cgit v1.2.3