Skip to content

Commit

Permalink
gh-685: Fix celix_properties_setVersion ei test
Browse files Browse the repository at this point in the history
  • Loading branch information
pnoltes committed Apr 16, 2024
1 parent 4f84298 commit 19a2216
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libs/utils/gtest/src/PropertiesErrorInjectionTestSuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class PropertiesErrorInjectionTestSuite : public ::testing::Test {
celix_ei_expect_open_memstream(nullptr, 0, nullptr);
celix_ei_expect_asprintf(nullptr, 0, -1);
celix_ei_expect_malloc(nullptr, 0, nullptr);
celix_ei_expect_calloc(nullptr, 0, nullptr);
celix_ei_expect_celix_stringHashMap_createWithOptions(nullptr, 0, nullptr);
celix_ei_expect_celix_arrayList_copy(nullptr, 0, nullptr);
celix_ei_expect_celix_utils_strdup(nullptr, 0, nullptr);
Expand Down Expand Up @@ -453,11 +454,12 @@ TEST_F(PropertiesErrorInjectionTestSuite, SetVersionFailureTest) {
celix_err_resetErrors();

celix_autoptr(celix_version_t) version2 = celix_version_create(1, 2, 3, "aaaaaaaaaaaaaaaaaaaaaaaaaa");
celix_ei_expect_asprintf((void*) celix_version_toString, 0, -1);
celix_ei_expect_calloc((void*) celix_version_create, 0, nullptr);
status = celix_properties_setVersion(props, "key", version2);
ASSERT_EQ(status, CELIX_ENOMEM);
ASSERT_STREQ("Cannot fill property entry", celix_err_popLastError());
ASSERT_STREQ("Failed to allocate memory for celix_version_toString", celix_err_popLastError());
EXPECT_EQ(2, celix_err_getErrorCount());
ASSERT_STREQ("Failed to copy version", celix_err_popLastError());
ASSERT_STREQ("Failed to allocate memory for celix_version_create", celix_err_popLastError());
celix_err_resetErrors();

fillOptimizationCache(props);
Expand Down

0 comments on commit 19a2216

Please sign in to comment.