From 0bf5863c3531cbb8ed2f5edecb38c91b4cabaf72 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Sun, 18 Jun 2017 03:07:04 +0200 Subject: [PATCH] DeepEqual test instead of length test on right values --- common/search_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/common/search_test.go b/common/search_test.go index f32b71ce..7f744282 100644 --- a/common/search_test.go +++ b/common/search_test.go @@ -4,6 +4,8 @@ import ( "path" "testing" + "reflect" + "github.com/NyaaPantsu/nyaa/config" ) @@ -33,11 +35,22 @@ func TestParseCategories(t *testing.T) { t.Fatal("ParseCategories with good arg return an empty array") } cat = ParseCategories("3_13,3_5") - if len(cat) != 2 { + catEqual := []*Category{ + &Category{ + Main: 3, + Sub: 13, + }, + &Category{ + Main: 3, + Sub: 5, + }, + } + if !reflect.DeepEqual(cat, catEqual) { t.Fatal("ParseCategories with good arg doesn't return the right array") } cat = ParseCategories("3_13,3_5,5_50") - if len(cat) != 2 { + if !reflect.DeepEqual(cat, catEqual) { t.Fatal("ParseCategories doesn't filter the wrong categories") } + }