assert: ensure message is always displayed & fix under bazel#276
assert: ensure message is always displayed & fix under bazel#276dnephin merged 6 commits intogotestyourself:mainfrom
Conversation
|
All tests run via I'll see if I can fix the lint issue. |
|
Hmm. The but that test passes with [email protected] on my machine (running macOS). Maybe a flaky test? Might bump CI with an empty commit. |
|
Yay! The tests pass. But I just realized that my editor was hiding the fact that tabs and spaces got mixed together in that big error message string. Just pushed a commit to fix that up. |
And move logic to a function so that variables can be closer to where they are used
dnephin
left a comment
There was a problem hiding this comment.
Thank you for the PR! I made a couple small changes, but overall this looks great.
Primarily I moved the variables to a bazel.go file, and extracted some of the logic to a new function. This way the variables and the code can be located a bit closer together.
I also extracted the multi-line error message to a raw string to make it a bit easier to read in code. The raw string removes the need to escape the double quotes.
If these changes look alright to you I think this is ready to be merged.
| name = "your_package_test", | ||
| srcs = ["your_test.go"], | ||
| deps = ["@tools_gotest_v3//assert"], | ||
| data = glob(["*_test.go"]) |
There was a problem hiding this comment.
On this line I added the trailing ) which I believe was missing, and removed the "test source files added as test data here!" comment. Does that seem ok? I guess the glob should capture all the test files.
There was a problem hiding this comment.
Thanks! Yes, I think this is great 👍
|
@dnephin Those changes look great! Don't see anything else I'd change. Thanks! |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [gotest.tools/v3](https://github.com/gotestyourself/gotest.tools) | require | patch | `v3.5.1` -> `v3.5.2` | --- ### Release Notes <details> <summary>gotestyourself/gotest.tools (gotest.tools/v3)</summary> ### [`v3.5.2`](https://github.com/gotestyourself/gotest.tools/releases/tag/v3.5.2) [Compare Source](gotestyourself/gotest.tools@v3.5.1...v3.5.2) #### What's Changed - assert: ensure message is always displayed & fix under bazel by [@​cstrahan](https://github.com/cstrahan) in gotestyourself/gotest.tools#276 - go.mod: golang.org/x/tools v0.13.0 for go1.22+ compatibility by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#282 - poll: Continue(): use format.Message for formatting by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#279 - fix TestFromDirSymlink on Windows due to missing drive-letter by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#283 - Fix various linting issues and minor bugs by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#280 - fix badges in readme, gofmt, and minor linting fix by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#284 - circleci: add go1.21, go1.22, go1.23, and update golangci-lint to v1.60.3 by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#285 - assert, assert/cmp: un-deprecate assert.ErrorType for now by [@​thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#286 #### New Contributors - [@​cstrahan](https://github.com/cstrahan) made their first contribution in gotestyourself/gotest.tools#276 **Full Changelog**: gotestyourself/gotest.tools@v3.5.1...v3.5.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMTIuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI1Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/524 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Note that I still need to run the tests, but I wanted to get this PR open ASAP.
This PR fixes #274.
Now, when running under
bazel testwe'll see the following sort of error message when the target test source file can't be found:If the user adds the test source file to their test data in the respective
go_testtarget, they'll now see something like: