From 2e505d52ffed30e9b94fbdb9966d3de97976b13d Mon Sep 17 00:00:00 2001 From: Aliaksandr Kazlou Date: Sun, 25 Nov 2018 23:20:08 -0800 Subject: [PATCH] #79 Add test for the parsing multiple hosts separated by comma --- command/command_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/command/command_test.go b/command/command_test.go index 784c82a..84524a3 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -2,6 +2,7 @@ package command import ( "flag" + "github.com/go-test/deep" "testing" "github.com/zshamrock/vmx/config" @@ -83,3 +84,15 @@ func TestContainsFollow(t *testing.T) { } } } + +func TestParseMultipleHosts(t *testing.T) { + flags := flag.FlagSet{} + flags.Parse([]string{"dev1,dev2", "tail -f -n 10 logs/rest.log"}) + app := cli.NewApp() + context := cli.NewContext(app, &flags, nil) + hosts := getHosts(context, false) + expected := []string{"dev1", "dev2"} + if diff := deep.Equal(hosts, expected); diff != nil { + t.Error(diff) + } +}