Skip to content

Increase test coverage#222

Open
ahcorde wants to merge 1 commit intorollingfrom
ahcorde/rolling/increate_test_coverage
Open

Increase test coverage#222
ahcorde wants to merge 1 commit intorollingfrom
ahcorde/rolling/increate_test_coverage

Conversation

@ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Mar 9, 2026

Description

Increased test coverage

Did you use Generative AI?

Claude Sonnet 4.6

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde self-assigned this Mar 9, 2026

TEST(test_asserts, assertion_exception_what_message) {
const rcpputils::AssertionException ex("assertion failed");
EXPECT_STREQ("assertion failed", ex.what());
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem like we are actually testing much here. I guess this is just increasing line coverage?

@ahcorde
Copy link
Contributor Author

ahcorde commented Mar 9, 2026

Pulls: #222
Gist: https://gist.githubusercontent.com/ahcorde/efee2093f1ba7cfbab357cad109a3ef3/raw/daf76a5dbe2a10d83c44d43996f002799918d67b/ros2.repos
BUILD args: --packages-above-and-dependencies rcpputils
TEST args: --packages-above rcpputils
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18416

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Comment on lines +42 to +49
TEST(TestGetEnv, test_get_env_returns_string_not_empty_when_set) {
// Verify set_env_var + get_env_var roundtrip preserves the value exactly.
EXPECT_TRUE(rcpputils::set_env_var("ROUNDTRIP_TEST", "hello_world"));
EXPECT_EQ(rcpputils::get_env_var("ROUNDTRIP_TEST"), std::string("hello_world"));
// Cleanup
EXPECT_TRUE(rcpputils::set_env_var("ROUNDTRIP_TEST", nullptr));
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this is already tested in test_set_env.

Comment on lines +100 to +106
TEST(TestSetEnv, test_set_env_overwrite_with_longer_value) {
EXPECT_TRUE(rcpputils::set_env_var("OVERWRITE_VAR", "short"));
EXPECT_TRUE(rcpputils::set_env_var("OVERWRITE_VAR", "a_much_longer_value_than_before"));
EXPECT_STREQ("a_much_longer_value_than_before",
rcpputils::get_env_var("OVERWRITE_VAR").c_str());
EXPECT_TRUE(rcpputils::set_env_var("OVERWRITE_VAR", nullptr));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this is already tested in test_set_env.

Comment on lines -22 to +24
EXPECT_EQ("test_process", rcpputils::get_executable_name());
const std::string name = rcpputils::get_executable_name();
EXPECT_FALSE(name.empty());
EXPECT_EQ("test_process", name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

i cannot tell the difference here... 🤔

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.

3 participants