go-pattern-examples/behavior/16_state/state_test.go

23 lines
273 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package state
func ExampleWeek() {
ctx := NewDayContext()
todayAndNext := func() {
ctx.Today()
ctx.Next()
}
for i := 0; i < 8; i++ {
todayAndNext()
}
// Output:
// Sunday
// Monday
// Tuesday
// Wednesday
// Thursday
// Friday
// Saturday
// Sunday
}