THRIFT-5650: Implement UUID in Go compiler
Client: go
diff --git a/lib/go/test/tests/equals_test.go b/lib/go/test/tests/equals_test.go
index 3bd14b6..b8adc77 100644
--- a/lib/go/test/tests/equals_test.go
+++ b/lib/go/test/tests/equals_test.go
@@ -23,9 +23,16 @@
"strconv"
"testing"
+ "github.com/apache/thrift/lib/go/thrift"
+
"github.com/apache/thrift/lib/go/test/gopath/src/equalstest"
)
+var (
+ equalstestUUID1 = thrift.Must(thrift.ParseTuuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
+ equalstestUUID2 = thrift.Must(thrift.ParseTuuid("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
+)
+
func TestEquals(t *testing.T) {
// test basic field
basicTgt, basicSrc := genBasicFoo(), genBasicFoo()
@@ -117,19 +124,19 @@
func genBasicFoo() *equalstest.BasicEqualsFoo {
return &equalstest.BasicEqualsFoo{
BoolFoo: true,
- OptBoolFoo: &(&struct{ x bool }{true}).x,
+ OptBoolFoo: thrift.BoolPtr(true),
I8Foo: 1,
- OptI8Foo: &(&struct{ x int8 }{1}).x,
+ OptI8Foo: thrift.Int8Ptr(1),
I16Foo: 2,
- OptI16Foo: &(&struct{ x int16 }{2}).x,
+ OptI16Foo: thrift.Int16Ptr(2),
I32Foo: 3,
- OptI32Foo: &(&struct{ x int32 }{3}).x,
+ OptI32Foo: thrift.Int32Ptr(3),
I64Foo: 4,
- OptI64Foo: &(&struct{ x int64 }{4}).x,
+ OptI64Foo: thrift.Int64Ptr(4),
DoubleFoo: 5,
- OptDoubleFoo: &(&struct{ x float64 }{5}).x,
+ OptDoubleFoo: thrift.Float64Ptr(6),
StrFoo: "6",
- OptStrFoo: &(&struct{ x string }{"6"}).x,
+ OptStrFoo: thrift.StringPtr("6"),
BinFoo: []byte("7"),
OptBinFoo: []byte("7"),
EnumFoo: equalstest.EnumFoo_e1,
@@ -140,6 +147,10 @@
OptMyStrFoo: equalstest.MystrPtr(equalstest.Mystr("9")),
MyBinFoo: equalstest.Mybin("10"),
OptMyBinFoo: equalstest.Mybin("10"),
+ UUIDFoo: equalstestUUID1,
+ OptUUIDFoo: thrift.TuuidPtr(equalstestUUID1),
+ MyUUIDFoo: equalstest.Myuuid(equalstestUUID1),
+ OptMyUUIDFoo: equalstest.MyuuidPtr(equalstest.Myuuid(equalstestUUID1)),
}
}
@@ -172,6 +183,10 @@
OptMyStrListFoo: []equalstest.Mystr{equalstest.Mystr("6"), equalstest.Mystr("5"), equalstest.Mystr("4"), equalstest.Mystr("3"), equalstest.Mystr("2"), equalstest.Mystr("1")},
MyBinListFoo: []equalstest.Mybin{equalstest.Mybin("6"), equalstest.Mybin("5"), equalstest.Mybin("4"), equalstest.Mybin("3"), equalstest.Mybin("2"), equalstest.Mybin("1")},
OptMyBinListFoo: []equalstest.Mybin{equalstest.Mybin("6"), equalstest.Mybin("5"), equalstest.Mybin("4"), equalstest.Mybin("3"), equalstest.Mybin("2"), equalstest.Mybin("1")},
+ UUIDListFoo: []thrift.Tuuid{equalstestUUID1, equalstestUUID2},
+ OptUUIDListFoo: []thrift.Tuuid{equalstestUUID1, equalstestUUID2},
+ MyUUIDListFoo: []equalstest.Myuuid{equalstest.Myuuid(equalstestUUID1), equalstest.Myuuid(equalstestUUID2)},
+ OptMyUUIDListFoo: []equalstest.Myuuid{equalstest.Myuuid(equalstestUUID1), equalstest.Myuuid(equalstestUUID2)},
}
}
@@ -197,6 +212,10 @@
OptMyStrSetFoo: []equalstest.Mystr{equalstest.Mystr("6"), equalstest.Mystr("5"), equalstest.Mystr("4"), equalstest.Mystr("3"), equalstest.Mystr("2"), equalstest.Mystr("1")},
MyBinSetFoo: []equalstest.Mybin{equalstest.Mybin("6"), equalstest.Mybin("5"), equalstest.Mybin("4"), equalstest.Mybin("3"), equalstest.Mybin("2"), equalstest.Mybin("1")},
OptMyBinSetFoo: []equalstest.Mybin{equalstest.Mybin("6"), equalstest.Mybin("5"), equalstest.Mybin("4"), equalstest.Mybin("3"), equalstest.Mybin("2"), equalstest.Mybin("1")},
+ UUIDSetFoo: []thrift.Tuuid{equalstestUUID1, equalstestUUID2},
+ OptUUIDSetFoo: []thrift.Tuuid{equalstestUUID1, equalstestUUID2},
+ MyUUIDSetFoo: []equalstest.Myuuid{equalstest.Myuuid(equalstestUUID1), equalstest.Myuuid(equalstestUUID2)},
+ OptMyUUIDSetFoo: []equalstest.Myuuid{equalstest.Myuuid(equalstestUUID1), equalstest.Myuuid(equalstestUUID2)},
}
}
@@ -227,6 +246,10 @@
OptInt64MyByteMapFoo: map[int64]equalstest.Mybyte{6: equalstest.Mybyte(6), 5: equalstest.Mybyte(5), 4: equalstest.Mybyte(4), 3: equalstest.Mybyte(3), 2: equalstest.Mybyte(2), 1: equalstest.Mybyte(1)},
MyByteInt64MapFoo: map[equalstest.Mybyte]int64{equalstest.Mybyte(6): 6, equalstest.Mybyte(5): 5, equalstest.Mybyte(4): 4, equalstest.Mybyte(3): 3, equalstest.Mybyte(2): 2, equalstest.Mybyte(1): 1},
OptMyByteInt64MapFoo: map[equalstest.Mybyte]int64{equalstest.Mybyte(6): 6, equalstest.Mybyte(5): 5, equalstest.Mybyte(4): 4, equalstest.Mybyte(3): 3, equalstest.Mybyte(2): 2, equalstest.Mybyte(1): 1},
+ UUIDMapFoo: map[int64]thrift.Tuuid{1: equalstestUUID1, 2: equalstestUUID2},
+ OptUUIDMapFoo: map[int64]thrift.Tuuid{1: equalstestUUID1, 2: equalstestUUID2},
+ MyUUIDMapFoo: map[int64]equalstest.Myuuid{1: equalstest.Myuuid(equalstestUUID1), 2: equalstest.Myuuid(equalstestUUID2)},
+ OptMyUUIDMapFoo: map[int64]equalstest.Myuuid{1: equalstest.Myuuid(equalstestUUID1), 2: equalstest.Myuuid(equalstestUUID2)},
}
}