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

Test file location wasn't clear, added example file tree #4179

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions source/Tutorials/Intermediate/Testing/Cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Package Setup

Source Code
^^^^^^^^^^^
We'll start off with our code in a file called ``test/tutorial_test.cpp``
We'll start off with our code in a file called ``<your_package>/test/tutorial_test.cpp``
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html#createpkg uses my_package, would be nice if we use that here as well.

Suggested change
We'll start off with our code in a file called ``<your_package>/test/tutorial_test.cpp``
We'll start off with our code in a file called ``my_package/test/tutorial_test.cpp``


.. code-block:: c++

#include <gtest/gtest.h>

TEST(package_name, a_first_test)
TEST(<your_package>, a_first_test)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
TEST(<your_package>, a_first_test)
TEST(my_package, a_first_test)

{
ASSERT_EQ(4, 2 + 2);
}
Expand All @@ -29,6 +29,18 @@ We'll start off with our code in a file called ``test/tutorial_test.cpp``
return RUN_ALL_TESTS();
}

Example package layout:
"""""""""""""""""""""""

.. code-block::

<your_workspace>/src/<your_package>/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<your_workspace>/src/<your_package>/
workspace_folder/src/my_package/

CMakeList.txt
include/
package.xml
src/
tests/
tutorial_test.cpp

package.xml
^^^^^^^^^^^
Expand Down
Loading