From 51d27121c7aa314890b8ce01f1bbe7c897e666e0 Mon Sep 17 00:00:00 2001 From: Ali Sabil Date: Tue, 29 Oct 2024 09:46:58 +0100 Subject: [PATCH] Improve the UUID appender test case --- appender_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/appender_test.go b/appender_test.go index ee302bdf..9a00e9f7 100644 --- a/appender_test.go +++ b/appender_test.go @@ -453,7 +453,9 @@ func TestAppenderUUID(t *testing.T) { c, con, a := prepareAppender(t, `CREATE TABLE test (id UUID)`) id := UUID(uuid.New()) + otherId := UUID(uuid.New()) require.NoError(t, a.AppendRow(id)) + require.NoError(t, a.AppendRow(otherId)) require.NoError(t, a.AppendRow((*UUID)(nil))) require.NoError(t, a.AppendRow(nil)) require.NoError(t, a.Flush()) @@ -464,12 +466,18 @@ func TestAppenderUUID(t *testing.T) { i := 0 for res.Next() { - var r *UUID - require.NoError(t, res.Scan(&r)) if i == 0 { - require.Equal(t, id, *r) + var r UUID + require.NoError(t, res.Scan(&r)) + require.Equal(t, id, r) } else { - require.Nil(t, r) + var r *UUID + require.NoError(t, res.Scan(&r)) + if i == 1 { + require.Equal(t, otherId, *r) + } else { + require.Nil(t, r) + } } i++ }