From 5a35620c37c40e2a0144661d93867cb31238aa22 Mon Sep 17 00:00:00 2001 From: kilo Date: Fri, 10 Nov 2017 13:05:15 +0100 Subject: [PATCH] add GetCategoryName() to template_test --- templates/template_functions_test.go | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/templates/template_functions_test.go b/templates/template_functions_test.go index 26c32dc9..551987f6 100644 --- a/templates/template_functions_test.go +++ b/templates/template_functions_test.go @@ -289,6 +289,37 @@ func TestCategoryName(t *testing.T) { } } +func TestCategoryName2(t *testing.T) { + var tests = []struct { + TestCat string + Expected string + }{ + { + TestCat: "_", + Expected: "", + }, + { + TestCat: "d", + Expected: "", + }, + { + TestCat: "3_", + Expected: "anime", + }, + { + TestCat: "3_6", + Expected: "anime_raw", + }, + } + + for _, test := range tests { + value := GetCategoryName(test.TestCat) + if value != test.Expected { + t.Errorf("Unexpected value from the function categoryName, got '%s', wanted '%s' for '%s'", value, test.Expected, test.TestCat) + } + } +} + func TestLanguageName(t *testing.T) { var tests = []struct { TestLang publicSettings.Language