Skip to content

Conversation

@brandur
Copy link
Contributor

@brandur brandur commented May 4, 2025

Now that we have an easy way to raise a full schema in tests through
riverdbtest, put in a more complete example test for the nilerror
package. It inserts a job, works the job, and checks for the warning
output that we expect the hook to produce.

@brandur brandur force-pushed the brandur-complete-example branch 5 times, most recently from 51de789 to 06763a2 Compare May 4, 2025 01:29
packageName = packagePath[lastSlash+1:]
nilPtrName = fmt.Sprintf("(*%s.%s)(<nil>)", packageName, nonPtrType.Name())
message = fmt.Sprintf("non-nil error containing nil internal value (see: https://go.dev/doc/faq#nil_error); probably a bug: %s", nilPtrName)
message = "non-nil error containing nil internal value (see: https://go.dev/doc/faq#nil_error); probably a bug: " + nilPtrName
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter did this automatically.


var logBuf bytes.Buffer
hook.Archetype.Logger = slog.New(&slogutil.SlogMessageOnlyHandler{Level: slog.LevelWarn, Out: &logBuf})
hook.Logger = slog.New(&slogutil.SlogMessageOnlyHandler{Level: slog.LevelWarn, Out: &logBuf})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one.

@brandur brandur requested a review from bgentry May 4, 2025 01:31
Now that we have an easy way to raise a full schema in tests through
`riverdbtest`, put in a more complete example test for the `nilerror`
package. It inserts a job, works the job, and checks for the warning
output that we expect the hook to produce.
@brandur brandur force-pushed the brandur-complete-example branch from a1d2b83 to 1a3eafc Compare May 4, 2025 21:01
@brandur brandur merged commit 741fb02 into master May 4, 2025
2 checks passed
@brandur brandur deleted the brandur-complete-example branch May 4, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants