github.com/yunabe/lgo@v0.0.0-20190709125917-42c42d410fdf/converter/namepicker_test.go (about) 1 package converter 2 3 import ( 4 "go/ast" 5 "go/types" 6 "testing" 7 ) 8 9 func TestNamePicker(t *testing.T) { 10 picker := newNamePicker(map[*ast.Ident]types.Object{ 11 {Name: "y"}: nil, 12 }) 13 x := picker.NewName("x") 14 x0 := picker.NewName("x") 15 if x != "x" || x0 != "x0" { 16 t.Errorf("Expected (x, x0) but got (%s, %s)", x, x0) 17 } 18 19 y0 := picker.NewName("y") 20 y1 := picker.NewName("y") 21 if y0 != "y0" || y1 != "y1" { 22 t.Errorf("Expected (y0, y1) but got (%s, %s)", y0, y1) 23 } 24 }