mirror of
https://github.com/golang/go
synced 2024-11-11 23:10:23 -07:00
cmd/go: adjust TestFileLineInErrorMessages
cmd/go sometimes returns relative path in the error message (see shortPath function). Account for that during TestFileLineInErrorMessages. Fixes #11355 Change-Id: Ica79359eab48d669d307449fdd458764895fab2c Reviewed-on: https://go-review.googlesource.com/11475 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
29ff86b05b
commit
ebfc5be5b9
@ -548,7 +548,11 @@ func TestFileLineInErrorMessages(t *testing.T) {
|
|||||||
tg.tempFile("err.go", `package main; import "bar"`)
|
tg.tempFile("err.go", `package main; import "bar"`)
|
||||||
path := tg.path("err.go")
|
path := tg.path("err.go")
|
||||||
tg.runFail("run", path)
|
tg.runFail("run", path)
|
||||||
tg.grepStderr("^"+regexp.QuoteMeta(path)+":", "missing file:line in error message")
|
shortPath := path
|
||||||
|
if rel, err := filepath.Rel(tg.pwd(), path); err == nil && len(rel) < len(path) {
|
||||||
|
shortPath = rel
|
||||||
|
}
|
||||||
|
tg.grepStderr("^"+regexp.QuoteMeta(shortPath)+":", "missing file:line in error message")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProgramNameInCrashMessages(t *testing.T) {
|
func TestProgramNameInCrashMessages(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user