34 строки
788 Б
Go
34 строки
788 Б
Go
package parser_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/cucumber/godog/internal/parser"
|
|
)
|
|
|
|
func Test_FeatureFilePathParser(t *testing.T) {
|
|
type Case struct {
|
|
input string
|
|
path string
|
|
line int
|
|
}
|
|
|
|
cases := []Case{
|
|
{"/home/test.feature", "/home/test.feature", -1},
|
|
{"/home/test.feature:21", "/home/test.feature", 21},
|
|
{"test.feature", "test.feature", -1},
|
|
{"test.feature:2", "test.feature", 2},
|
|
{"", "", -1},
|
|
{"/c:/home/test.feature", "/c:/home/test.feature", -1},
|
|
{"/c:/home/test.feature:3", "/c:/home/test.feature", 3},
|
|
{"D:\\home\\test.feature:3", "D:\\home\\test.feature", 3},
|
|
}
|
|
|
|
for _, c := range cases {
|
|
p, ln := parser.ExtractFeaturePathLine(c.input)
|
|
assert.Equal(t, p, c.path)
|
|
assert.Equal(t, ln, c.line)
|
|
}
|
|
}
|