Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

DeepEqual test instead of length test on right values

Cette révision appartient à :
akuma06 2017-06-18 03:07:04 +02:00
Parent 61e9c9ea33
révision 0bf5863c35

Voir le fichier

@ -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")
}
}