Этот коммит содержится в:
gedi 2019-02-12 15:16:30 +02:00
родитель 8fc6cc775b
коммит 7a57e63b00
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 56604CDCCC201556
5 изменённых файлов: 12 добавлений и 44 удалений

Просмотреть файл

@ -1,6 +1,6 @@
The three clause BSD license (http://en.wikipedia.org/wiki/BSD_licenses)
Copyright (c) 2015-2018, DATA-DOG team
Copyright (c) 2015-2019, DATA-DOG team
All rights reserved.
Redistribution and use in source and binary forms, with or without

Просмотреть файл

@ -51,7 +51,7 @@ func TestGodogBuildWithModuleOutsideGopath(t *testing.T) {
}
}
func TestGodogBuildWithModuleOutsideGopathWithXTest(t *testing.T) {
func TestGodogBuildWithModuleWithXTestOutsideGopath(t *testing.T) {
dir := filepath.Join(os.TempDir(), "godogs")
err := buildTestPackage(dir, map[string]string{
"godogs.feature": builderFeatureFile,

Просмотреть файл

@ -109,6 +109,8 @@ func main() {
}
`
var builderModFile = `module godogs`
func buildTestPackage(dir string, files map[string]string) error {
if err := os.MkdirAll(dir, 0755); err != nil {
return err
@ -144,6 +146,7 @@ func TestGodogBuildWithSourceNotInGoPath(t *testing.T) {
"godogs.feature": builderFeatureFile,
"godogs.go": builderMainCodeFile,
"godogs_test.go": builderTestFile,
"go.mod": builderModFile,
})
if err != nil {
os.RemoveAll(dir)
@ -178,6 +181,7 @@ func TestGodogBuildWithoutSourceNotInGoPath(t *testing.T) {
dir := filepath.Join(os.TempDir(), "godogs")
err := buildTestPackage(dir, map[string]string{
"godogs.feature": builderFeatureFile,
"go.mod": builderModFile,
})
if err != nil {
os.RemoveAll(dir)
@ -213,6 +217,7 @@ func TestGodogBuildWithoutTestSourceNotInGoPath(t *testing.T) {
err := buildTestPackage(dir, map[string]string{
"godogs.feature": builderFeatureFile,
"godogs.go": builderMainCodeFile,
"go.mod": builderModFile,
})
if err != nil {
os.RemoveAll(dir)
@ -250,6 +255,7 @@ func TestGodogBuildWithinGopath(t *testing.T) {
"godogs.feature": builderFeatureFile,
"godogs.go": builderMainCodeFile,
"godogs_test.go": builderTestFile,
"go.mod": builderModFile,
})
if err != nil {
os.RemoveAll(gopath)
@ -299,6 +305,7 @@ func TestGodogBuildWithVendoredGodog(t *testing.T) {
"godogs.feature": builderFeatureFile,
"godogs.go": builderMainCodeFile,
"godogs_test.go": builderTestFile,
"go.mod": builderModFile,
})
if err != nil {
os.RemoveAll(gopath)
@ -340,33 +347,3 @@ func TestGodogBuildWithVendoredGodog(t *testing.T) {
t.Fatal(err)
}
}
func TestBuildTestRunner(t *testing.T) {
bin := filepath.Join(os.TempDir(), "godog.test")
if err := Build(bin); err != nil {
t.Fatalf("failed to build godog test binary: %v", err)
}
os.Remove(bin)
}
func TestBuildTestRunnerWithoutGoFiles(t *testing.T) {
bin := filepath.Join(os.TempDir(), "godog.test")
pwd, err := os.Getwd()
if err != nil {
t.Fatalf("failed to get working directory: %v", err)
}
wd := filepath.Join(pwd, "features")
if err := os.Chdir(wd); err != nil {
t.Fatalf("failed to change working directory: %v", err)
}
defer func() {
_ = os.Chdir(pwd) // get back to current dir
}()
if err := Build(bin); err != nil {
t.Fatalf("failed to build godog test binary: %v", err)
}
os.Remove(bin)
}

1
go.mod Обычный файл
Просмотреть файл

@ -0,0 +1 @@
module godog

Просмотреть файл

@ -43,18 +43,8 @@ func TestStacktrace(t *testing.T) {
t.Fatalf("expected formatted trace error message to be: %s, but got %s", expect, actual)
}
expect = trimLineSpaces(`err msg
github.com/DATA-DOG/godog.callstack3
github.com/DATA-DOG/godog/stacktrace_test.go:29
github.com/DATA-DOG/godog.callstack2
github.com/DATA-DOG/godog/stacktrace_test.go:23
github.com/DATA-DOG/godog.callstack1
github.com/DATA-DOG/godog/stacktrace_test.go:19
github.com/DATA-DOG/godog.TestStacktrace
github.com/DATA-DOG/godog/stacktrace_test.go:37`)
actual = trimLineSpaces(fmt.Sprintf("%+v", err))
if expect != actual {
t.Fatalf("detaily formatted actual: %s", actual)
if strings.Index(actual, "stacktrace_test.go") == -1 {
t.Fatalf("does not have stacktrace in actual: %s", actual)
}
}