go-pattern-examples/behavior/10_state/state_test.go
2020-05-05 22:04:16 +08:00

23 lines
273 B
Go

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
}