fixrbc_test.go (774B)
1 package main 2 3 import "testing" 4 5 func TestSanitizedFilename(t *testing.T) { 6 cases := []struct { 7 desc string 8 in string 9 expected string 10 }{ 11 {"TestJanFeb", "123456-2021jan01-2021feB02.pdf", "2021-02-02.pdf"}, 12 {"TestMarApr", "123456-2021mAr01-2021aPR02.pdf", "2021-04-02.pdf"}, 13 {"TestMayJun", "123456-2021May01-2021JuN02.pdf", "2021-06-02.pdf"}, 14 {"TestJulAug", "123456-2021Jul01-2021AUG02.pdf", "2021-08-02.pdf"}, 15 {"TestSepOct", "123456-2021sep01-2021ocT02.pdf", "2021-10-02.pdf"}, 16 {"TestNovDec", "123456-2021nOv01-2021dEC02.pdf", "2021-12-02.pdf"}, 17 } 18 19 for _, tc := range cases { 20 actual, _ := SanitizedFilename(tc.in) 21 if actual != tc.expected { 22 t.Errorf("%s: expected: %s got %s for input: %s", tc.desc, tc.expected, actual, tc.in) 23 } 24 } 25 }