diff --git a/behavior/07_visitor/visitor_game.go b/behavior/07_visitor/visitor_game.go index 6a85fc8..a514c75 100644 --- a/behavior/07_visitor/visitor_game.go +++ b/behavior/07_visitor/visitor_game.go @@ -2,8 +2,8 @@ package visitor import "fmt" -//IGameContext 游戏上下文 -type IGameContext interface { +//IGameObject 游戏上下文对象 +type IGameObject interface { Accept(IGameVisitor) } diff --git a/behavior/07_visitor/visitor_test.go b/behavior/07_visitor/visitor_test.go index 1e9594c..ccf5329 100644 --- a/behavior/07_visitor/visitor_test.go +++ b/behavior/07_visitor/visitor_test.go @@ -2,7 +2,7 @@ package visitor import "testing" -func TestVisitor(t *testing.T) { +func TestSingleVisitor(t *testing.T) { //汽油提供给,制衣工厂 g := gas{density: 100} @@ -32,7 +32,7 @@ func TestGameVisitorsList(t *testing.T) { env := SystemEnv{"made by china", "v1.2.11"} //游戏对象 - gameObjects := []IGameContext{pA, npc, env, pB} + gameObjects := []IGameObject{pA, npc, env, pB} for _, v := range gameObjects { v.Accept(retriveSetting)