feat: add tests for less stricter numeric conversion
This commit is contained in:
@@ -57,6 +57,20 @@ func TestInt2ArraySet(t *testing.T) {
|
||||
source interface{}
|
||||
result pgtype.Int2Array
|
||||
}{
|
||||
{
|
||||
source: []int64{1},
|
||||
result: pgtype.Int2Array{
|
||||
Elements: []pgtype.Int2{{Int: 1, Status: pgtype.Present}},
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []int32{1},
|
||||
result: pgtype.Int2Array{
|
||||
Elements: []pgtype.Int2{{Int: 1, Status: pgtype.Present}},
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []int16{1},
|
||||
result: pgtype.Int2Array{
|
||||
@@ -64,6 +78,27 @@ func TestInt2ArraySet(t *testing.T) {
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []int{1},
|
||||
result: pgtype.Int2Array{
|
||||
Elements: []pgtype.Int2{{Int: 1, Status: pgtype.Present}},
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []uint64{1},
|
||||
result: pgtype.Int2Array{
|
||||
Elements: []pgtype.Int2{{Int: 1, Status: pgtype.Present}},
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []uint32{1},
|
||||
result: pgtype.Int2Array{
|
||||
Elements: []pgtype.Int2{{Int: 1, Status: pgtype.Present}},
|
||||
Dimensions: []pgtype.ArrayDimension{{LowerBound: 1, Length: 1}},
|
||||
Status: pgtype.Present},
|
||||
},
|
||||
{
|
||||
source: []uint16{1},
|
||||
result: pgtype.Int2Array{
|
||||
|
||||
Reference in New Issue
Block a user