Added equality checks
This commit is contained in:
parent
a929de1b7c
commit
d365caf5a9
8 changed files with 122 additions and 12 deletions
21
file.go
Normal file
21
file.go
Normal 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 ""
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue