This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package timeext
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMonthNameGermanShort3(t *testing.T) {
|
||||
tests := []struct {
|
||||
m time.Month
|
||||
want string
|
||||
}{
|
||||
{time.January, "Jan"},
|
||||
{time.February, "Feb"},
|
||||
{time.March, "Mär"},
|
||||
{time.April, "Apr"},
|
||||
{time.May, "Mai"},
|
||||
{time.June, "Jun"},
|
||||
{time.July, "Jul"},
|
||||
{time.August, "Aug"},
|
||||
{time.September, "Sep"},
|
||||
{time.October, "Okt"},
|
||||
{time.November, "Nov"},
|
||||
{time.December, "Dez"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := MonthNameGermanShort3(tt.m)
|
||||
if got != tt.want {
|
||||
t.Errorf("MonthNameGermanShort3(%v) = %q; want %q", tt.m, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonthNameGermanShort3_Invalid(t *testing.T) {
|
||||
got := MonthNameGermanShort3(time.Month(13))
|
||||
want := "%!Month(13)"
|
||||
if got != want {
|
||||
t.Errorf("MonthNameGermanShort3(13) = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonthNameGermanLong(t *testing.T) {
|
||||
tests := []struct {
|
||||
m time.Month
|
||||
want string
|
||||
}{
|
||||
{time.January, "Januar"},
|
||||
{time.February, "Februar"},
|
||||
{time.March, "März"},
|
||||
{time.April, "April"},
|
||||
{time.May, "Mai"},
|
||||
{time.June, "Juni"},
|
||||
{time.July, "Juli"},
|
||||
{time.August, "August"},
|
||||
{time.September, "September"},
|
||||
{time.October, "Oktober"},
|
||||
{time.November, "November"},
|
||||
{time.December, "Dezember"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := MonthNameGermanLong(tt.m)
|
||||
if got != tt.want {
|
||||
t.Errorf("MonthNameGermanLong(%v) = %q; want %q", tt.m, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonthNameGermanLong_Invalid(t *testing.T) {
|
||||
got := MonthNameGermanLong(time.Month(0))
|
||||
want := "%!Month(0)"
|
||||
if got != want {
|
||||
t.Errorf("MonthNameGermanLong(0) = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user