-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: testing/slogtest: Add RunWithSkip func #65400
Labels
Milestone
Comments
CC @jba |
If could not skip the test, |
I think you can do what you want with the existing
Please correct me if I've misunderstood. |
you are right, https://go.dev/play/p/nJY0XtnW6mz newHandler := func(tt *testing.T) slog.Handler {
if slices.Contains([]string{"TestSlogtest/empty-attr", "TestSlogtest/inline-group", "TestSlogtest/empty-group-record"}, tt.Name()) {
tt.Skip("skipped.")
}
buff.Reset()
return zapslog.NewHandler(core, nil)
}
run := func(tt *testing.T) map[string]any {
var ent map[string]any
if err := json.Unmarshal(buff.Bytes(), &ent); err != nil {
t.Fatal(err)
}
return ent
}
slogtest.Run(t, newHandler, tf) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Proposal Summary
Allows skipping of tests with specific names
Problems
Several logging libraries trying to support
log/slog
, but seem to not much importedtesting/slogtest
Background
This is just a guess based on my personal insight:
Proposal
Add
RunWithSkip
, allows skipping of tests with specific test names.Benefits
The text was updated successfully, but these errors were encountered: