From f2e210ce355eef8776f8bad102046736523d21bb Mon Sep 17 00:00:00 2001 From: "Tomoya.Fujita" Date: Wed, 5 Aug 2020 13:59:59 +0900 Subject: [PATCH] restore env variables set in the test_failing_configuration. Signed-off-by: Tomoya.Fujita --- rcl/test/rcl/test_rmw_impl_id_check_func.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rcl/test/rcl/test_rmw_impl_id_check_func.cpp b/rcl/test/rcl/test_rmw_impl_id_check_func.cpp index 6398a3878..64da8c35c 100644 --- a/rcl/test/rcl/test_rmw_impl_id_check_func.cpp +++ b/rcl/test/rcl/test_rmw_impl_id_check_func.cpp @@ -31,10 +31,12 @@ TEST(TestRmwCheck, test_failing_configuration) { const char * get_env_var_name = rcutils_get_env( RMW_IMPLEMENTATION_ENV_VAR_NAME, &expected_rmw_impl_env); + EXPECT_FALSE(get_env_var_name); const char * get_env_id_matches_name = rcutils_get_env( RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME, &expected_rmw_id_matches); + EXPECT_FALSE(get_env_id_matches_name); // Fail test case, reason: RMW_IMPLEMENTATION_ENV_VAR_NAME set, not matching rmw impl EXPECT_TRUE(rcutils_set_env(RMW_IMPLEMENTATION_ENV_VAR_NAME, "some_random_name")); @@ -65,6 +67,6 @@ TEST(TestRmwCheck, test_failing_configuration) { rcl_reset_error(); // Restore env variables set in the test - EXPECT_TRUE(rcutils_set_env(RMW_IMPLEMENTATION_ENV_VAR_NAME, get_env_var_name)); - EXPECT_TRUE(rcutils_set_env(RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME, get_env_id_matches_name)); + EXPECT_TRUE(rcutils_set_env(RMW_IMPLEMENTATION_ENV_VAR_NAME, expected_rmw_impl_env)); + EXPECT_TRUE(rcutils_set_env(RCL_ASSERT_RMW_ID_MATCHES_ENV_VAR_NAME, expected_rmw_id_matches)); }