Skip to content

Conversation

@hds
Copy link
Contributor

@hds hds commented Nov 24, 2025

Motivation

In order to add a regression test, #3379 added support to tracing-mock
to expect calls to on_register_dispatch for both mock subscribers and
mock layers. A negative integration test for the layer case was included
in #3415. However, there are no negative doctests for this (and as per
my own suggestion, there's no negative test for the subscriber method
either as I wasn't sure it was possible).

Solution

After a bit of thought, I realised that we could include a negative test
for the MockSubscriber. This change adds that test as a doctest, since
we have those in almost all of our documentation and also includes the
already written negative test for the MockLayer to a doctest.

In order to add a regression test, #3379 added support to `tracing-mock`
to expect calls to `on_register_dispatch` for both mock subscribers and
mock layers. A negative integration test for the layer case was included
in #3415. However, there are no negative doctests for this (and as per
my own suggestion, there's no negative test for the subscriber method
either as I wasn't sure it was possible).

After a bit of thought, I realised that we could include a negative test
for the `MockSubscriber`. This change adds that test as a doctest, since
we have those in almost all of our documentation and also includes the
already written negative test for the `MockLayer` to a doctest.
@hds hds requested review from a team and hawkw as code owners November 24, 2025 15:06
@hds hds merged commit efa0169 into main Nov 24, 2025
56 checks passed
@hds hds deleted the hds/mock-on-register-dispatch-neg-doc-tests branch November 24, 2025 21:34
hds added a commit that referenced this pull request Nov 25, 2025
# 0.1.0-beta.2 (November 30, 2025)

### Added

- Add `on_register_dispatch` expectation for subscriber and layer mocks ([#3415])
- Add doctests for `on_register_dispatch` negative cases ([#3416])

[#3415]: https://github.com/tokio-rs/tracing/pull/#3415
[#3416]: https://github.com/tokio-rs/tracing/pull/#3416
hds added a commit that referenced this pull request Nov 26, 2025
# 0.1.0-beta.2 (November 26, 2025)

### Added

- Add `on_register_dispatch` expectation for subscriber and layer mocks ([#3415])
- Add doctests for `on_register_dispatch` negative cases ([#3416])

### Changed

- `tracing`: updated to 0.1.42 ([#3418])

[#3415]: https://github.com/tokio-rs/tracing/pull/#3415
[#3416]: https://github.com/tokio-rs/tracing/pull/#3416
[#3418]: https://github.com/tokio-rs/tracing/pull/#3418
hds added a commit that referenced this pull request Nov 26, 2025
# 0.1.0-beta.2 (November 26, 2025)

### Added

- Add `on_register_dispatch` expectation for subscriber and layer mocks ([#3415])
- Add doctests for `on_register_dispatch` negative cases ([#3416])

### Changed

- `tracing`: updated to 0.1.42 ([#3418])

[#3415]: https://github.com/tokio-rs/tracing/pull/#3415
[#3416]: https://github.com/tokio-rs/tracing/pull/#3416
[#3418]: https://github.com/tokio-rs/tracing/pull/#3418
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.

5 participants