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

Fix typo in example on testing.md. #14274

Closed
wants to merge 2 commits into from
Closed

Conversation

cfredric
Copy link
Contributor

The example says that foo should correspond to provider_contents earlier in the text.

The example says that `foo` should correspond to `provider_contents` earlier in the text.
@gregestren
Copy link
Contributor

I don't have domain expertise on this, but note 5a74742 switched this in the other direction. I'll see if I can CC the original contributor for input.

@gregestren
Copy link
Contributor

@sfreilich - what do you think?

@cfredric
Copy link
Contributor Author

That commit looks like a big one focused on formatting; I'd be surprised if the switch of provider_contents to provider_contents_test in that commit was intentional.

@gregestren
Copy link
Contributor

So reviewing some more, it looks like the foo part is wrong, not the actual name.

In other words, the current text is:

the label of the target of this rule type should be foo (provider_contents_test)

If you look at the code it's referencing:

# Testing rule.
    provider_contents_test(name = "provider_contents_test",
  ...

That's an example of a foo_test name (provider_contents_test).

What do you think?

@gregestren
Copy link
Contributor

When you said "earlier in the text", which text specifically did you mean?

@cfredric
Copy link
Contributor Author

I'm referring to the following text:

For consistency, follow the recommended naming convention: Let `foo` stand for
the part of the test name that describes what the test is checking
(`provider_contents` in the above example).

starting on line 160.

@gregestren
Copy link
Contributor

Thanks. So my reading of the whole text is:

  • foo -> provider_contents
  • macro that generates the test: def _test_foo -> def _test_provider_contents():
  • test rule type: foo_test -> provider_contents_test = analysistest.make(_provider_contents_test_impl)
  • label of the target: foo_test -> provider_contents_test(name = "provider_contents_test",
  • implementation function: _foo_test_impl -> def _provider_contents_test_impl(ctx):
  • label of targets under test: foo_* -> target_under_test = ":provider_contents_subject")

So the part of the text reading the label of the target of this rule type should be foo is incorrect: there's no label in the example code matching foo.

@cfredric
Copy link
Contributor Author

Hmm, you're probably right; it wouldn't make much sense to have a target named foo whose rule type is foo_test. In that case, I think the bullet should be changed to:

* the label of the target of this rule type should be `foo_test` (`provider_contents_test`)'

WDYT?

@gregestren
Copy link
Contributor

Yes, I think that'd work!

@bazel-io bazel-io closed this in 5fd5afa Nov 29, 2021
Bencodes pushed a commit to Bencodes/bazel that referenced this pull request Jan 10, 2022
The example says that `foo` should correspond to `provider_contents` earlier in the text.

Closes bazelbuild#14274.

PiperOrigin-RevId: 412977913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants