Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

TestTrimGOPATH fails when vendored #77

Closed
exp opened this issue Aug 1, 2016 · 0 comments · Fixed by #78
Closed

TestTrimGOPATH fails when vendored #77

exp opened this issue Aug 1, 2016 · 0 comments · Fixed by #78

Comments

@exp
Copy link
Contributor

exp commented Aug 1, 2016

Due to using a simple string inequality test this function will fail if the errors package is located in a vendor subdirectory:

--- FAIL: TestTrimGOPATH (0.00s)
        stack_test.go:165: stack_test.go:9: want "github.com/pkg/errors/stack_test.go", got "example.org/test/vendor/github.com/pkg/errors/stack_test.go"

A simple fix is to replace lines 163-166 with the same testFormatRegex function used elsewhere:

want := tt.want
if want != got {
    t.Errorf("%v: want %q, got %q", tt.Frame, want, got)
}

to

testFormatRegexp(t, got, "%s", tt.want)

This also requires changing the line numbers on the rest of the file, so a pull request is incoming shortly. This will also slightly change the error message returned when this test fails but I am not sure if that of any great consequence.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant