Сравнить коммиты
6 коммитов
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
6b1ff27907 | ||
|
|
a061cf91d1 | ||
|
|
df19a9120a | ||
|
|
fe103371e1 | ||
|
|
61d22264e4 | ||
|
|
f199c7ace8 |
2 изменённых файлов: 35 добавлений и 0 удалений
|
|
@ -44,6 +44,9 @@ func getTestAssertPlace() string {
|
|||
}
|
||||
func getTestAssertFullPathPlace() string {
|
||||
_, file, line, _ := runtime.Caller(CALL_STACK_DEPTH_TO_TEST_FILE)
|
||||
if strings.HasSuffix(file, "/godog_and_gomega_helpers.go") {
|
||||
_, file, line, _ = runtime.Caller(CALL_STACK_DEPTH_TO_TEST_FILE + 1)
|
||||
}
|
||||
return fmt.Sprintf("%v:%v", file, line)
|
||||
}
|
||||
func getProjectRootRelativeTestAssertPlace(place string) string {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package godog_and_gomega
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
|
@ -43,3 +45,33 @@ func Atof(in string) float64 {
|
|||
Ok(err)
|
||||
return res
|
||||
}
|
||||
|
||||
func Истина(in string) bool {
|
||||
switch in {
|
||||
case "+", "да", "Да", "ДА", "t", "true", "True", "TRUE":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func SetTestDeadlockProtection(seconds int) {
|
||||
go checkTestTimeout(time.Duration(seconds) * time.Second)
|
||||
}
|
||||
func checkTestTimeout(t time.Duration) {
|
||||
<-time.After(t)
|
||||
panic("Test Suite Timeout")
|
||||
}
|
||||
|
||||
func SetTestDeadlockProtection_WithStackDump(seconds int) {
|
||||
go checkTestTimeout_WithStackDump(time.Duration(seconds) * time.Second)
|
||||
}
|
||||
func checkTestTimeout_WithStackDump(t time.Duration) {
|
||||
<-time.After(t)
|
||||
PrintGoroutineStacks()
|
||||
panic("Test Suite Timeout")
|
||||
}
|
||||
func PrintGoroutineStacks() {
|
||||
buf := make([]byte, 1<<16)
|
||||
stackSize := runtime.Stack(buf, true)
|
||||
fmt.Printf("Goroutine stack trace:\n%s\n", buf[:stackSize])
|
||||
}
|
||||
Загрузка…
Создание таблицы
Сослаться в новой задаче