Skip to content

Commit

Permalink
#79 Add test for the parsing multiple hosts separated by comma
Browse files Browse the repository at this point in the history
  • Loading branch information
zshamrock committed Nov 26, 2018
1 parent 7a67986 commit 2e505d5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions command/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package command

import (
"flag"
"github.com/go-test/deep"
"testing"

"github.com/zshamrock/vmx/config"
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 2e505d5

Please sign in to comment.