github.com/go-chrono/chrono@v0.0.0-20240102183611-532f0d0d7c34/consts_test.go (about) 1 package chrono_test 2 3 import ( 4 "testing" 5 6 "github.com/go-chrono/chrono" 7 ) 8 9 func TestWeekday_String(t *testing.T) { 10 for _, tt := range []struct { 11 day chrono.Weekday 12 expected string 13 }{ 14 { 15 day: chrono.Weekday(1), 16 expected: "Monday", 17 }, 18 { 19 day: chrono.Weekday(7), 20 expected: "Sunday", 21 }, 22 { 23 day: chrono.Weekday(0), 24 expected: "%!Weekday(0)", 25 }, 26 { 27 day: chrono.Weekday(8), 28 expected: "%!Weekday(8)", 29 }, 30 } { 31 t.Run(tt.expected, func(t *testing.T) { 32 if out := tt.day.String(); out != tt.expected { 33 t.Errorf("stringified day = %s, want %s", out, tt.expected) 34 } 35 }) 36 } 37 } 38 39 func TestMonth_String(t *testing.T) { 40 for _, tt := range []struct { 41 month chrono.Month 42 expected string 43 }{ 44 { 45 month: chrono.Month(0), 46 expected: "%!Month(0)", 47 }, 48 { 49 month: chrono.Month(1), 50 expected: "January", 51 }, 52 { 53 month: chrono.Month(12), 54 expected: "December", 55 }, 56 { 57 month: chrono.Month(13), 58 expected: "%!Month(13)", 59 }, 60 } { 61 t.Run(tt.expected, func(t *testing.T) { 62 if out := tt.month.String(); out != tt.expected { 63 t.Errorf("stringified month = %s, want %s", out, tt.expected) 64 } 65 }) 66 } 67 }