Added equality checks

This commit is contained in:
Eduard Urbach 2023-07-05 13:14:37 +02:00
parent a929de1b7c
commit d365caf5a9
Signed by: eduard
GPG key ID: 49226B848C78F6C8
8 changed files with 122 additions and 12 deletions

21
file.go Normal file
View file

@ -0,0 +1,21 @@
package assert
import (
"runtime/debug"
"strings"
"testing"
)
// file returns the first line containing "_test.go" in the debug stack.
func file(t testing.TB) string {
stack := string(debug.Stack())
lines := strings.Split(stack, "\n")
for _, line := range lines {
if strings.Contains(line, "_test.go") {
return strings.TrimSpace(line)
}
}
return ""
}