autogold icon indicating copy to clipboard operation
autogold copied to clipboard

add t.Helper to make file:line results more useful

Open dvitiuk-opensource opened this issue 4 years ago • 1 comments

With usage t.Hepler() when we got user code line instead of lib line in go test message.

dvitiuk-opensource avatar Apr 27 '21 17:04 dvitiuk-opensource

Hi! Thanks for your work! With this change errors in example folders will print files and lines with broken tests instead of library code.

➜  example git:(main) ✗ go test ./...                                                                                                                                                                                                           git:(main|✚2
--- FAIL: TestInline (0.04s)
    example_test.go:19: mismatch (-want +got):
        --- want
        +++ got
        @@ -1 +1 @@
        -&Baz{Name: "Jane", Age: 42}
        \ No newline at end of file
        +&Baz{Name: "Jane", Age: 31}
        \ No newline at end of file

--- FAIL: TestSubtest (0.00s)
    --- FAIL: TestSubtest/mysubtest (0.00s)
        example_test.go:29: mismatch (-want +got):
            --- want
            +++ got
            @@ -1 +1 @@
            -&Baz{Name: "Jane", Age: 42}
            \ No newline at end of file
            +&Baz{Name: "Jane", Age: 31}
            \ No newline at end of file

FAIL
FAIL	github.com/hexops/autogold/example	0.712s
FAIL

dvitiuk-opensource avatar Apr 27 '21 17:04 dvitiuk-opensource

@slimsag would like to see this one go in too. I can see this failed a DCO check, but I’m not sure the current PR builds are checking for this?

dackroyd avatar Dec 19 '22 08:12 dackroyd