From 57c13bf516774f79f7c075af5c782c7890b81907 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Sat, 29 Jan 2022 23:07:49 +0300 Subject: [PATCH] test: add IPv4 case --- query_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/query_test.go b/query_test.go index 6ba8480e..8290e257 100644 --- a/query_test.go +++ b/query_test.go @@ -403,6 +403,18 @@ func TestClient_Query(t *testing.T) { require.Equal(t, 1, data.Rows()) require.Equal(t, v, data[0]) }) + t.Run("IPv4", func(t *testing.T) { + t.Parallel() + var data proto.ColIPv4 + require.NoError(t, Conn(t).Do(ctx, Query{ + Body: `SELECT '10.10.0.1'::IPv4 as v`, + Result: proto.Results{ + {Name: "v", Data: &data}, + }, + })) + require.Equal(t, 1, data.Rows()) + require.Equal(t, netaddr.MustParseIP("10.10.0.1"), data[0].ToIP()) + }) t.Run("InsertDateTime", func(t *testing.T) { t.Parallel() conn := Conn(t)