grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
access:
access-control
2019-04-28, Wagner Riffel
bdb2c82e0679
access:
permissions: moved to its own file
yaml decoder: rolled back to old interface of taking an io.Reader
decoder: now it reads multiple keys from authrorized_keys file
all: minor syntaxy issues fixed, removed unsused variables
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
)
}
}