Skip to content
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

mock: document public APIs in the field module #2443

Merged
merged 13 commits into from
Nov 14, 2023
Merged

Conversation

hds
Copy link
Contributor

@hds hds commented Jan 13, 2023

Motivation

There has been interest around publishing tracing-mock to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

The field module needs documentation and examples.

Solution

This change adds documentation to the field module and all the public
APIs within it. This includes doctests on all the methods which serve as
examples.

Additionally, the field::msg function (which constructs a field with
name "message" and the provided value) was moved to expect::message.
This is part of a unification of all expectation constructors inside the
expect module.

Refs: #539

This change adds documentation to the `field` module and all the public
APIs within it. This includes doctests on all the methods which serve as
examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539
@hds hds requested review from hawkw, davidbarsky and a team as code owners January 13, 2023 08:53
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
Comment on lines 291 to 292
/// If we include `only` on the `ExpectedField` then the test
/// will fail:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// If we include `only` on the `ExpectedField` then the test
/// will fail:
/// The following example fails because [`ExpectedField::only`] is called:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I worded this a bit differently because the difference between the 2 examples is now that the second example records an additional field.

tracing-mock/src/field.rs Outdated Show resolved Hide resolved
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
hds and others added 3 commits October 31, 2023 11:13
Co-authored-by: David Barsky <me@davidbarsky.com>
Co-authored-by: David Barsky <me@davidbarsky.com>
Copy link
Contributor Author

@hds hds left a comment

Choose a reason for hiding this comment

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

@davidbarsky I've added your changes and made the suggested changes to the docs for only().

There was just one place in the only() docs where I felt that they didn't fit. Please let me know what you think.

tracing-mock/src/field.rs Outdated Show resolved Hide resolved
tracing-mock/src/field.rs Outdated Show resolved Hide resolved
Comment on lines 291 to 292
/// If we include `only` on the `ExpectedField` then the test
/// will fail:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I worded this a bit differently because the difference between the 2 examples is now that the second example records an additional field.

tracing-mock/src/field.rs Outdated Show resolved Hide resolved
@hds hds merged commit 29c494d into master Nov 14, 2023
56 checks passed
@hds hds deleted the hds/mock-docs-field branch November 14, 2023 11:29
hds added a commit that referenced this pull request Nov 5, 2024
This change adds documentation to the tracing-mock `field` module and
all the public APIs within it. This includes doctests on all the methods
which serve as examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539

Co-authored-by: David Barsky <me@davidbarsky.com>
hds added a commit that referenced this pull request Nov 5, 2024
This change adds documentation to the tracing-mock `field` module and
all the public APIs within it. This includes doctests on all the methods
which serve as examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539

Co-authored-by: David Barsky <me@davidbarsky.com>
hds added a commit that referenced this pull request Nov 7, 2024
This change adds documentation to the tracing-mock `field` module and
all the public APIs within it. This includes doctests on all the methods
which serve as examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539

Co-authored-by: David Barsky <me@davidbarsky.com>
hds added a commit that referenced this pull request Nov 7, 2024
This change adds documentation to the tracing-mock `field` module and
all the public APIs within it. This includes doctests on all the methods
which serve as examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539

Co-authored-by: David Barsky <me@davidbarsky.com>
hds added a commit that referenced this pull request Nov 20, 2024
This change adds documentation to the tracing-mock `field` module and
all the public APIs within it. This includes doctests on all the methods
which serve as examples.

Additionally, the `field::msg` function (which constructs a field with
name "message" and the provided value) was moved to `expect::message`.
This is part of a unification of all expectation constructors inside the
`expect` module.

Refs: #539

Co-authored-by: David Barsky <me@davidbarsky.com>
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.

2 participants