From bc5d47ca8d5b7fe18163e8354a55731b8b3806f2 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Mon, 2 May 2022 15:51:21 +0100 Subject: [PATCH] Fix test. --- list_darwin.go | 4 ++-- list_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/list_darwin.go b/list_darwin.go index 1ccb7ea..9e6a93c 100644 --- a/list_darwin.go +++ b/list_darwin.go @@ -5,7 +5,7 @@ import ( ) func list(text string, items []string, opts options) (string, error) { - if opts.extraButton != nil { + if len(items) == 0 || opts.extraButton != nil { return "", ErrUnsupported } @@ -23,7 +23,7 @@ func list(text string, items []string, opts options) (string, error) { } func listMultiple(text string, items []string, opts options) ([]string, error) { - if opts.extraButton != nil { + if len(items) == 0 || opts.extraButton != nil { return nil, ErrUnsupported } diff --git a/list_test.go b/list_test.go index 58d178c..a3b8f2b 100644 --- a/list_test.go +++ b/list_test.go @@ -48,7 +48,7 @@ func TestList_timeout(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Second/5) defer cancel() - _, err := zenity.List("", nil, zenity.Context(ctx)) + _, err := zenity.List("", []string{""}, zenity.Context(ctx)) if skip, err := skip(err); skip { t.Skip("skipping:", err) } @@ -62,7 +62,7 @@ func TestList_cancel(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() - _, err := zenity.List("", nil, zenity.Context(ctx)) + _, err := zenity.List("", []string{""}, zenity.Context(ctx)) if skip, err := skip(err); skip { t.Skip("skipping:", err) }