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

What to #include, namespaces not obvious from the documentation #4604

Open
dabrahams opened this issue Aug 26, 2024 · 6 comments · Fixed by XAMeLeOH/googletest#1 · May be fixed by #4620
Open

What to #include, namespaces not obvious from the documentation #4604

dabrahams opened this issue Aug 26, 2024 · 6 comments · Fixed by XAMeLeOH/googletest#1 · May be fixed by #4620

Comments

@dabrahams
Copy link

Describe the issue

For example, on this page I see uses of HasSubstring but nothing on that page tells me what namespace it comes from.

On this page I see

using ::testing::HasSubstr;

in examples, but #include <gtest/gtest.h> is insufficient to find that, and nothing on the page tells me what the right #include is.

Steps to reproduce the problem

Read the docs

What version of GoogleTest are you using?

ff233bd

What operating system and version are you using?

macOS 14.6.1

What compiler and version are you using?

gcc-14

What build system are you using?

CMake 29.3

Additional context

No response

@XAMeLeOH
Copy link

Dear Dave,

It seems it has already been fixed. If I check the reference link from your comment, I see the following in the last paragraph of the main section (just above the Wildcard header):

Built-in matchers ... are divided into several categories. All matchers are defined in the ::testing namespace unless otherwise noted.

Could you please confirm that?

@dabrahams
Copy link
Author

That covers the namespace but not what to #include.

@XAMeLeOH
Copy link

That covers the namespace but not what to #include.

Yeah, that makes sense.

I created a PR. Let's see if it gets merged. Feel free to review it too.

@XAMeLeOH
Copy link

XAMeLeOH commented Sep 25, 2024

From your comment:

Marchers.md was just an example. You need to do this for all of the files in the documentation, and double check that the name spaces are also specified.

I figured that the guides are fine, because they are teaching how to use the tool, not sure that information belongs there. Also the code snippets do mention the namespace one way or another.

I believe the most critical part are the references, that is why I checked testing, mocking, assertions, matchers and actions.
And to me it seems that the matchers and actions are the only ones which didn't reference the correct header and/or namespace.

@dabrahams
Copy link
Author

The code snippets I saw do not mention the namespace nor do they have #include directives. Remember that users will often jump to documentation for a specific facility rather than reading a whole page where that documentation is given. Whether you want to address this is of course up to you; I have no further comments.

@github-staff github-staff deleted a comment from Lxx-c Oct 23, 2024
@github-staff github-staff deleted a comment from Lxx-c Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants
@dabrahams @XAMeLeOH and others