Skip to content

Commit 1530555

Browse files
committed
add isEmptyValue test for unknown type
1 parent fc903d2 commit 1530555

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

query/encode_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ func TestIsEmptyValue(t *testing.T) {
355355
// time
356356
{time.Time{}, true},
357357
{time.Now(), false},
358+
359+
// unknown type - always false unless a nil pointer, which are always empty.
360+
{(*struct{ int })(nil), true},
361+
{struct{ int }{}, false},
362+
{struct{ int }{0}, false},
363+
{struct{ int }{1}, false},
358364
}
359365

360366
for _, tt := range tests {

0 commit comments

Comments
 (0)