From 48869e13a4e5d5695de22e4232d516b1d973aca9 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Fri, 11 Jul 2014 18:30:16 -0400 Subject: [PATCH] Addressing `go vet` offenses --- flag_test.go | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/flag_test.go b/flag_test.go index 76dad72..4103236 100644 --- a/flag_test.go +++ b/flag_test.go @@ -71,10 +71,26 @@ var stringSliceFlagTests = []struct { value *cli.StringSlice expected string }{ - {"help", &cli.StringSlice{""}, "--help '--help option --help option'\t"}, - {"h", &cli.StringSlice{""}, "-h '-h option -h option'\t"}, - {"h", &cli.StringSlice{""}, "-h '-h option -h option'\t"}, - {"test", &cli.StringSlice{"Something"}, "--test '--test option --test option'\t"}, + {"help", func() *cli.StringSlice { + s := &cli.StringSlice{} + s.Set("") + return s + }(), "--help '--help option --help option'\t"}, + {"h", func() *cli.StringSlice { + s := &cli.StringSlice{} + s.Set("") + return s + }(), "-h '-h option -h option'\t"}, + {"h", func() *cli.StringSlice { + s := &cli.StringSlice{} + s.Set("") + return s + }(), "-h '-h option -h option'\t"}, + {"test", func() *cli.StringSlice { + s := &cli.StringSlice{} + s.Set("Something") + return s + }(), "--test '--test option --test option'\t"}, } func TestStringSliceFlagHelpOutput(t *testing.T) { @@ -143,7 +159,11 @@ var intSliceFlagTests = []struct { {"help", &cli.IntSlice{}, "--help '--help option --help option'\t"}, {"h", &cli.IntSlice{}, "-h '-h option -h option'\t"}, {"h", &cli.IntSlice{}, "-h '-h option -h option'\t"}, - {"test", &cli.IntSlice{9}, "--test '--test option --test option'\t"}, + {"test", func() *cli.IntSlice { + i := &cli.IntSlice{} + i.Set("9") + return i + }(), "--test '--test option --test option'\t"}, } func TestIntSliceFlagHelpOutput(t *testing.T) {