github.com/joey-fossa/fossa-cli@v0.7.34-0.20190708193710-569f1e8679f0/cmd/fossa/flags/flags_test.go (about) 1 package flags_test 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 "github.com/urfave/cli" 8 9 "github.com/fossas/fossa-cli/cmd/fossa/flags" 10 ) 11 12 func TestCombine(t *testing.T) { 13 fooFlag := cli.BoolFlag{Name: "foo", Usage: "bar"} 14 helloFlag := cli.BoolFlag{Name: "hello", Usage: "world"} 15 16 combined := flags.Combine( 17 []cli.Flag{fooFlag}, 18 []cli.Flag{fooFlag, helloFlag}, 19 ) 20 assert.ElementsMatch(t, combined, []cli.Flag{fooFlag, helloFlag}) 21 22 assert.Panics(t, func() { 23 flags.Combine( 24 []cli.Flag{fooFlag}, 25 []cli.Flag{cli.BoolFlag{Name: "foo", Usage: "baz"}}, 26 ) 27 }) 28 }