grim/hgkeeper

closing merged branch
styling
2019-04-18, Gary Kramlich
110f88f716e7
closing merged branch
package hg
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
type testCase struct {
input string
expected string
}
func TestRepoFromCommand(t *testing.T) {
assert := assert.New(t)
cases := []testCase{
{"hg serve --stdio", ""},
{"hg -R foo serve --stdio", "foo"},
{"hg -R foo/bar serve --stdio", "foo/bar"},
}
for _, testCase := range cases {
fmt.Printf("-----\ntest: %s\n", testCase.input)
repo, err := RepoFromCommand(testCase.input)
fmt.Printf("%#v\n%s\n", err, err)
assert.Nil(err)
assert.Equal(repo.Path(), testCase.expected)
}
}