github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/tidb/ast/cloner_test.go (about) 1 package ast 2 3 import ( 4 . "github.com/insionng/yougam/libraries/pingcap/check" 5 "github.com/insionng/yougam/libraries/pingcap/tidb/parser/opcode" 6 ) 7 8 var _ = Suite(&testClonerSuite{}) 9 10 type testClonerSuite struct { 11 } 12 13 func (ts *testClonerSuite) TestCloner(c *C) { 14 cloner := &Cloner{} 15 16 a := &UnaryOperationExpr{ 17 Op: opcode.Not, 18 V: &UnaryOperationExpr{V: NewValueExpr(true)}, 19 } 20 21 b, ok := a.Accept(cloner) 22 c.Assert(ok, IsTrue) 23 a1 := a.V 24 b1 := b.(*UnaryOperationExpr).V 25 c.Assert(a1, Not(Equals), b1) 26 a2 := a1.(*UnaryOperationExpr).V 27 b2 := b1.(*UnaryOperationExpr).V 28 c.Assert(a2, Not(Equals), b2) 29 a3 := a2.(*ValueExpr) 30 b3 := b2.(*ValueExpr) 31 c.Assert(a3, Not(Equals), b3) 32 c.Assert(a3.GetValue(), Equals, int64(1)) 33 c.Assert(b3.GetValue(), Equals, int64(1)) 34 }