diff --git a/weekdays.go b/weekdays.go index 50bd55b..9dceca5 100644 --- a/weekdays.go +++ b/weekdays.go @@ -5,8 +5,10 @@ import ( ) const ( - messageWeekday = "Its the weekday!" - messageWeekend = "Its the weekend!" + messageWeekday = "Its the weekday!" + messageWeekend = "Its the weekend!" + messageWeekdayShort = "weekday!" + messageWeekendShort = "weekend!" ) func IsWeekday() bool { @@ -35,3 +37,12 @@ func Message() string { return messageWeekday } } + +func MessageShort() string { + switch time.Now().Weekday() { + case time.Saturday, time.Sunday: + return messageWeekendShort + default: + return messageWeekdayShort + } +} diff --git a/weekdays_test.go b/weekdays_test.go index 280904e..d4d9a42 100644 --- a/weekdays_test.go +++ b/weekdays_test.go @@ -8,8 +8,10 @@ import ( ) const ( - messageWeekday = "Its the weekday!" - messageWeekend = "Its the weekend!" + messageWeekday = "Its the weekday!" + messageWeekend = "Its the weekend!" + messageWeekdayShort = "weekday!" + messageWeekendShort = "weekend!" ) func TestMessage(t *testing.T) { @@ -25,3 +27,17 @@ func TestMessage(t *testing.T) { } } } + +func TestMessageShort(t *testing.T) { + got := weekdays.MessageShort() + switch time.Now().Weekday() { + case time.Saturday, time.Sunday: + if got != messageWeekendShort { + t.Errorf("Message is not the same") + } + default: + if got != messageWeekdayShort { + t.Errorf("Message is not the same") + } + } +}