visitor_test.go

最后更新于:2022-04-02 04:50:47

~~~ package visitor import ( "testing" ) func TestVisitor(t *testing.T) { object := ObjectStructure{} object.Attach(&ConcreteElementA{"A"}) object.Attach(&ConcreteElementB{"B"}) cva := ConcreteVisitorA{"vA"} cvb := ConcreteVisitorB{"vB"} object.Accept(&cva) object.Accept(&cvb) } ~~~
';