forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
405 B
14 lines
405 B
package command
|
|
|
|
import "testing"
|
|
|
|
func TestCommand_Exec(t *testing.T) {
|
|
zs := NewPerson("张三", NewCommand(nil, nil))
|
|
ls := NewPerson("老四", NewCommand(&zs, zs.Buy))
|
|
ww := NewPerson("王五", NewCommand(&ls, ls.Drink))
|
|
ml := NewPerson("马六", NewCommand(&ww, ww.Eat))
|
|
tq := NewPerson("田七", NewCommand(&ml, ml.Sleep))
|
|
hb := NewPerson("胡八", NewCommand(&tq, tq.Wash))
|
|
|
|
hb.cmd.Exec()
|
|
}
|
|
|