add go.mod
Этот коммит содержится в:
родитель
8fc6cc775b
коммит
7a57e63b00
5 изменённых файлов: 12 добавлений и 44 удалений
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The three clause BSD license (http://en.wikipedia.org/wiki/BSD_licenses)
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
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")
|
dir := filepath.Join(os.TempDir(), "godogs")
|
||||||
err := buildTestPackage(dir, map[string]string{
|
err := buildTestPackage(dir, map[string]string{
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
|
|
|
@ -109,6 +109,8 @@ func main() {
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var builderModFile = `module godogs`
|
||||||
|
|
||||||
func buildTestPackage(dir string, files map[string]string) error {
|
func buildTestPackage(dir string, files map[string]string) error {
|
||||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -144,6 +146,7 @@ func TestGodogBuildWithSourceNotInGoPath(t *testing.T) {
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
"godogs.go": builderMainCodeFile,
|
"godogs.go": builderMainCodeFile,
|
||||||
"godogs_test.go": builderTestFile,
|
"godogs_test.go": builderTestFile,
|
||||||
|
"go.mod": builderModFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
|
@ -178,6 +181,7 @@ func TestGodogBuildWithoutSourceNotInGoPath(t *testing.T) {
|
||||||
dir := filepath.Join(os.TempDir(), "godogs")
|
dir := filepath.Join(os.TempDir(), "godogs")
|
||||||
err := buildTestPackage(dir, map[string]string{
|
err := buildTestPackage(dir, map[string]string{
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
|
"go.mod": builderModFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
|
@ -213,6 +217,7 @@ func TestGodogBuildWithoutTestSourceNotInGoPath(t *testing.T) {
|
||||||
err := buildTestPackage(dir, map[string]string{
|
err := buildTestPackage(dir, map[string]string{
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
"godogs.go": builderMainCodeFile,
|
"godogs.go": builderMainCodeFile,
|
||||||
|
"go.mod": builderModFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
|
@ -250,6 +255,7 @@ func TestGodogBuildWithinGopath(t *testing.T) {
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
"godogs.go": builderMainCodeFile,
|
"godogs.go": builderMainCodeFile,
|
||||||
"godogs_test.go": builderTestFile,
|
"godogs_test.go": builderTestFile,
|
||||||
|
"go.mod": builderModFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(gopath)
|
os.RemoveAll(gopath)
|
||||||
|
@ -299,6 +305,7 @@ func TestGodogBuildWithVendoredGodog(t *testing.T) {
|
||||||
"godogs.feature": builderFeatureFile,
|
"godogs.feature": builderFeatureFile,
|
||||||
"godogs.go": builderMainCodeFile,
|
"godogs.go": builderMainCodeFile,
|
||||||
"godogs_test.go": builderTestFile,
|
"godogs_test.go": builderTestFile,
|
||||||
|
"go.mod": builderModFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(gopath)
|
os.RemoveAll(gopath)
|
||||||
|
@ -340,33 +347,3 @@ func TestGodogBuildWithVendoredGodog(t *testing.T) {
|
||||||
t.Fatal(err)
|
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
Обычный файл
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)
|
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))
|
actual = trimLineSpaces(fmt.Sprintf("%+v", err))
|
||||||
if expect != actual {
|
if strings.Index(actual, "stacktrace_test.go") == -1 {
|
||||||
t.Fatalf("detaily formatted actual: %s", actual)
|
t.Fatalf("does not have stacktrace in actual: %s", actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче