Skip to content

Commit

Permalink
iox-#1036 Add test ids, mention removed isValidFilePath in api change…
Browse files Browse the repository at this point in the history
… in release note

Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff committed Jun 29, 2022
1 parent b6ebbc0 commit 5274023
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
.expect("Oh no I couldn't create the lock file");
```

10. `isValidFilePath` is deprecated use `isValidPathToFile` instead.
10. `isValidFilePath` is removed use `isValidPathToFile` instead.
```cpp
// before
bool isCorrect = isValidFilePath("/path/to/file");
Expand Down
1 change: 1 addition & 0 deletions iceoryx_hoofs/include/iceoryx_hoofs/cxx/helplets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ enum class RelativePathComponents
/// @brief checks if the given string is a valid path entry. A path entry is the string between
/// two path separators.
/// @param[in] name the path entry in question
/// @param[in] relativePathComponents are relative path components are allowed for this path entry
/// @return true if it is valid, otherwise false
template <uint64_t StringCapacity>
bool isValidPathEntry(const string<StringCapacity>& name,
Expand Down
10 changes: 9 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_cxx_helplets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ TEST(Helplets_test_isValidPathToDirectory, EndingWithRelativePathComponentIsVali
EXPECT_TRUE(isValidPathToDirectory(string<FILE_PATH_LENGTH>("./blubb/fuu/../bla/..")));
}

TEST(Helplets_test_isValidPathToDirectory, FilePathsWithEndingDotsAreInvalid)
TEST(Helplets_test_isValidPathToDirectory, PathsWithEndingDotsAreInvalid)
{
::testing::Test::RecordProperty("TEST_ID", "f79660e6-12b5-4ad0-bc26-766da34898b8");
EXPECT_FALSE(isValidPathToDirectory(string<FILE_PATH_LENGTH>("a.")));
Expand Down Expand Up @@ -689,12 +689,14 @@ TEST(Helplets_test_doesEndWithPathSeparator, MultiCharacterStringEndingWithPathS

TEST(Helplets_test_isValidPathEntry, EmptyPathEntryIsValid)
{
::testing::Test::RecordProperty("TEST_ID", "1280b360-f26c-4ddf-8305-e01a99d58178");
EXPECT_TRUE(
isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>(""), iox::cxx::RelativePathComponents::ACCEPT));
}

TEST(Helplets_test_isValidPathEntry, PathEntryWithOnlyValidCharactersIsValid)
{
::testing::Test::RecordProperty("TEST_ID", "166fb334-05c6-4b8c-a117-223d6cadb29b");
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("a"),
iox::cxx::RelativePathComponents::ACCEPT));
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("agc"),
Expand All @@ -705,6 +707,7 @@ TEST(Helplets_test_isValidPathEntry, PathEntryWithOnlyValidCharactersIsValid)

TEST(Helplets_test_isValidPathEntry, RelativePathEntriesAreValid)
{
::testing::Test::RecordProperty("TEST_ID", "d3432692-7cee-416a-a3f3-c246a02ad1a2");
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("."),
iox::cxx::RelativePathComponents::ACCEPT));
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>(".."),
Expand All @@ -713,6 +716,7 @@ TEST(Helplets_test_isValidPathEntry, RelativePathEntriesAreValid)

TEST(Helplets_test_isValidPathEntry, EntriesWithEndingDotAreInvalid)
{
::testing::Test::RecordProperty("TEST_ID", "f937de46-19fc-48da-bce6-51292cd9d75e");
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("abc."),
iox::cxx::RelativePathComponents::ACCEPT));
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("19283912asdb.."),
Expand All @@ -725,6 +729,7 @@ TEST(Helplets_test_isValidPathEntry, EntriesWithEndingDotAreInvalid)

TEST(Helplets_test_isValidPathEntry, EntriesWithDotsNotAtTheEndAreValid)
{
::testing::Test::RecordProperty("TEST_ID", "569aa328-2c47-418d-96e2-ddf73925e52f");
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>(".abc"),
iox::cxx::RelativePathComponents::ACCEPT));
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>(".19283912asdb"),
Expand All @@ -737,13 +742,15 @@ TEST(Helplets_test_isValidPathEntry, EntriesWithDotsNotAtTheEndAreValid)

TEST(Helplets_test_isValidPathEntry, StringContainingAllValidCharactersIsValid)
{
::testing::Test::RecordProperty("TEST_ID", "b2c19516-e8fb-4fb8-a366-2b7b5fd9a84b");
EXPECT_TRUE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.:_"),
iox::cxx::RelativePathComponents::ACCEPT));
}

TEST(Helplets_test_isValidPathEntry, StringWithSlashIsInvalid)
{
::testing::Test::RecordProperty("TEST_ID", "b1119db1-f897-48a5-af92-9a92eb3f9832");
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("/fuuuu/"),
iox::cxx::RelativePathComponents::ACCEPT));
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("fuu/uu"),
Expand All @@ -756,6 +763,7 @@ TEST(Helplets_test_isValidPathEntry, StringWithSlashIsInvalid)

TEST(Helplets_test_isValidPathEntry, StringWithRelativeComponentsIsInvalidWhenItContainsRelativeComponents)
{
::testing::Test::RecordProperty("TEST_ID", "6c73e08e-3b42-446e-b8d4-a4ed7685f28e");
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("../to/be"),
iox::cxx::RelativePathComponents::REJECT));
EXPECT_FALSE(isValidPathEntry(string<iox::platform::IOX_MAX_FILENAME_LENGTH>("../../or/not"),
Expand Down

0 comments on commit 5274023

Please sign in to comment.